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

Unified Diff: chrome/browser/bookmarks/enhanced_bookmarks_features.cc

Issue 497563002: [Android] Use correct enhanced bookmarks enabling logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use proper enhanced bookmarks flag logic (changed completely) 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/bookmarks/enhanced_bookmarks_features.cc
diff --git a/chrome/browser/bookmarks/enhanced_bookmarks_features.cc b/chrome/browser/bookmarks/enhanced_bookmarks_features.cc
index aad3817e1bcacbf3786729c87ccb50b76c88132b..8103d24b3fcb6f3759c0f469813bfe2c15811386 100644
--- a/chrome/browser/bookmarks/enhanced_bookmarks_features.cc
+++ b/chrome/browser/bookmarks/enhanced_bookmarks_features.cc
@@ -129,6 +129,14 @@ void UpdateBookmarksExperimentState(
}
}
+#if defined(OS_ANDROID)
+ bool opt_in = !opt_out
+ && CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kEnhancedBookmarksExperiment) == "1";
+ if (opt_in && bookmarks_experiment_new_state == BOOKMARKS_EXPERIMENT_NONE)
+ bookmarks_experiment_new_state = BOOKMARKS_EXPERIMENT_ENABLED;
+#endif
+
UMA_HISTOGRAM_ENUMERATION("EnhancedBookmarks.SyncExperimentState",
bookmarks_experiment_new_state,
BOOKMARKS_EXPERIMENT_ENUM_SIZE);
@@ -168,19 +176,10 @@ void ForceFinchBookmarkExperimentIfNeeded(
}
}
-bool IsEnhancedBookmarksExperimentEnabled() {
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kManualEnhancedBookmarks) ||
- command_line->HasSwitch(switches::kManualEnhancedBookmarksOptout)) {
- return true;
- }
-
- return IsEnhancedBookmarksExperimentEnabledFromFinch();
-}
-
#if defined(OS_ANDROID)
-bool IsEnhancedBookmarkImageFetchingEnabled() {
- if (IsEnhancedBookmarksExperimentEnabled())
+
+bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService* user_prefs) {
+ if (IsEnhancedBookmarksExperimentEnabled(user_prefs))
return true;
// Salient images are collected from visited bookmarked pages even if the
@@ -192,6 +191,27 @@ bool IsEnhancedBookmarkImageFetchingEnabled() {
kFieldTrialName, "DisableImagesFetching");
return disable_fetching.empty();
}
+
+bool IsEnhancedBookmarksExperimentEnabled(const PrefService* user_prefs) {
+ BookmarksExperimentState bookmarks_experiment_state =
+ static_cast<BookmarksExperimentState>(user_prefs->GetInteger(
+ sync_driver::prefs::kEnhancedBookmarksExperimentEnabled));
+ return bookmarks_experiment_state == BOOKMARKS_EXPERIMENT_ENABLED
Yaron 2014/08/27 20:42:15 Why can't you use the switches variant? Isn't that
Kibeom Kim (inactive) 2014/08/27 21:11:41 I see. I was following the logic here https://chr
+ || bookmarks_experiment_state == BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH;
+}
+
+#else
+
+bool IsEnhancedBookmarksExperimentEnabled() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kManualEnhancedBookmarks) ||
+ command_line->HasSwitch(switches::kManualEnhancedBookmarksOptout)) {
+ return true;
+ }
+
+ return IsEnhancedBookmarksExperimentEnabledFromFinch();
+}
+
#endif
bool IsEnableDomDistillerSet() {

Powered by Google App Engine
This is Rietveld 408576698