| // Copyright 2013 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
| |
| #include "base/command_line.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "components/variations/variations_associated_data.h" |
| #include "extensions/common/features/feature.h" |
| #include "extensions/common/features/feature_provider.h" |
| |
| const char kFieldTrialName[] = "EnhancedBookmarks"; |
| |
| bool IsEnhancedBookmarksExperimentEnabled() { |
| std::string ext_id = GetEnhancedBookmarksExtensionId(); |
| extensions::FeatureProvider* feature_provider = |
| extensions::FeatureProvider::GetPermissionFeatures(); |
| extensions::Feature* feature = feature_provider->GetFeature("metricsPrivate"); |
| return (feature && feature->IsIdInWhitelist(ext_id)); |
| } |
| |
| bool IsEnableDomDistillerSet() { |
| if (CommandLine::ForCurrentProcess()-> |
| HasSwitch(switches::kEnableDomDistiller)) { |
| return true; |
| } |
| if (chrome_variations::GetVariationParamValue( |
| kFieldTrialName, "enable-dom-distiller") == "1") |
| return true; |
| |
| return false; |
| } |
| |
| bool IsEnableSyncArticlesSet() { |
| if (CommandLine::ForCurrentProcess()-> |
| HasSwitch(switches::kEnableSyncArticles)) { |
| return true; |
| } |
| if (chrome_variations::GetVariationParamValue( |
| kFieldTrialName, "enable-sync-articles") == "1") |
| return true; |
| |
| return false; |
| } |
| |
| std::string GetEnhancedBookmarksExtensionId() { |
| return chrome_variations::GetVariationParamValue(kFieldTrialName, "id"); |
| } |