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

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

Issue 156693003: Disable SettingsEnforcement when the machine is connected to a domain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better approach 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #if defined(ENABLE_CONFIGURATION_POLICY) 48 #if defined(ENABLE_CONFIGURATION_POLICY)
49 #include "components/policy/core/browser/browser_policy_connector.h" 49 #include "components/policy/core/browser/browser_policy_connector.h"
50 #include "components/policy/core/browser/configuration_policy_pref_store.h" 50 #include "components/policy/core/browser/configuration_policy_pref_store.h"
51 #include "components/policy/core/common/policy_types.h" 51 #include "components/policy/core/common/policy_types.h"
52 #endif 52 #endif
53 53
54 #if defined(ENABLE_MANAGED_USERS) 54 #if defined(ENABLE_MANAGED_USERS)
55 #include "chrome/browser/managed_mode/supervised_user_pref_store.h" 55 #include "chrome/browser/managed_mode/supervised_user_pref_store.h"
56 #endif 56 #endif
57 57
58 #if defined(OS_WIN) && defined(ENABLE_RLZ) 58 #if defined(OS_WIN)
59 #include "base/win/win_util.h"
60 #if defined(ENABLE_RLZ)
59 #include "rlz/lib/machine_id.h" 61 #include "rlz/lib/machine_id.h"
60 #endif 62 #endif // defined(ENABLE_RLZ)
63 #endif // defined(OS_WIN)
61 64
62 using content::BrowserContext; 65 using content::BrowserContext;
63 using content::BrowserThread; 66 using content::BrowserThread;
64 67
65 namespace { 68 namespace {
66 69
67 // These preferences must be kept in sync with the TrackedPreference enum in 70 // These preferences must be kept in sync with the TrackedPreference enum in
68 // tools/metrics/histograms/histograms.xml. To add a new preference, append it 71 // tools/metrics/histograms/histograms.xml. To add a new preference, append it
69 // to the array and add a corresponding value to the histogram enum. Each 72 // to the array and add a corresponding value to the histogram enum. Each
70 // tracked preference must be given a unique reporting ID. 73 // tracked preference must be given a unique reporting ID.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 enum SettingsEnforcementGroup { 154 enum SettingsEnforcementGroup {
152 GROUP_NO_ENFORCEMENT, 155 GROUP_NO_ENFORCEMENT,
153 // Only enforce settings on profile loads; still allow seeding of unloaded 156 // Only enforce settings on profile loads; still allow seeding of unloaded
154 // profiles. 157 // profiles.
155 GROUP_ENFORCE_ON_LOAD, 158 GROUP_ENFORCE_ON_LOAD,
156 // TOOD(gab): Block unloaded profile seeding in this mode. 159 // TOOD(gab): Block unloaded profile seeding in this mode.
157 GROUP_ENFORCE_ALWAYS 160 GROUP_ENFORCE_ALWAYS
158 }; 161 };
159 162
160 SettingsEnforcementGroup GetSettingsEnforcementGroup() { 163 SettingsEnforcementGroup GetSettingsEnforcementGroup() {
164 # if defined(OS_WIN)
165 static bool first_call = true;
166 static const bool is_enrolled_to_domain = base::win::IsEnrolledToDomain();
167 if (first_call) {
168 UMA_HISTOGRAM_BOOLEAN("Settings.TrackedPreferencesNoEnforcementOnDomain",
169 is_enrolled_to_domain);
170 first_call = false;
171 }
172 if (is_enrolled_to_domain)
173 return GROUP_NO_ENFORCEMENT;
174 #endif
175
161 struct { 176 struct {
162 const char* group_name; 177 const char* group_name;
163 SettingsEnforcementGroup group; 178 SettingsEnforcementGroup group;
164 } static const kEnforcementLevelMap[] = { 179 } static const kEnforcementLevelMap[] = {
165 { chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, 180 { chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement,
166 GROUP_NO_ENFORCEMENT }, 181 GROUP_NO_ENFORCEMENT },
167 { chrome_prefs::internals::kSettingsEnforcementGroupEnforceOnload, 182 { chrome_prefs::internals::kSettingsEnforcementGroupEnforceOnload,
168 GROUP_ENFORCE_ON_LOAD }, 183 GROUP_ENFORCE_ON_LOAD },
169 { chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, 184 { chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways,
170 GROUP_ENFORCE_ALWAYS }, 185 GROUP_ENFORCE_ALWAYS },
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 UMA_HISTOGRAM_BOOLEAN("Settings.InitializedFromMasterPrefs", success); 523 UMA_HISTOGRAM_BOOLEAN("Settings.InitializedFromMasterPrefs", success);
509 return success; 524 return success;
510 } 525 }
511 526
512 void RegisterPrefs(PrefRegistrySimple* registry) { 527 void RegisterPrefs(PrefRegistrySimple* registry) {
513 registry->RegisterInt64Pref(prefs::kProfilePreferenceResetTime, 0L); 528 registry->RegisterInt64Pref(prefs::kProfilePreferenceResetTime, 0L);
514 PrefHashStoreImpl::RegisterPrefs(registry); 529 PrefHashStoreImpl::RegisterPrefs(registry);
515 } 530 }
516 531
517 } // namespace chrome_prefs 532 } // 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