| 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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "components/variations/variations_associated_data.h" | 10 #include "components/variations/variations_associated_data.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #else | 29 #else |
| 30 const extensions::FeatureProvider* feature_provider = | 30 const extensions::FeatureProvider* feature_provider = |
| 31 extensions::FeatureProvider::GetPermissionFeatures(); | 31 extensions::FeatureProvider::GetPermissionFeatures(); |
| 32 extensions::Feature* feature = feature_provider->GetFeature("metricsPrivate"); | 32 extensions::Feature* feature = feature_provider->GetFeature("metricsPrivate"); |
| 33 return feature && feature->IsIdInWhitelist(*extension_id); | 33 return feature && feature->IsIdInWhitelist(*extension_id); |
| 34 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 34 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 #if defined(OS_ANDROID) | |
| 40 bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService* user_prefs) { | |
| 41 if (IsEnhancedBookmarksEnabled()) | |
| 42 return true; | |
| 43 | |
| 44 // Salient images are collected from visited bookmarked pages even if the | |
| 45 // enhanced bookmark feature is turned off. This is to have some images | |
| 46 // available so that in the future, when the feature is turned on, the user | |
| 47 // experience is not a big list of flat colors. However as a precautionary | |
| 48 // measure it is possible to disable this collection of images from finch. | |
| 49 std::string disable_fetching = variations::GetVariationParamValue( | |
| 50 kFieldTrialName, "DisableImagesFetching"); | |
| 51 return disable_fetching.empty(); | |
| 52 } | |
| 53 #endif // defined(OS_ANDROID) | |
| 54 | |
| 55 bool IsEnhancedBookmarksEnabled() { | 39 bool IsEnhancedBookmarksEnabled() { |
| 56 std::string extension_id; | 40 std::string extension_id; |
| 57 return IsEnhancedBookmarksEnabled(&extension_id); | 41 return IsEnhancedBookmarksEnabled(&extension_id); |
| 58 } | 42 } |
| 59 | 43 |
| 60 bool IsEnhancedBookmarksEnabled(std::string* extension_id) { | 44 bool IsEnhancedBookmarksEnabled(std::string* extension_id) { |
| 61 // kEnhancedBookmarksExperiment flag could have values "", "1" and "0". | 45 // kEnhancedBookmarksExperiment flag could have values "", "1" and "0". |
| 62 // "0" - user opted out. "1" is only possible on mobile as desktop needs a | 46 // "0" - user opted out. "1" is only possible on mobile as desktop needs a |
| 63 // extension id that would not be available by just using the flag. | 47 // extension id that would not be available by just using the flag. |
| 64 | 48 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 95 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 79 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 96 switches::kEnableSyncArticles)) { | 80 switches::kEnableSyncArticles)) { |
| 97 return true; | 81 return true; |
| 98 } | 82 } |
| 99 if (variations::GetVariationParamValue(kFieldTrialName, | 83 if (variations::GetVariationParamValue(kFieldTrialName, |
| 100 "enable-sync-articles") == "1") | 84 "enable-sync-articles") == "1") |
| 101 return true; | 85 return true; |
| 102 | 86 |
| 103 return false; | 87 return false; |
| 104 } | 88 } |
| OLD | NEW |