| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ | 6 #define CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "components/user_prefs/tracked/pref_hash_filter.h" | 17 #include "components/user_prefs/tracked/pref_hash_filter.h" |
| 18 | 18 |
| 19 class HashStoreContents; | 19 class HashStoreContents; |
| 20 class PersistentPrefStore; | 20 class PersistentPrefStore; |
| 21 class PrefHashStore; | 21 class PrefHashStore; |
| 22 class PrefService; | 22 class PrefService; |
| 23 class TrackedPreferenceValidationDelegate; | |
| 24 | 23 |
| 25 namespace base { | 24 namespace base { |
| 26 class DictionaryValue; | 25 class DictionaryValue; |
| 27 class SequencedTaskRunner; | 26 class SequencedTaskRunner; |
| 28 } // namespace base | 27 } // namespace base |
| 29 | 28 |
| 29 namespace prefs { |
| 30 namespace mojom { |
| 31 class TrackedPreferenceValidationDelegate; |
| 32 } |
| 33 } |
| 34 |
| 30 namespace user_prefs { | 35 namespace user_prefs { |
| 31 class PrefRegistrySyncable; | 36 class PrefRegistrySyncable; |
| 32 } // namespace user_prefs | 37 } // namespace user_prefs |
| 33 | 38 |
| 34 // Provides a facade through which the user preference store may be accessed and | 39 // Provides a facade through which the user preference store may be accessed and |
| 35 // managed. | 40 // managed. |
| 36 class ProfilePrefStoreManager { | 41 class ProfilePrefStoreManager { |
| 37 public: | 42 public: |
| 38 // Instantiates a ProfilePrefStoreManager with the configuration required to | 43 // Instantiates a ProfilePrefStoreManager with the configuration required to |
| 39 // manage the user preferences of the profile at |profile_path|. | 44 // manage the user preferences of the profile at |profile_path|. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #endif | 84 #endif |
| 80 | 85 |
| 81 // Creates a PersistentPrefStore providing access to the user preferences of | 86 // Creates a PersistentPrefStore providing access to the user preferences of |
| 82 // the managed profile. If |on_reset| is provided, it will be invoked if a | 87 // the managed profile. If |on_reset| is provided, it will be invoked if a |
| 83 // reset occurs as a result of loading the profile's prefs. | 88 // reset occurs as a result of loading the profile's prefs. |
| 84 // An optional |validation_delegate| will be notified | 89 // An optional |validation_delegate| will be notified |
| 85 // of the status of each tracked preference as they are checked. | 90 // of the status of each tracked preference as they are checked. |
| 86 PersistentPrefStore* CreateProfilePrefStore( | 91 PersistentPrefStore* CreateProfilePrefStore( |
| 87 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, | 92 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
| 88 const base::Closure& on_reset_on_load, | 93 const base::Closure& on_reset_on_load, |
| 89 TrackedPreferenceValidationDelegate* validation_delegate); | 94 prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate); |
| 90 | 95 |
| 91 // Initializes the preferences for the managed profile with the preference | 96 // Initializes the preferences for the managed profile with the preference |
| 92 // values in |master_prefs|. Acts synchronously, including blocking IO. | 97 // values in |master_prefs|. Acts synchronously, including blocking IO. |
| 93 // Returns true on success. | 98 // Returns true on success. |
| 94 bool InitializePrefsFromMasterPrefs( | 99 bool InitializePrefsFromMasterPrefs( |
| 95 std::unique_ptr<base::DictionaryValue> master_prefs); | 100 std::unique_ptr<base::DictionaryValue> master_prefs); |
| 96 | 101 |
| 97 // Creates a single-file PrefStore as was used in M34 and earlier. Used only | 102 // Creates a single-file PrefStore as was used in M34 and earlier. Used only |
| 98 // for testing migration. | 103 // for testing migration. |
| 99 PersistentPrefStore* CreateDeprecatedCombinedProfilePrefStore( | 104 PersistentPrefStore* CreateDeprecatedCombinedProfilePrefStore( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 118 tracking_configuration_; | 123 tracking_configuration_; |
| 119 const size_t reporting_ids_count_; | 124 const size_t reporting_ids_count_; |
| 120 const std::string seed_; | 125 const std::string seed_; |
| 121 const std::string legacy_device_id_; | 126 const std::string legacy_device_id_; |
| 122 PrefService* local_state_; | 127 PrefService* local_state_; |
| 123 | 128 |
| 124 DISALLOW_COPY_AND_ASSIGN(ProfilePrefStoreManager); | 129 DISALLOW_COPY_AND_ASSIGN(ProfilePrefStoreManager); |
| 125 }; | 130 }; |
| 126 | 131 |
| 127 #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ | 132 #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ |
| OLD | NEW |