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

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

Issue 1008053002: Disable Enhanced Bookmark for ICS devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Put build_info.h into android specific block to let it compile on mac 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 | « no previous file | 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"
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/flags_storage.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/signin/signin_manager_factory.h" 16 #include "chrome/browser/signin/signin_manager_factory.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "components/signin/core/browser/signin_manager.h" 19 #include "components/signin/core/browser/signin_manager.h"
20 #include "components/sync_driver/pref_names.h" 20 #include "components/sync_driver/pref_names.h"
21 #include "components/variations/variations_associated_data.h" 21 #include "components/variations/variations_associated_data.h"
22 #include "extensions/common/features/feature.h" 22 #include "extensions/common/features/feature.h"
23 #include "extensions/common/features/feature_provider.h" 23 #include "extensions/common/features/feature_provider.h"
24 24
25 #if defined(OS_ANDROID)
26 #include "base/android/build_info.h"
27 #endif
28
25 namespace { 29 namespace {
26 30
27 const char kFieldTrialName[] = "EnhancedBookmarks"; 31 const char kFieldTrialName[] = "EnhancedBookmarks";
28 32
29 // Get extension id from Finch EnhancedBookmarks group parameters. 33 // Get extension id from Finch EnhancedBookmarks group parameters.
30 std::string GetEnhancedBookmarksExtensionIdFromFinch() { 34 std::string GetEnhancedBookmarksExtensionIdFromFinch() {
31 return variations::GetVariationParamValue(kFieldTrialName, "id"); 35 return variations::GetVariationParamValue(kFieldTrialName, "id");
32 } 36 }
33 37
34 // Returns true if enhanced bookmarks experiment is enabled from Finch. 38 // Returns true if enhanced bookmarks experiment is enabled from Finch.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (opt_out) { 132 if (opt_out) {
129 bookmarks_experiment_new_state = 133 bookmarks_experiment_new_state =
130 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT; 134 BOOKMARKS_EXPERIMENT_ENABLED_USER_OPT_OUT;
131 } else { 135 } else {
132 // User opted in again. 136 // User opted in again.
133 bookmarks_experiment_new_state = BOOKMARKS_EXPERIMENT_ENABLED; 137 bookmarks_experiment_new_state = BOOKMARKS_EXPERIMENT_ENABLED;
134 } 138 }
135 } 139 }
136 140
137 #if defined(OS_ANDROID) 141 #if defined(OS_ANDROID)
142 if (base::android::BuildInfo::GetInstance()->sdk_int() <=
143 base::android::SdkVersion::SDK_VERSION_ICE_CREAM_SANDWICH_MR1) {
144 opt_out = true;
145 bookmarks_experiment_new_state = BOOKMARKS_EXPERIMENT_NONE;
146 }
138 bool opt_in = !opt_out && 147 bool opt_in = !opt_out &&
139 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 148 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
140 switches::kEnhancedBookmarksExperiment) == "1"; 149 switches::kEnhancedBookmarksExperiment) == "1";
141 if (opt_in && bookmarks_experiment_new_state == BOOKMARKS_EXPERIMENT_NONE) 150 if (opt_in && bookmarks_experiment_new_state == BOOKMARKS_EXPERIMENT_NONE)
142 bookmarks_experiment_new_state = BOOKMARKS_EXPERIMENT_ENABLED; 151 bookmarks_experiment_new_state = BOOKMARKS_EXPERIMENT_ENABLED;
143 #endif 152 #endif
144 153
145 UMA_HISTOGRAM_ENUMERATION("EnhancedBookmarks.SyncExperimentState", 154 UMA_HISTOGRAM_ENUMERATION("EnhancedBookmarks.SyncExperimentState",
146 bookmarks_experiment_new_state, 155 bookmarks_experiment_new_state,
147 BOOKMARKS_EXPERIMENT_ENUM_SIZE); 156 BOOKMARKS_EXPERIMENT_ENUM_SIZE);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 261 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
253 switches::kEnableSyncArticles)) { 262 switches::kEnableSyncArticles)) {
254 return true; 263 return true;
255 } 264 }
256 if (variations::GetVariationParamValue( 265 if (variations::GetVariationParamValue(
257 kFieldTrialName, "enable-sync-articles") == "1") 266 kFieldTrialName, "enable-sync-articles") == "1")
258 return true; 267 return true;
259 268
260 return false; 269 return false;
261 } 270 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698