Componentize HistoryURLProvider/ScoredHistoryMatch.
[chromium-blink-merge.git] / chrome / browser / prefs / chrome_pref_service_factory.cc
bloba22f002f1a218e12831ef2d91cb3760837b30281
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
3 // found in the LICENSE file.
5 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
7 #include <string>
8 #include <vector>
10 #include "base/bind.h"
11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h"
13 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram_macros.h"
15 #include "base/prefs/default_pref_store.h"
16 #include "base/prefs/json_pref_store.h"
17 #include "base/prefs/pref_filter.h"
18 #include "base/prefs/pref_notifier_impl.h"
19 #include "base/prefs/pref_registry.h"
20 #include "base/prefs/pref_registry_simple.h"
21 #include "base/prefs/pref_service.h"
22 #include "base/prefs/pref_store.h"
23 #include "base/prefs/pref_value_store.h"
24 #include "base/threading/sequenced_worker_pool.h"
25 #include "base/time/time.h"
26 #include "base/trace_event/trace_event.h"
27 #include "chrome/browser/browser_process.h"
28 #include "chrome/browser/prefs/command_line_pref_store.h"
29 #include "chrome/browser/prefs/pref_model_associator.h"
30 #include "chrome/browser/prefs/pref_service_syncable.h"
31 #include "chrome/browser/prefs/pref_service_syncable_factory.h"
32 #include "chrome/browser/prefs/profile_pref_store_manager.h"
33 #include "chrome/browser/prefs/tracked/pref_hash_filter.h"
34 #include "chrome/browser/profiles/file_path_verifier_win.h"
35 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/search_engines/default_search_pref_migration.h"
37 #include "chrome/browser/sync/glue/sync_start_util.h"
38 #include "chrome/browser/ui/profile_error_dialog.h"
39 #include "chrome/common/chrome_constants.h"
40 #include "chrome/common/pref_names.h"
41 #include "chrome/grit/chromium_strings.h"
42 #include "chrome/grit/generated_resources.h"
43 #include "components/component_updater/pref_names.h"
44 #include "components/pref_registry/pref_registry_syncable.h"
45 #include "components/search_engines/default_search_manager.h"
46 #include "components/search_engines/search_engines_pref_names.h"
47 #include "components/sync_driver/pref_names.h"
48 #include "content/public/browser/browser_context.h"
49 #include "content/public/browser/browser_thread.h"
50 #include "grit/browser_resources.h"
51 #include "sync/internal_api/public/base/model_type.h"
52 #include "ui/base/resource/resource_bundle.h"
54 #if defined(ENABLE_CONFIGURATION_POLICY)
55 #include "components/policy/core/browser/browser_policy_connector.h"
56 #include "components/policy/core/browser/configuration_policy_pref_store.h"
57 #include "components/policy/core/common/policy_types.h"
58 #endif
60 #if defined(ENABLE_EXTENSIONS)
61 #include "extensions/browser/pref_names.h"
62 #endif
64 #if defined(ENABLE_SUPERVISED_USERS)
65 #include "chrome/browser/supervised_user/supervised_user_pref_store.h"
66 #endif
68 #if defined(OS_WIN)
69 #include "base/win/win_util.h"
70 #if defined(ENABLE_RLZ)
71 #include "rlz/lib/machine_id.h"
72 #endif // defined(ENABLE_RLZ)
73 #endif // defined(OS_WIN)
75 using content::BrowserContext;
76 using content::BrowserThread;
78 namespace {
80 #if defined(OS_WIN)
81 // Whether we are in testing mode; can be enabled via
82 // DisableDomainCheckForTesting(). Forces startup checks to ignore the presence
83 // of a domain when determining the active SettingsEnforcement group.
84 bool g_disable_domain_check_for_testing = false;
85 #endif // OS_WIN
87 // These preferences must be kept in sync with the TrackedPreference enum in
88 // tools/metrics/histograms/histograms.xml. To add a new preference, append it
89 // to the array and add a corresponding value to the histogram enum. Each
90 // tracked preference must be given a unique reporting ID.
91 // See CleanupDeprecatedTrackedPreferences() in pref_hash_filter.cc to remove a
92 // deprecated tracked preference.
93 const PrefHashFilter::TrackedPreferenceMetadata kTrackedPrefs[] = {
95 0, prefs::kShowHomeButton,
96 PrefHashFilter::ENFORCE_ON_LOAD,
97 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
98 PrefHashFilter::VALUE_IMPERSONAL
101 1, prefs::kHomePageIsNewTabPage,
102 PrefHashFilter::ENFORCE_ON_LOAD,
103 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
104 PrefHashFilter::VALUE_IMPERSONAL
107 2, prefs::kHomePage,
108 PrefHashFilter::ENFORCE_ON_LOAD,
109 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
110 PrefHashFilter::VALUE_IMPERSONAL
113 3, prefs::kRestoreOnStartup,
114 PrefHashFilter::ENFORCE_ON_LOAD,
115 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
116 PrefHashFilter::VALUE_IMPERSONAL
119 4, prefs::kURLsToRestoreOnStartup,
120 PrefHashFilter::ENFORCE_ON_LOAD,
121 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
122 PrefHashFilter::VALUE_IMPERSONAL
124 #if defined(ENABLE_EXTENSIONS)
126 5, extensions::pref_names::kExtensions,
127 PrefHashFilter::NO_ENFORCEMENT,
128 PrefHashFilter::TRACKING_STRATEGY_SPLIT,
129 PrefHashFilter::VALUE_IMPERSONAL
131 #endif
133 6, prefs::kGoogleServicesLastUsername,
134 PrefHashFilter::ENFORCE_ON_LOAD,
135 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
136 PrefHashFilter::VALUE_PERSONAL
139 7, prefs::kSearchProviderOverrides,
140 PrefHashFilter::ENFORCE_ON_LOAD,
141 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
142 PrefHashFilter::VALUE_IMPERSONAL
145 8, prefs::kDefaultSearchProviderSearchURL,
146 PrefHashFilter::ENFORCE_ON_LOAD,
147 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
148 PrefHashFilter::VALUE_IMPERSONAL
151 9, prefs::kDefaultSearchProviderKeyword,
152 PrefHashFilter::ENFORCE_ON_LOAD,
153 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
154 PrefHashFilter::VALUE_IMPERSONAL
157 10, prefs::kDefaultSearchProviderName,
158 PrefHashFilter::ENFORCE_ON_LOAD,
159 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
160 PrefHashFilter::VALUE_IMPERSONAL
162 #if !defined(OS_ANDROID)
164 11, prefs::kPinnedTabs,
165 PrefHashFilter::ENFORCE_ON_LOAD,
166 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
167 PrefHashFilter::VALUE_IMPERSONAL
170 13, prefs::kProfileResetPromptMementoInProfilePrefs,
171 PrefHashFilter::ENFORCE_ON_LOAD,
172 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
173 PrefHashFilter::VALUE_IMPERSONAL
175 #endif
177 14, DefaultSearchManager::kDefaultSearchProviderDataPrefName,
178 PrefHashFilter::NO_ENFORCEMENT,
179 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
180 PrefHashFilter::VALUE_IMPERSONAL
183 // Protecting kPreferenceResetTime does two things:
184 // 1) It ensures this isn't accidently set by someone stomping the pref
185 // file.
186 // 2) More importantly, it declares kPreferenceResetTime as a protected
187 // pref which is required for it to be visible when queried via the
188 // SegregatedPrefStore. This is because it's written directly in the
189 // protected JsonPrefStore by that store's PrefHashFilter if there was
190 // a reset in FilterOnLoad and SegregatedPrefStore will not look for it
191 // in the protected JsonPrefStore unless it's declared as a protected
192 // preference here.
193 15, prefs::kPreferenceResetTime,
194 PrefHashFilter::ENFORCE_ON_LOAD,
195 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
196 PrefHashFilter::VALUE_IMPERSONAL
199 17, sync_driver::prefs::kSyncRemainingRollbackTries,
200 PrefHashFilter::ENFORCE_ON_LOAD,
201 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
202 PrefHashFilter::VALUE_IMPERSONAL
205 18, prefs::kSafeBrowsingIncidentsSent,
206 PrefHashFilter::ENFORCE_ON_LOAD,
207 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
208 PrefHashFilter::VALUE_IMPERSONAL
210 #if defined(OS_WIN)
212 19, prefs::kSwReporterPromptVersion,
213 PrefHashFilter::ENFORCE_ON_LOAD,
214 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
215 PrefHashFilter::VALUE_IMPERSONAL
218 20, prefs::kSwReporterPromptReason,
219 PrefHashFilter::ENFORCE_ON_LOAD,
220 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
221 PrefHashFilter::VALUE_IMPERSONAL
223 #endif
224 // This pref is deprecated and will be removed a few releases after M43.
225 // kGoogleServicesAccountId replaces it.
227 21, prefs::kGoogleServicesUsername,
228 PrefHashFilter::ENFORCE_ON_LOAD,
229 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
230 PrefHashFilter::VALUE_PERSONAL
232 #if defined(OS_WIN)
234 22, prefs::kSwReporterPromptSeed,
235 PrefHashFilter::ENFORCE_ON_LOAD,
236 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
237 PrefHashFilter::VALUE_IMPERSONAL
239 #endif
241 23, prefs::kGoogleServicesAccountId,
242 PrefHashFilter::ENFORCE_ON_LOAD,
243 PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
244 PrefHashFilter::VALUE_PERSONAL
246 // See note at top, new items added here also need to be added to
247 // histograms.xml's TrackedPreference enum.
250 // One more than the last tracked preferences ID above.
251 const size_t kTrackedPrefsReportingIDsCount =
252 kTrackedPrefs[arraysize(kTrackedPrefs) - 1].reporting_id + 1;
254 // Each group enforces a superset of the protection provided by the previous
255 // one.
256 enum SettingsEnforcementGroup {
257 GROUP_NO_ENFORCEMENT,
258 // Enforce protected settings on profile loads.
259 GROUP_ENFORCE_ALWAYS,
260 // Also enforce extension default search.
261 GROUP_ENFORCE_ALWAYS_WITH_DSE,
262 // Also enforce extension settings and default search.
263 GROUP_ENFORCE_ALWAYS_WITH_EXTENSIONS_AND_DSE,
264 // The default enforcement group contains all protection features.
265 GROUP_ENFORCE_DEFAULT
268 SettingsEnforcementGroup GetSettingsEnforcementGroup() {
269 # if defined(OS_WIN)
270 if (!g_disable_domain_check_for_testing) {
271 static bool first_call = true;
272 static const bool is_enrolled_to_domain = base::win::IsEnrolledToDomain();
273 if (first_call) {
274 UMA_HISTOGRAM_BOOLEAN("Settings.TrackedPreferencesNoEnforcementOnDomain",
275 is_enrolled_to_domain);
276 first_call = false;
278 if (is_enrolled_to_domain)
279 return GROUP_NO_ENFORCEMENT;
281 #endif
283 struct {
284 const char* group_name;
285 SettingsEnforcementGroup group;
286 } static const kEnforcementLevelMap[] = {
287 { chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement,
288 GROUP_NO_ENFORCEMENT },
289 { chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways,
290 GROUP_ENFORCE_ALWAYS },
291 { chrome_prefs::internals::
292 kSettingsEnforcementGroupEnforceAlwaysWithDSE,
293 GROUP_ENFORCE_ALWAYS_WITH_DSE },
294 { chrome_prefs::internals::
295 kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE,
296 GROUP_ENFORCE_ALWAYS_WITH_EXTENSIONS_AND_DSE },
299 // Use the strongest enforcement setting in the absence of a field trial
300 // config on Windows. Remember to update the OFFICIAL_BUILD section of
301 // extension_startup_browsertest.cc and pref_hash_browsertest.cc when updating
302 // the default value below.
303 // TODO(gab): Enforce this on all platforms.
304 SettingsEnforcementGroup enforcement_group =
305 #if defined(OS_WIN)
306 GROUP_ENFORCE_DEFAULT;
307 #else
308 GROUP_NO_ENFORCEMENT;
309 #endif
310 bool group_determined_from_trial = false;
311 base::FieldTrial* trial =
312 base::FieldTrialList::Find(
313 chrome_prefs::internals::kSettingsEnforcementTrialName);
314 if (trial) {
315 const std::string& group_name = trial->group_name();
316 for (size_t i = 0; i < arraysize(kEnforcementLevelMap); ++i) {
317 if (kEnforcementLevelMap[i].group_name == group_name) {
318 enforcement_group = kEnforcementLevelMap[i].group;
319 group_determined_from_trial = true;
320 break;
324 UMA_HISTOGRAM_BOOLEAN("Settings.EnforcementGroupDeterminedFromTrial",
325 group_determined_from_trial);
326 return enforcement_group;
329 // Returns the effective preference tracking configuration.
330 std::vector<PrefHashFilter::TrackedPreferenceMetadata>
331 GetTrackingConfiguration() {
332 const SettingsEnforcementGroup enforcement_group =
333 GetSettingsEnforcementGroup();
335 std::vector<PrefHashFilter::TrackedPreferenceMetadata> result;
336 for (size_t i = 0; i < arraysize(kTrackedPrefs); ++i) {
337 PrefHashFilter::TrackedPreferenceMetadata data = kTrackedPrefs[i];
339 if (GROUP_NO_ENFORCEMENT == enforcement_group) {
340 // Remove enforcement for all tracked preferences.
341 data.enforcement_level = PrefHashFilter::NO_ENFORCEMENT;
344 if (enforcement_group >= GROUP_ENFORCE_ALWAYS_WITH_DSE &&
345 data.name == DefaultSearchManager::kDefaultSearchProviderDataPrefName) {
346 // Specifically enable default search settings enforcement.
347 data.enforcement_level = PrefHashFilter::ENFORCE_ON_LOAD;
350 #if defined(ENABLE_EXTENSIONS)
351 if (enforcement_group >= GROUP_ENFORCE_ALWAYS_WITH_EXTENSIONS_AND_DSE &&
352 data.name == extensions::pref_names::kExtensions) {
353 // Specifically enable extension settings enforcement.
354 data.enforcement_level = PrefHashFilter::ENFORCE_ON_LOAD;
356 #endif
358 result.push_back(data);
360 return result;
363 // Shows notifications which correspond to PersistentPrefStore's reading errors.
364 void HandleReadError(PersistentPrefStore::PrefReadError error) {
365 // Sample the histogram also for the successful case in order to get a
366 // baseline on the success rate in addition to the error distribution.
367 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error,
368 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM);
370 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) {
371 #if !defined(OS_CHROMEOS)
372 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for
373 // an example problem that this can cause.
374 // Do some diagnosis and try to avoid losing data.
375 int message_id = 0;
376 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE ||
377 error == PersistentPrefStore::PREF_READ_ERROR_LEVELDB_CORRUPTION) {
378 message_id = IDS_PREFERENCES_CORRUPT_ERROR;
379 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) {
380 message_id = IDS_PREFERENCES_UNREADABLE_ERROR;
383 if (message_id) {
384 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
385 base::Bind(&ShowProfileErrorDialog,
386 PROFILE_ERROR_PREFERENCES,
387 message_id));
389 #else
390 // On ChromeOS error screen with message about broken local state
391 // will be displayed.
393 // A supplementary error message about broken local state - is included
394 // in logs and user feedbacks.
395 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE &&
396 error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) {
397 LOG(ERROR) << "An error happened during prefs loading: " << error;
399 #endif
403 scoped_ptr<ProfilePrefStoreManager> CreateProfilePrefStoreManager(
404 const base::FilePath& profile_path) {
405 std::string device_id;
406 #if defined(OS_WIN) && defined(ENABLE_RLZ)
407 // This is used by
408 // chrome/browser/extensions/api/music_manager_private/device_id_win.cc
409 // but that API is private (http://crbug.com/276485) and other platforms are
410 // not available synchronously.
411 // As part of improving pref metrics on other platforms we may want to find
412 // ways to defer preference loading until the device ID can be used.
413 rlz_lib::GetMachineId(&device_id);
414 #endif
415 std::string seed;
416 #if defined(GOOGLE_CHROME_BUILD)
417 seed = ResourceBundle::GetSharedInstance().GetRawDataResource(
418 IDR_PREF_HASH_SEED_BIN).as_string();
419 #endif
420 return make_scoped_ptr(new ProfilePrefStoreManager(
421 profile_path,
422 GetTrackingConfiguration(),
423 kTrackedPrefsReportingIDsCount,
424 seed,
425 device_id,
426 g_browser_process->local_state()));
429 void PrepareFactory(
430 PrefServiceSyncableFactory* factory,
431 policy::PolicyService* policy_service,
432 SupervisedUserSettingsService* supervised_user_settings,
433 scoped_refptr<PersistentPrefStore> user_pref_store,
434 const scoped_refptr<PrefStore>& extension_prefs,
435 bool async) {
436 #if defined(ENABLE_CONFIGURATION_POLICY)
437 using policy::ConfigurationPolicyPrefStore;
438 factory->set_managed_prefs(
439 make_scoped_refptr(new ConfigurationPolicyPrefStore(
440 policy_service,
441 g_browser_process->browser_policy_connector()->GetHandlerList(),
442 policy::POLICY_LEVEL_MANDATORY)));
443 factory->set_recommended_prefs(
444 make_scoped_refptr(new ConfigurationPolicyPrefStore(
445 policy_service,
446 g_browser_process->browser_policy_connector()->GetHandlerList(),
447 policy::POLICY_LEVEL_RECOMMENDED)));
448 #endif // ENABLE_CONFIGURATION_POLICY
450 #if defined(ENABLE_SUPERVISED_USERS)
451 if (supervised_user_settings) {
452 scoped_refptr<PrefStore> supervised_user_prefs = make_scoped_refptr(
453 new SupervisedUserPrefStore(supervised_user_settings));
454 // TODO(bauerb): Temporary CHECK while investigating
455 // https://crbug.com/425785. Remove when that bug is fixed.
456 CHECK(async || supervised_user_prefs->IsInitializationComplete());
457 factory->set_supervised_user_prefs(supervised_user_prefs);
459 #endif
461 factory->set_async(async);
462 factory->set_extension_prefs(extension_prefs);
463 factory->set_command_line_prefs(make_scoped_refptr(
464 new CommandLinePrefStore(base::CommandLine::ForCurrentProcess())));
465 factory->set_read_error_callback(base::Bind(&HandleReadError));
466 factory->set_user_prefs(user_pref_store);
469 } // namespace
471 namespace chrome_prefs {
473 namespace internals {
475 // Group modifications should be reflected in first_run_browsertest.cc and
476 // pref_hash_browsertest.cc.
477 const char kSettingsEnforcementTrialName[] = "SettingsEnforcement";
478 const char kSettingsEnforcementGroupNoEnforcement[] = "no_enforcement";
479 const char kSettingsEnforcementGroupEnforceAlways[] = "enforce_always";
480 const char kSettingsEnforcementGroupEnforceAlwaysWithDSE[] =
481 "enforce_always_with_dse";
482 const char kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE[] =
483 "enforce_always_with_extensions_and_dse";
485 } // namespace internals
487 scoped_ptr<PrefService> CreateLocalState(
488 const base::FilePath& pref_filename,
489 base::SequencedTaskRunner* pref_io_task_runner,
490 policy::PolicyService* policy_service,
491 const scoped_refptr<PrefRegistry>& pref_registry,
492 bool async) {
493 PrefServiceSyncableFactory factory;
494 PrepareFactory(
495 &factory,
496 policy_service,
497 NULL, // supervised_user_settings
498 new JsonPrefStore(
499 pref_filename, pref_io_task_runner, scoped_ptr<PrefFilter>()),
500 NULL, // extension_prefs
501 async);
502 return factory.Create(pref_registry.get());
505 scoped_ptr<PrefServiceSyncable> CreateProfilePrefs(
506 const base::FilePath& profile_path,
507 base::SequencedTaskRunner* pref_io_task_runner,
508 TrackedPreferenceValidationDelegate* validation_delegate,
509 policy::PolicyService* policy_service,
510 SupervisedUserSettingsService* supervised_user_settings,
511 const scoped_refptr<PrefStore>& extension_prefs,
512 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry,
513 bool async) {
514 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs");
515 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime");
517 // A StartSyncFlare used to kick sync early in case of a reset event. This is
518 // done since sync may bring back the user's server value post-reset which
519 // could potentially cause a "settings flash" between the factory default and
520 // the re-instantiated server value. Starting sync ASAP minimizes the window
521 // before the server value is re-instantiated (this window can otherwise be
522 // as long as 10 seconds by default).
523 const base::Closure start_sync_flare_for_prefs =
524 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
525 syncer::PREFERENCES);
527 PrefServiceSyncableFactory factory;
528 scoped_refptr<PersistentPrefStore> user_pref_store(
529 CreateProfilePrefStoreManager(profile_path)
530 ->CreateProfilePrefStore(pref_io_task_runner,
531 start_sync_flare_for_prefs,
532 validation_delegate));
533 PrepareFactory(&factory,
534 policy_service,
535 supervised_user_settings,
536 user_pref_store,
537 extension_prefs,
538 async);
539 scoped_ptr<PrefServiceSyncable> pref_service =
540 factory.CreateSyncable(pref_registry.get());
542 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get());
544 return pref_service.Pass();
547 void SchedulePrefsFilePathVerification(const base::FilePath& profile_path) {
548 #if defined(OS_WIN)
549 // Only do prefs file verification on Windows.
550 const int kVerifyPrefsFileDelaySeconds = 60;
551 BrowserThread::GetBlockingPool()->PostDelayedTask(
552 FROM_HERE,
553 base::Bind(&VerifyPreferencesFile,
554 ProfilePrefStoreManager::GetPrefFilePathFromProfilePath(
555 profile_path)),
556 base::TimeDelta::FromSeconds(kVerifyPrefsFileDelaySeconds));
557 #endif
560 void DisableDomainCheckForTesting() {
561 #if defined(OS_WIN)
562 g_disable_domain_check_for_testing = true;
563 #endif // OS_WIN
566 bool InitializePrefsFromMasterPrefs(
567 const base::FilePath& profile_path,
568 const base::DictionaryValue& master_prefs) {
569 return CreateProfilePrefStoreManager(profile_path)
570 ->InitializePrefsFromMasterPrefs(master_prefs);
573 base::Time GetResetTime(Profile* profile) {
574 return ProfilePrefStoreManager::GetResetTime(profile->GetPrefs());
577 void ClearResetTime(Profile* profile) {
578 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs());
581 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
582 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
585 void RegisterPrefs(PrefRegistrySimple* registry) {
586 ProfilePrefStoreManager::RegisterPrefs(registry);
589 } // namespace chrome_prefs