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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 172 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
173 if (command_line->HasSwitch(switches::kManualEnhancedBookmarks) || | 173 if (command_line->HasSwitch(switches::kManualEnhancedBookmarks) || |
174 command_line->HasSwitch(switches::kManualEnhancedBookmarksOptout)) { | 174 command_line->HasSwitch(switches::kManualEnhancedBookmarksOptout)) { |
175 return true; | 175 return true; |
176 } | 176 } |
177 | 177 |
178 return IsEnhancedBookmarksExperimentEnabledFromFinch(); | 178 return IsEnhancedBookmarksExperimentEnabledFromFinch(); |
179 } | 179 } |
180 | 180 |
181 #if defined(OS_ANDROID) | 181 #if defined(OS_ANDROID) |
182 bool IsEnhancedBookmarkImageFetchingEnabled() { | 182 bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService* user_prefs) { |
183 if (IsEnhancedBookmarksExperimentEnabled()) | 183 if (IsEnhancedBookmarksEnabled(user_prefs)) |
184 return true; | 184 return true; |
185 | 185 |
186 // Salient images are collected from visited bookmarked pages even if the | 186 // Salient images are collected from visited bookmarked pages even if the |
187 // enhanced bookmark feature is turned off. This is to have some images | 187 // enhanced bookmark feature is turned off. This is to have some images |
188 // available so that in the future, when the feature is turned on, the user | 188 // available so that in the future, when the feature is turned on, the user |
189 // experience is not a big list of flat colors. However as a precautionary | 189 // experience is not a big list of flat colors. However as a precautionary |
190 // measure it is possible to disable this collection of images from finch. | 190 // measure it is possible to disable this collection of images from finch. |
191 std::string disable_fetching = variations::GetVariationParamValue( | 191 std::string disable_fetching = variations::GetVariationParamValue( |
192 kFieldTrialName, "DisableImagesFetching"); | 192 kFieldTrialName, "DisableImagesFetching"); |
193 return disable_fetching.empty(); | 193 return disable_fetching.empty(); |
194 } | 194 } |
| 195 |
| 196 bool IsEnhancedBookmarksEnabled(const PrefService* user_prefs) { |
| 197 BookmarksExperimentState bookmarks_experiment_state = |
| 198 static_cast<BookmarksExperimentState>(user_prefs->GetInteger( |
| 199 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled)); |
| 200 return bookmarks_experiment_state == BOOKMARKS_EXPERIMENT_ENABLED |
| 201 || bookmarks_experiment_state == BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH; |
| 202 } |
195 #endif | 203 #endif |
196 | 204 |
197 bool IsEnableDomDistillerSet() { | 205 bool IsEnableDomDistillerSet() { |
198 if (CommandLine::ForCurrentProcess()-> | 206 if (CommandLine::ForCurrentProcess()-> |
199 HasSwitch(switches::kEnableDomDistiller)) { | 207 HasSwitch(switches::kEnableDomDistiller)) { |
200 return true; | 208 return true; |
201 } | 209 } |
202 if (variations::GetVariationParamValue( | 210 if (variations::GetVariationParamValue( |
203 kFieldTrialName, "enable-dom-distiller") == "1") | 211 kFieldTrialName, "enable-dom-distiller") == "1") |
204 return true; | 212 return true; |
205 | 213 |
206 return false; | 214 return false; |
207 } | 215 } |
208 | 216 |
209 bool IsEnableSyncArticlesSet() { | 217 bool IsEnableSyncArticlesSet() { |
210 if (CommandLine::ForCurrentProcess()-> | 218 if (CommandLine::ForCurrentProcess()-> |
211 HasSwitch(switches::kEnableSyncArticles)) { | 219 HasSwitch(switches::kEnableSyncArticles)) { |
212 return true; | 220 return true; |
213 } | 221 } |
214 if (variations::GetVariationParamValue( | 222 if (variations::GetVariationParamValue( |
215 kFieldTrialName, "enable-sync-articles") == "1") | 223 kFieldTrialName, "enable-sync-articles") == "1") |
216 return true; | 224 return true; |
217 | 225 |
218 return false; | 226 return false; |
219 } | 227 } |
OLD | NEW |