Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(814)

Side by Side Diff: chrome/browser/bookmarks/enhanced_bookmarks_features.cc

Issue 1017913002: Force Enhanced Bookmark to be enabled if command line flags are set true (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/bookmarks/OWNERS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 30
31 const char kFieldTrialName[] = "EnhancedBookmarks"; 31 const char kFieldTrialName[] = "EnhancedBookmarks";
32 32
33 } // namespace 33 } // namespace
34 34
35 bool GetBookmarksExperimentExtensionID(std::string* extension_id) { 35 bool GetBookmarksExperimentExtensionID(std::string* extension_id) {
36 *extension_id = variations::GetVariationParamValue(kFieldTrialName, "id"); 36 *extension_id = variations::GetVariationParamValue(kFieldTrialName, "id");
37 if (extension_id->empty()) 37 if (extension_id->empty())
38 return false; 38 return false;
39 39
40 // kEnhancedBookmarksExperiment flag could have values "", "1" and "0".
41 // "0" - user opted out.
42 bool opt_out = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
43 switches::kEnhancedBookmarksExperiment) == "0";
44
45 if (opt_out)
46 return false;
47
danduong 2015/03/18 17:51:41 This might still be needed for non-Android
Mike Wittman 2015/03/18 18:10:19 Yes, it is. if you're moving this to IsEnhancedBoo
Ian Wen 2015/03/18 18:45:55 Reverted this part. This check should be kept here
48 #if defined(OS_ANDROID) 40 #if defined(OS_ANDROID)
danduong 2015/03/18 17:51:41 Shouldn't this be IOS too?
noyau (Ping after 24h) 2015/03/18 23:21:58 Probably, but we do not compile this file for iOS
danduong 2015/03/18 23:28:56 Thanks for the clarification. I didn't realize th
noyau (Ping after 24h) 2015/03/19 12:22:26 That's why I have a watch on this file, because wh
49 return base::android::BuildInfo::GetInstance()->sdk_int() > 41 return true;
50 base::android::SdkVersion::SDK_VERSION_ICE_CREAM_SANDWICH_MR1;
51 #else 42 #else
52 const extensions::FeatureProvider* feature_provider = 43 const extensions::FeatureProvider* feature_provider =
53 extensions::FeatureProvider::GetPermissionFeatures(); 44 extensions::FeatureProvider::GetPermissionFeatures();
54 extensions::Feature* feature = feature_provider->GetFeature("metricsPrivate"); 45 extensions::Feature* feature = feature_provider->GetFeature("metricsPrivate");
55 return feature && feature->IsIdInWhitelist(*extension_id); 46 return feature && feature->IsIdInWhitelist(*extension_id);
56 #endif 47 #endif
57 } 48 }
58 49
59 #if defined(OS_ANDROID) 50 #if defined(OS_ANDROID)
60 bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService* user_prefs) { 51 bool IsEnhancedBookmarkImageFetchingEnabled(const PrefService* user_prefs) {
61 if (IsEnhancedBookmarksEnabled()) 52 if (IsEnhancedBookmarksEnabled())
62 return true; 53 return true;
63 54
64 // Salient images are collected from visited bookmarked pages even if the 55 // Salient images are collected from visited bookmarked pages even if the
65 // enhanced bookmark feature is turned off. This is to have some images 56 // enhanced bookmark feature is turned off. This is to have some images
66 // available so that in the future, when the feature is turned on, the user 57 // available so that in the future, when the feature is turned on, the user
67 // experience is not a big list of flat colors. However as a precautionary 58 // experience is not a big list of flat colors. However as a precautionary
68 // measure it is possible to disable this collection of images from finch. 59 // measure it is possible to disable this collection of images from finch.
69 std::string disable_fetching = variations::GetVariationParamValue( 60 std::string disable_fetching = variations::GetVariationParamValue(
70 kFieldTrialName, "DisableImagesFetching"); 61 kFieldTrialName, "DisableImagesFetching");
71 return disable_fetching.empty(); 62 return disable_fetching.empty();
72 } 63 }
73 64
74 bool IsEnhancedBookmarksEnabled() { 65 bool IsEnhancedBookmarksEnabled() {
75 std::string extension_id; 66 std::string extension_id;
67
68 // kEnhancedBookmarksExperiment flag could have values "", "1" and "0".
69 // "0" - user opted out.
70 bool opt_out = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
71 switches::kEnhancedBookmarksExperiment) == "0";
72
73 #if defined(OS_ANDROID)
Ted C 2015/03/18 15:42:00 Unless I'm reading this wrong, this is an Android
Ian Wen 2015/03/18 18:45:55 Acknowledged.
74 bool opt_in = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
75 switches::kEnhancedBookmarksExperiment) == "1";
76 if (opt_in)
77 return true;
78
79 opt_out = base::android::BuildInfo::GetInstance()->sdk_int() <
Ted C 2015/03/18 15:42:00 this needs to be |-ed otherwise the opt_out above
Ian Wen 2015/03/18 18:45:55 Oops sorry, I did not test this CL last night befo
80 base::android::SdkVersion::SDK_VERSION_ICE_CREAM_SANDWICH_MR1;
noyau (Ping after 24h) 2015/03/18 13:32:14 Unless I misunderstand this will skew the finch ex
Ted C 2015/03/18 15:42:00 We just need to make sure this ICS logic is always
81 #endif
82
83 if (opt_out)
84 return false;
85
76 return GetBookmarksExperimentExtensionID(&extension_id); 86 return GetBookmarksExperimentExtensionID(&extension_id);
77 } 87 }
78 #endif 88 #endif
79 89
80 bool IsEnableDomDistillerSet() { 90 bool IsEnableDomDistillerSet() {
81 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 91 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
82 switches::kEnableDomDistiller)) { 92 switches::kEnableDomDistiller)) {
83 return true; 93 return true;
84 } 94 }
85 if (variations::GetVariationParamValue( 95 if (variations::GetVariationParamValue(
86 kFieldTrialName, "enable-dom-distiller") == "1") 96 kFieldTrialName, "enable-dom-distiller") == "1")
87 return true; 97 return true;
88 98
89 return false; 99 return false;
90 } 100 }
91 101
92 bool IsEnableSyncArticlesSet() { 102 bool IsEnableSyncArticlesSet() {
93 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 103 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
94 switches::kEnableSyncArticles)) { 104 switches::kEnableSyncArticles)) {
95 return true; 105 return true;
96 } 106 }
97 if (variations::GetVariationParamValue( 107 if (variations::GetVariationParamValue(
98 kFieldTrialName, "enable-sync-articles") == "1") 108 kFieldTrialName, "enable-sync-articles") == "1")
99 return true; 109 return true;
100 110
101 return false; 111 return false;
102 } 112 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/OWNERS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698