OLD | NEW |
---|---|
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT) { | 122 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT) { |
123 if (opt_out) { | 123 if (opt_out) { |
124 bookmarks_experiment_new_state = | 124 bookmarks_experiment_new_state = |
125 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT; | 125 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT; |
126 } else { | 126 } else { |
127 // User opted in again. | 127 // User opted in again. |
128 bookmarks_experiment_new_state = BOOKMARKS_EXPERIMENT_ENABLED; | 128 bookmarks_experiment_new_state = BOOKMARKS_EXPERIMENT_ENABLED; |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 #if defined(OS_ANDROID) | |
133 bool opt_in = !opt_out | |
134 && CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
135 switches::kEnhancedBookmarksExperiment) == "1"; | |
136 if (opt_in && bookmarks_experiment_new_state == BOOKMARKS_EXPERIMENT_NONE) | |
137 bookmarks_experiment_new_state = BOOKMARKS_EXPERIMENT_ENABLED; | |
138 #endif | |
139 | |
132 UMA_HISTOGRAM_ENUMERATION("EnhancedBookmarks.SyncExperimentState", | 140 UMA_HISTOGRAM_ENUMERATION("EnhancedBookmarks.SyncExperimentState", |
133 bookmarks_experiment_new_state, | 141 bookmarks_experiment_new_state, |
134 BOOKMARKS_EXPERIMENT_ENUM_SIZE); | 142 BOOKMARKS_EXPERIMENT_ENUM_SIZE); |
135 user_prefs->SetInteger( | 143 user_prefs->SetInteger( |
136 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled, | 144 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled, |
137 bookmarks_experiment_new_state); | 145 bookmarks_experiment_new_state); |
138 ForceFinchBookmarkExperimentIfNeeded(flags_storage, | 146 ForceFinchBookmarkExperimentIfNeeded(flags_storage, |
139 bookmarks_experiment_new_state); | 147 bookmarks_experiment_new_state); |
140 } | 148 } |
141 | 149 |
(...skipping 21 matching lines...) Expand all Loading... | |
163 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT) { | 171 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT) { |
164 experiments_list->Remove( | 172 experiments_list->Remove( |
165 base::StringValue(switches::kManualEnhancedBookmarks), &index); | 173 base::StringValue(switches::kManualEnhancedBookmarks), &index); |
166 experiments_list->AppendIfNotPresent( | 174 experiments_list->AppendIfNotPresent( |
167 new base::StringValue(switches::kManualEnhancedBookmarksOptout)); | 175 new base::StringValue(switches::kManualEnhancedBookmarksOptout)); |
168 } | 176 } |
169 } | 177 } |
170 | 178 |
171 bool IsEnhancedBookmarksExperimentEnabled() { | 179 bool IsEnhancedBookmarksExperimentEnabled() { |
172 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 180 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
181 #if defined(OS_ANDROID) | |
182 if (command_line->HasSwitch(switches::kManualEnhancedBookmarks)) | |
Kibeom Kim (inactive)
2014/08/27 22:25:53
actually, this is wrong, I should get the switch v
Kibeom Kim (inactive)
2014/08/28 00:02:59
Done.
| |
183 return true; | |
184 #else | |
173 if (command_line->HasSwitch(switches::kManualEnhancedBookmarks) || | 185 if (command_line->HasSwitch(switches::kManualEnhancedBookmarks) || |
174 command_line->HasSwitch(switches::kManualEnhancedBookmarksOptout)) { | 186 command_line->HasSwitch(switches::kManualEnhancedBookmarksOptout)) { |
175 return true; | 187 return true; |
176 } | 188 } |
189 #endif | |
177 | 190 |
178 return IsEnhancedBookmarksExperimentEnabledFromFinch(); | 191 return IsEnhancedBookmarksExperimentEnabledFromFinch(); |
179 } | 192 } |
180 | 193 |
181 #if defined(OS_ANDROID) | 194 #if defined(OS_ANDROID) |
182 bool IsEnhancedBookmarkImageFetchingEnabled() { | 195 bool IsEnhancedBookmarkImageFetchingEnabled() { |
183 if (IsEnhancedBookmarksExperimentEnabled()) | 196 if (IsEnhancedBookmarksExperimentEnabled()) |
184 return true; | 197 return true; |
185 | 198 |
186 // Salient images are collected from visited bookmarked pages even if the | 199 // Salient images are collected from visited bookmarked pages even if the |
(...skipping 23 matching lines...) Expand all Loading... | |
210 if (CommandLine::ForCurrentProcess()-> | 223 if (CommandLine::ForCurrentProcess()-> |
211 HasSwitch(switches::kEnableSyncArticles)) { | 224 HasSwitch(switches::kEnableSyncArticles)) { |
212 return true; | 225 return true; |
213 } | 226 } |
214 if (variations::GetVariationParamValue( | 227 if (variations::GetVariationParamValue( |
215 kFieldTrialName, "enable-sync-articles") == "1") | 228 kFieldTrialName, "enable-sync-articles") == "1") |
216 return true; | 229 return true; |
217 | 230 |
218 return false; | 231 return false; |
219 } | 232 } |
OLD | NEW |