Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: chrome/browser/bookmarks/enhanced_bookmarks_features.cc

Issue 454983002: [Android] Check if enhanced bookmarks id is set by finch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mistake Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" 5 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 10 matching lines...) Expand all
21 21
22 const char kFieldTrialName[] = "EnhancedBookmarks"; 22 const char kFieldTrialName[] = "EnhancedBookmarks";
23 23
24 // Get extension id from Finch EnhancedBookmarks group parameters. 24 // Get extension id from Finch EnhancedBookmarks group parameters.
25 std::string GetEnhancedBookmarksExtensionIdFromFinch() { 25 std::string GetEnhancedBookmarksExtensionIdFromFinch() {
26 return variations::GetVariationParamValue(kFieldTrialName, "id"); 26 return variations::GetVariationParamValue(kFieldTrialName, "id");
27 } 27 }
28 28
29 // Returns true if enhanced bookmarks experiment is enabled from Finch. 29 // Returns true if enhanced bookmarks experiment is enabled from Finch.
30 bool IsEnhancedBookmarksExperimentEnabledFromFinch() { 30 bool IsEnhancedBookmarksExperimentEnabledFromFinch() {
31 const std::string ext_id = GetEnhancedBookmarksExtensionIdFromFinch();
31 #if defined(OS_ANDROID) 32 #if defined(OS_ANDROID)
32 return false; 33 return !ext_id.empty();
33 #endif 34 #else
34 std::string ext_id = GetEnhancedBookmarksExtensionIdFromFinch();
35 const extensions::FeatureProvider* feature_provider = 35 const extensions::FeatureProvider* feature_provider =
36 extensions::FeatureProvider::GetPermissionFeatures(); 36 extensions::FeatureProvider::GetPermissionFeatures();
37 extensions::Feature* feature = feature_provider->GetFeature("metricsPrivate"); 37 extensions::Feature* feature = feature_provider->GetFeature("metricsPrivate");
38 return feature && feature->IsIdInWhitelist(ext_id); 38 return feature && feature->IsIdInWhitelist(ext_id);
39 #endif
39 } 40 }
40 41
41 }; // namespace 42 }; // namespace
42 43
43 bool GetBookmarksExperimentExtensionID(const PrefService* user_prefs, 44 bool GetBookmarksExperimentExtensionID(const PrefService* user_prefs,
44 std::string* extension_id) { 45 std::string* extension_id) {
45 BookmarksExperimentState bookmarks_experiment_state = 46 BookmarksExperimentState bookmarks_experiment_state =
46 static_cast<BookmarksExperimentState>(user_prefs->GetInteger( 47 static_cast<BookmarksExperimentState>(user_prefs->GetInteger(
47 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled)); 48 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled));
48 if (bookmarks_experiment_state == BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH) { 49 if (bookmarks_experiment_state == BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 if (CommandLine::ForCurrentProcess()-> 210 if (CommandLine::ForCurrentProcess()->
210 HasSwitch(switches::kEnableSyncArticles)) { 211 HasSwitch(switches::kEnableSyncArticles)) {
211 return true; 212 return true;
212 } 213 }
213 if (variations::GetVariationParamValue( 214 if (variations::GetVariationParamValue(
214 kFieldTrialName, "enable-sync-articles") == "1") 215 kFieldTrialName, "enable-sync-articles") == "1")
215 return true; 216 return true;
216 217
217 return false; 218 return false;
218 } 219 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698