Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / prefs / chrome_pref_service_factory.cc
index af5b4b0..4f66ad2 100644 (file)
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/prefs/browser_ui_prefs_migrator.h"
 #include "chrome/browser/prefs/command_line_pref_store.h"
-#include "chrome/browser/prefs/pref_hash_filter.h"
 #include "chrome/browser/prefs/pref_model_associator.h"
 #include "chrome/browser/prefs/pref_service_syncable.h"
 #include "chrome/browser/prefs/pref_service_syncable_factory.h"
 #include "chrome/browser/prefs/profile_pref_store_manager.h"
+#include "chrome/browser/prefs/tracked/pref_hash_filter.h"
 #include "chrome/browser/profiles/file_path_verifier_win.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/search_engines/default_search_pref_migration.h"
 #include "chrome/browser/supervised_user/supervised_user_pref_store.h"
 #endif
 
-#if defined(OS_WIN)
-#include "base/win/win_util.h"
-#if defined(ENABLE_RLZ)
+#if defined(OS_WIN) && defined(ENABLE_RLZ)
 #include "rlz/lib/machine_id.h"
-#endif  // defined(ENABLE_RLZ)
-#endif  // defined(OS_WIN)
+#endif  // defined(ENABLE_RLZ) && defined(OS_WIN)
 
 using content::BrowserContext;
 using content::BrowserThread;
 
 namespace {
 
-// Whether we are in testing mode; can be enabled via
-// DisableDelaysAndDomainCheckForTesting(). Forces startup checks to occur
-// with no delay and ignores the presence of a domain when determining the
-// active SettingsEnforcement group.
-bool g_disable_delays_and_domain_check_for_testing = false;
-
 // 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
@@ -228,20 +219,6 @@ enum SettingsEnforcementGroup {
 };
 
 SettingsEnforcementGroup GetSettingsEnforcementGroup() {
-# if defined(OS_WIN)
-  if (!g_disable_delays_and_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;
@@ -275,11 +252,7 @@ SettingsEnforcementGroup GetSettingsEnforcementGroup() {
           chrome_prefs::internals::kSettingsEnforcementTrialName);
   if (trial) {
     const std::string& group_name = trial->group_name();
-    // ARRAYSIZE_UNSAFE must be used since the array is declared locally; it is
-    // only unsafe because it could not trigger a compile error on some
-    // non-array pointer types; this is fine since kEnforcementLevelMap is
-    // clearly an array.
-    for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kEnforcementLevelMap); ++i) {
+    for (size_t i = 0; i < arraysize(kEnforcementLevelMap); ++i) {
       if (kEnforcementLevelMap[i].group_name == group_name) {
         enforcement_group = kEnforcementLevelMap[i].group;
         group_determined_from_trial = true;
@@ -519,16 +492,10 @@ void SchedulePrefsFilePathVerification(const base::FilePath& profile_path) {
       base::Bind(&VerifyPreferencesFile,
                  ProfilePrefStoreManager::GetPrefFilePathFromProfilePath(
                      profile_path)),
-      base::TimeDelta::FromSeconds(g_disable_delays_and_domain_check_for_testing
-                                       ? 0
-                                       : kVerifyPrefsFileDelaySeconds));
+      base::TimeDelta::FromSeconds(kVerifyPrefsFileDelaySeconds));
 #endif
 }
 
-void DisableDelaysAndDomainCheckForTesting() {
-  g_disable_delays_and_domain_check_for_testing = true;
-}
-
 bool InitializePrefsFromMasterPrefs(
     const base::FilePath& profile_path,
     const base::DictionaryValue& master_prefs) {