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..8111dc7e8815d0484cd971921d8c8b3ba550b370 100644 |
--- a/chrome/browser/bookmarks/enhanced_bookmarks_features.cc |
+++ b/chrome/browser/bookmarks/enhanced_bookmarks_features.cc |
@@ -39,6 +39,16 @@ bool IsEnhancedBookmarksExperimentEnabledFromFinch() { |
#endif |
} |
+PrefService* GetFlagsStorage(PrefService* user_prefs, |
+ PrefService* local_state) { |
+#if defined(OS_CHROMEOS) |
+ // Chrome OS is using user prefs for flags storage. |
+ return user_prefs; |
+#else |
+ return local_state; |
+#endif |
+} |
+ |
}; // namespace |
bool GetBookmarksExperimentExtensionID(const PrefService* user_prefs, |
@@ -64,11 +74,7 @@ void UpdateBookmarksExperimentState( |
PrefService* local_state, |
bool user_signed_in, |
BookmarksExperimentState experiment_enabled_from_sync) { |
- PrefService* flags_storage = local_state; |
-#if defined(OS_CHROMEOS) |
- // Chrome OS is using user prefs for flags storage. |
- flags_storage = user_prefs; |
-#endif |
+ PrefService* flags_storage = GetFlagsStorage(user_prefs, local_state); |
BookmarksExperimentState bookmarks_experiment_state_before = |
static_cast<BookmarksExperimentState>(user_prefs->GetInteger( |
@@ -129,6 +135,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 +182,11 @@ 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(PrefService* user_prefs, |
+ PrefService* local_state) { |
+ if (IsEnhancedBookmarksExperimentEnabled(user_prefs, local_state)) |
return true; |
// Salient images are collected from visited bookmarked pages even if the |
@@ -192,6 +198,40 @@ bool IsEnhancedBookmarkImageFetchingEnabled() { |
kFieldTrialName, "DisableImagesFetching"); |
return disable_fetching.empty(); |
} |
+ |
+bool IsEnhancedBookmarksExperimentEnabled(PrefService* user_prefs, |
+ PrefService* local_state) { |
+ PrefService* flags_storage = GetFlagsStorage(user_prefs, local_state); |
+ |
+ const base::ListValue* experiments_list = flags_storage->GetList( |
+ prefs::kEnabledLabsExperiments); |
+ |
+ if (flags_storage) { |
+ if (experiments_list->Find( |
+ base::StringValue(switches::kManualEnhancedBookmarks)) |
Yaron
2014/08/28 00:17:40
I don't understand the distinction here. Either ex
Kibeom Kim (inactive)
2014/08/28 18:31:00
Done.
|
+ != experiments_list->end()) { |
+ return true; |
+ } else if (experiments_list->Find( |
+ base::StringValue(switches::kManualEnhancedBookmarksOptout)) |
+ != experiments_list->end()) { |
+ return false; |
+ } |
+ } |
+ |
+ return IsEnhancedBookmarksExperimentEnabledFromFinch(); |
+} |
+ |
+#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() { |