Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / chrome / browser / prefs / chrome_pref_service_factory.h
blobf12671930b3203bfc2a058d66bd8ed95ba4db2d6
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 #ifndef CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
11 namespace base {
12 class DictionaryValue;
13 class FilePath;
14 class SequencedTaskRunner;
15 class Time;
18 namespace policy {
19 class PolicyService;
22 namespace syncable_prefs {
23 class PrefServiceSyncable;
26 namespace user_prefs {
27 class PrefRegistrySyncable;
30 class PrefHashStore;
31 class PrefRegistry;
32 class PrefRegistrySimple;
33 class PrefService;
35 class PrefStore;
36 class Profile;
37 class SupervisedUserSettingsService;
38 class TrackedPreferenceValidationDelegate;
40 namespace chrome_prefs {
42 namespace internals {
44 extern const char kSettingsEnforcementTrialName[];
45 extern const char kSettingsEnforcementGroupNoEnforcement[];
46 extern const char kSettingsEnforcementGroupEnforceAlways[];
47 extern const char kSettingsEnforcementGroupEnforceAlwaysWithDSE[];
48 extern const char kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE[];
50 } // namespace internals
52 // Factory methods that create and initialize a new instance of a
53 // PrefService for Chrome with the applicable PrefStores. The
54 // |pref_filename| points to the user preference file. This is the
55 // usual way to create a new PrefService.
56 // |extension_pref_store| is used as the source for extension-controlled
57 // preferences and may be NULL.
58 // |policy_service| is used as the source for mandatory or recommended
59 // policies.
60 // |pref_registry| keeps the list of registered prefs and their default values.
61 // If |async| is true, asynchronous version is used.
62 // Notifies using PREF_INITIALIZATION_COMPLETED in the end. Details is set to
63 // the created PrefService or NULL if creation has failed. Note, it is
64 // guaranteed that in asynchronous version initialization happens after this
65 // function returned.
67 scoped_ptr<PrefService> CreateLocalState(
68 const base::FilePath& pref_filename,
69 base::SequencedTaskRunner* pref_io_task_runner,
70 policy::PolicyService* policy_service,
71 const scoped_refptr<PrefRegistry>& pref_registry,
72 bool async);
74 scoped_ptr<syncable_prefs::PrefServiceSyncable> CreateProfilePrefs(
75 const base::FilePath& pref_filename,
76 base::SequencedTaskRunner* pref_io_task_runner,
77 TrackedPreferenceValidationDelegate* validation_delegate,
78 policy::PolicyService* policy_service,
79 SupervisedUserSettingsService* supervised_user_settings,
80 const scoped_refptr<PrefStore>& extension_prefs,
81 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry,
82 bool async);
84 // Schedules verification of the path resolution of the preferences file under
85 // |profile_path|.
86 void SchedulePrefsFilePathVerification(const base::FilePath& profile_path);
88 // Call before startup tasks kick in to ignore the presence of a domain when
89 // determining the active SettingsEnforcement group. For testing only.
90 void DisableDomainCheckForTesting();
92 // Initializes the preferences for the profile at |profile_path| with the
93 // preference values in |master_prefs|. Returns true on success.
94 bool InitializePrefsFromMasterPrefs(
95 const base::FilePath& profile_path,
96 const base::DictionaryValue& master_prefs);
98 // Retrieves the time of the last preference reset event, if any, for the
99 // provided profile. If no reset has occurred, returns a null |Time|.
100 base::Time GetResetTime(Profile* profile);
102 // Clears the time of the last preference reset event, if any, for the provided
103 // profile.
104 void ClearResetTime(Profile* profile);
106 // Register local state prefs used by chrome preference system.
107 void RegisterPrefs(PrefRegistrySimple* registry);
109 // Register user prefs used by chrome preference system.
110 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
112 } // namespace chrome_prefs
114 #endif // CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_