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" |
11 #include "base/sha1.h" | 11 #include "base/sha1.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/flags_storage.h" | |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 #include "components/signin/core/browser/signin_manager.h" | 19 #include "components/signin/core/browser/signin_manager.h" |
19 #include "components/sync_driver/pref_names.h" | 20 #include "components/sync_driver/pref_names.h" |
20 #include "components/variations/variations_associated_data.h" | 21 #include "components/variations/variations_associated_data.h" |
21 #include "extensions/common/features/feature.h" | 22 #include "extensions/common/features/feature.h" |
22 #include "extensions/common/features/feature_provider.h" | 23 #include "extensions/common/features/feature_provider.h" |
23 | 24 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 new base::StringValue(switches::kManualEnhancedBookmarks)); | 184 new base::StringValue(switches::kManualEnhancedBookmarks)); |
184 } else if (bookmarks_experiment_state == | 185 } else if (bookmarks_experiment_state == |
185 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT) { | 186 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT) { |
186 experiments_list->Remove( | 187 experiments_list->Remove( |
187 base::StringValue(switches::kManualEnhancedBookmarks), &index); | 188 base::StringValue(switches::kManualEnhancedBookmarks), &index); |
188 experiments_list->AppendIfNotPresent( | 189 experiments_list->AppendIfNotPresent( |
189 new base::StringValue(switches::kManualEnhancedBookmarksOptout)); | 190 new base::StringValue(switches::kManualEnhancedBookmarksOptout)); |
190 } | 191 } |
191 } | 192 } |
192 | 193 |
193 bool IsEnhancedBookmarksExperimentEnabled() { | 194 bool IsEnhancedBookmarksExperimentEnabled( |
195 about_flags::FlagsStorage* flags_storage) { | |
196 #if defined(OS_CHROMEOS) | |
sky
2014/09/24 17:22:09
Again, add a comment.
yefimt
2014/09/24 18:46:12
Done.
| |
197 const std::set<std::string> flags = flags_storage->GetFlags(); | |
198 if (flags.find(switches::kManualEnhancedBookmarks) != flags.end()) | |
199 return true; | |
200 if (flags.find(switches::kManualEnhancedBookmarksOptout) != flags.end()) | |
201 return true; | |
202 #else | |
194 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 203 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
195 if (command_line->HasSwitch(switches::kManualEnhancedBookmarks) || | 204 if (command_line->HasSwitch(switches::kManualEnhancedBookmarks) || |
196 command_line->HasSwitch(switches::kManualEnhancedBookmarksOptout)) { | 205 command_line->HasSwitch(switches::kManualEnhancedBookmarksOptout)) { |
197 return true; | 206 return true; |
198 } | 207 } |
208 #endif | |
199 | 209 |
200 return IsEnhancedBookmarksExperimentEnabledFromFinch(); | 210 return IsEnhancedBookmarksExperimentEnabledFromFinch(); |
201 } | 211 } |
202 | 212 |
203 #if defined(OS_ANDROID) | 213 #if defined(OS_ANDROID) |
204 bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService* user_prefs) { | 214 bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService* user_prefs) { |
205 if (IsEnhancedBookmarksEnabled(user_prefs)) | 215 if (IsEnhancedBookmarksEnabled(user_prefs)) |
206 return true; | 216 return true; |
207 | 217 |
208 // Salient images are collected from visited bookmarked pages even if the | 218 // Salient images are collected from visited bookmarked pages even if the |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 if (CommandLine::ForCurrentProcess()-> | 250 if (CommandLine::ForCurrentProcess()-> |
241 HasSwitch(switches::kEnableSyncArticles)) { | 251 HasSwitch(switches::kEnableSyncArticles)) { |
242 return true; | 252 return true; |
243 } | 253 } |
244 if (variations::GetVariationParamValue( | 254 if (variations::GetVariationParamValue( |
245 kFieldTrialName, "enable-sync-articles") == "1") | 255 kFieldTrialName, "enable-sync-articles") == "1") |
246 return true; | 256 return true; |
247 | 257 |
248 return false; | 258 return false; |
249 } | 259 } |
OLD | NEW |