summaryrefslogtreecommitdiffstats
path: root/chrome/browser/prefs/chrome_pref_service_factory.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/prefs/chrome_pref_service_factory.cc')
-rw-r--r--chrome/browser/prefs/chrome_pref_service_factory.cc34
1 files changed, 32 insertions, 2 deletions
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
index 26effe1..0deb832 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.cc
+++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -65,15 +65,25 @@
#include "chrome/browser/supervised_user/supervised_user_pref_store.h"
#endif
-#if defined(OS_WIN) && defined(ENABLE_RLZ)
+#if defined(OS_WIN)
+#include "base/win/win_util.h"
+#if defined(ENABLE_RLZ)
#include "rlz/lib/machine_id.h"
-#endif // defined(ENABLE_RLZ) && defined(OS_WIN)
+#endif // defined(ENABLE_RLZ)
+#endif // defined(OS_WIN)
using content::BrowserContext;
using content::BrowserThread;
namespace {
+#if defined(OS_WIN)
+// Whether we are in testing mode; can be enabled via
+// DisableDomainCheckForTesting(). Forces startup checks to ignore the presence
+// of a domain when determining the active SettingsEnforcement group.
+bool g_disable_domain_check_for_testing = false;
+#endif // OS_WIN
+
// These preferences must be kept in sync with the TrackedPreference enum in
// tools/metrics/histograms/histograms.xml. To add a new preference, append it
// to the array and add a corresponding value to the histogram enum. Each
@@ -248,6 +258,20 @@ enum SettingsEnforcementGroup {
};
SettingsEnforcementGroup GetSettingsEnforcementGroup() {
+# if defined(OS_WIN)
+ if (!g_disable_domain_check_for_testing) {
+ static bool first_call = true;
+ static const bool is_enrolled_to_domain = base::win::IsEnrolledToDomain();
+ if (first_call) {
+ UMA_HISTOGRAM_BOOLEAN("Settings.TrackedPreferencesNoEnforcementOnDomain",
+ is_enrolled_to_domain);
+ first_call = false;
+ }
+ if (is_enrolled_to_domain)
+ return GROUP_NO_ENFORCEMENT;
+ }
+#endif
+
struct {
const char* group_name;
SettingsEnforcementGroup group;
@@ -521,6 +545,12 @@ void SchedulePrefsFilePathVerification(const base::FilePath& profile_path) {
#endif
}
+void DisableDomainCheckForTesting() {
+#if defined(OS_WIN)
+ g_disable_domain_check_for_testing = true;
+#endif // OS_WIN
+}
+
bool InitializePrefsFromMasterPrefs(
const base::FilePath& profile_path,
const base::DictionaryValue& master_prefs) {