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

Side by Side Diff: chrome/browser/prefs/chrome_pref_service_factory.cc

Issue 165733003: Switch SettingsEnforcement default back to GROUP_NO_ENFORCEMENT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/prefs/chrome_pref_service_factory.h" 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 SettingsEnforcementGroup group; 183 SettingsEnforcementGroup group;
184 } static const kEnforcementLevelMap[] = { 184 } static const kEnforcementLevelMap[] = {
185 { chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, 185 { chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement,
186 GROUP_NO_ENFORCEMENT }, 186 GROUP_NO_ENFORCEMENT },
187 { chrome_prefs::internals::kSettingsEnforcementGroupEnforceOnload, 187 { chrome_prefs::internals::kSettingsEnforcementGroupEnforceOnload,
188 GROUP_ENFORCE_ON_LOAD }, 188 GROUP_ENFORCE_ON_LOAD },
189 { chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, 189 { chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways,
190 GROUP_ENFORCE_ALWAYS }, 190 GROUP_ENFORCE_ALWAYS },
191 }; 191 };
192 192
193 // TODO(gab): Switch the default to GROUP_ENFORCE_ALWAYS.
194 SettingsEnforcementGroup enforcement_group = GROUP_NO_ENFORCEMENT;
195 bool group_determined_from_trial = false;
193 base::FieldTrial* trial = 196 base::FieldTrial* trial =
194 base::FieldTrialList::Find( 197 base::FieldTrialList::Find(
195 chrome_prefs::internals::kSettingsEnforcementTrialName); 198 chrome_prefs::internals::kSettingsEnforcementTrialName);
196 if (trial) { 199 if (trial) {
197 const std::string& group_name = trial->group_name(); 200 const std::string& group_name = trial->group_name();
198 // ARRAYSIZE_UNSAFE must be used since the array is declared locally; it is 201 // ARRAYSIZE_UNSAFE must be used since the array is declared locally; it is
199 // only unsafe because it could not trigger a compile error on some 202 // only unsafe because it could not trigger a compile error on some
200 // non-array pointer types; this is fine since kEnforcementLevelMap is 203 // non-array pointer types; this is fine since kEnforcementLevelMap is
201 // clearly an array. 204 // clearly an array.
202 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kEnforcementLevelMap); ++i) { 205 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kEnforcementLevelMap); ++i) {
203 if (kEnforcementLevelMap[i].group_name == group_name) 206 if (kEnforcementLevelMap[i].group_name == group_name) {
204 return kEnforcementLevelMap[i].group; 207 enforcement_group = kEnforcementLevelMap[i].group;
208 group_determined_from_trial = true;
209 break;
210 }
205 } 211 }
206 } 212 }
207 #if defined(OS_WIN) 213 UMA_HISTOGRAM_BOOLEAN("Settings.EnforcementGroupDeterminedFromTrial",
208 // Default to GROUP_ENFORCE_ALWAYS in the absence of a valid value for the 214 group_determined_from_trial);
209 // SettingsEnforcement field trial. 215 return enforcement_group;
210 // TODO(gab): Switch other platforms over to this mode.
211 return GROUP_ENFORCE_ALWAYS;
212 #else
213 return GROUP_NO_ENFORCEMENT;
214 #endif
215 } 216 }
216 217
217 // Shows notifications which correspond to PersistentPrefStore's reading errors. 218 // Shows notifications which correspond to PersistentPrefStore's reading errors.
218 void HandleReadError(PersistentPrefStore::PrefReadError error) { 219 void HandleReadError(PersistentPrefStore::PrefReadError error) {
219 // Sample the histogram also for the successful case in order to get a 220 // Sample the histogram also for the successful case in order to get a
220 // baseline on the success rate in addition to the error distribution. 221 // baseline on the success rate in addition to the error distribution.
221 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 222 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error,
222 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); 223 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM);
223 224
224 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { 225 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) {
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 UMA_HISTOGRAM_BOOLEAN("Settings.InitializedFromMasterPrefs", success); 579 UMA_HISTOGRAM_BOOLEAN("Settings.InitializedFromMasterPrefs", success);
579 return success; 580 return success;
580 } 581 }
581 582
582 void RegisterPrefs(PrefRegistrySimple* registry) { 583 void RegisterPrefs(PrefRegistrySimple* registry) {
583 registry->RegisterInt64Pref(prefs::kProfilePreferenceResetTime, 0L); 584 registry->RegisterInt64Pref(prefs::kProfilePreferenceResetTime, 0L);
584 PrefHashStoreImpl::RegisterPrefs(registry); 585 PrefHashStoreImpl::RegisterPrefs(registry);
585 } 586 }
586 587
587 } // namespace chrome_prefs 588 } // namespace chrome_prefs
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698