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 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 const char kFieldTrialName[] = "EnhancedBookmarks"; | 22 const char kFieldTrialName[] = "EnhancedBookmarks"; |
23 | 23 |
24 // Get extension id from Finch EnhancedBookmarks group parameters. | 24 // Get extension id from Finch EnhancedBookmarks group parameters. |
25 std::string GetEnhancedBookmarksExtensionIdFromFinch() { | 25 std::string GetEnhancedBookmarksExtensionIdFromFinch() { |
26 return variations::GetVariationParamValue(kFieldTrialName, "id"); | 26 return variations::GetVariationParamValue(kFieldTrialName, "id"); |
27 } | 27 } |
28 | 28 |
29 // Returns true if enhanced bookmarks experiment is enabled from Finch. | 29 // Returns true if enhanced bookmarks experiment is enabled from Finch. |
30 bool IsEnhancedBookmarksExperimentEnabledFromFinch() { | 30 bool IsEnhancedBookmarksExperimentEnabledFromFinch() { |
31 std::string ext_id = GetEnhancedBookmarksExtensionIdFromFinch(); | |
sky
2014/08/12 23:17:21
nit: const
Kibeom Kim (inactive)
2014/08/12 23:33:38
Done.
| |
31 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
32 return false; | 33 return !ext_id.empty(); |
33 #endif | 34 #else |
34 std::string ext_id = GetEnhancedBookmarksExtensionIdFromFinch(); | |
35 const extensions::FeatureProvider* feature_provider = | 35 const extensions::FeatureProvider* feature_provider = |
36 extensions::FeatureProvider::GetPermissionFeatures(); | 36 extensions::FeatureProvider::GetPermissionFeatures(); |
37 extensions::Feature* feature = feature_provider->GetFeature("metricsPrivate"); | 37 extensions::Feature* feature = feature_provider->GetFeature("metricsPrivate"); |
38 return feature && feature->IsIdInWhitelist(ext_id); | 38 return feature && feature->IsIdInWhitelist(ext_id); |
39 #endif | |
39 } | 40 } |
40 | 41 |
41 }; // namespace | 42 }; // namespace |
42 | 43 |
43 bool GetBookmarksExperimentExtensionID(const PrefService* user_prefs, | 44 bool GetBookmarksExperimentExtensionID(const PrefService* user_prefs, |
44 std::string* extension_id) { | 45 std::string* extension_id) { |
45 BookmarksExperimentState bookmarks_experiment_state = | 46 BookmarksExperimentState bookmarks_experiment_state = |
46 static_cast<BookmarksExperimentState>(user_prefs->GetInteger( | 47 static_cast<BookmarksExperimentState>(user_prefs->GetInteger( |
47 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled)); | 48 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled)); |
48 if (bookmarks_experiment_state == BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH) { | 49 if (bookmarks_experiment_state == BOOKMARKS_EXPERIMENT_ENABLED_FROM_FINCH) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 if (CommandLine::ForCurrentProcess()-> | 210 if (CommandLine::ForCurrentProcess()-> |
210 HasSwitch(switches::kEnableSyncArticles)) { | 211 HasSwitch(switches::kEnableSyncArticles)) { |
211 return true; | 212 return true; |
212 } | 213 } |
213 if (variations::GetVariationParamValue( | 214 if (variations::GetVariationParamValue( |
214 kFieldTrialName, "enable-sync-articles") == "1") | 215 kFieldTrialName, "enable-sync-articles") == "1") |
215 return true; | 216 return true; |
216 | 217 |
217 return false; | 218 return false; |
218 } | 219 } |
OLD | NEW |