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

Unified Diff: chrome/browser/prefs/chrome_pref_service_factory.cc

Issue 936483002: Bring back the domain gating check for settings protection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@908473002_ps2
Patch Set: update histogram description Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/chrome_pref_service_factory.cc
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
index 26effe13a777c276f98987bce61fd3dfb63a22a0..0deb8320b22eef5831cd7ddb237f7b0e10506daf 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) {
« no previous file with comments | « chrome/browser/prefs/chrome_pref_service_factory.h ('k') | chrome/browser/prefs/tracked/pref_hash_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698