OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // This provides a way to access the application's current preferences. | 5 // This provides a way to access the application's current preferences. |
6 | 6 |
7 // Chromium settings and storage represent user-selected preferences and | 7 // Chromium settings and storage represent user-selected preferences and |
8 // information and MUST not be extracted, overwritten or modified except | 8 // information and MUST not be extracted, overwritten or modified except |
9 // through Chromium defined APIs. | 9 // through Chromium defined APIs. |
10 | 10 |
11 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 11 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_H_ |
12 #define CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 12 #define CHROME_BROWSER_PREFS_PREF_SERVICE_H_ |
13 | 13 |
14 #include <set> | 14 #include <set> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/observer_list.h" | |
19 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/non_thread_safe.h" |
20 #include "chrome/browser/api/prefs/pref_service_base.h" | 21 #include "chrome/browser/api/prefs/pref_service_base.h" |
21 | 22 |
22 class CommandLine; | 23 class CommandLine; |
23 class DefaultPrefStore; | 24 class DefaultPrefStore; |
24 class PersistentPrefStore; | 25 class PersistentPrefStore; |
25 class PrefModelAssociator; | 26 class PrefModelAssociator; |
26 class PrefNotifier; | 27 class PrefNotifier; |
27 class PrefNotifierImpl; | 28 class PrefNotifierImpl; |
29 class PrefServiceObserver; | |
28 class PrefStore; | 30 class PrefStore; |
29 class PrefValueStore; | 31 class PrefValueStore; |
30 | 32 |
31 namespace syncer { | 33 namespace syncer { |
32 class SyncableService; | 34 class SyncableService; |
33 } | 35 } |
34 | 36 |
35 namespace policy { | 37 namespace policy { |
36 class PolicyService; | 38 class PolicyService; |
37 } | 39 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 | 123 |
122 // Reloads the data from file. This should only be called when the importer | 124 // Reloads the data from file. This should only be called when the importer |
123 // is running during first run, and the main process may not change pref | 125 // is running during first run, and the main process may not change pref |
124 // values while the importer process is running. Returns true on success. | 126 // values while the importer process is running. Returns true on success. |
125 bool ReloadPersistentPrefs(); | 127 bool ReloadPersistentPrefs(); |
126 | 128 |
127 // Lands pending writes to disk. This should only be used if we need to save | 129 // Lands pending writes to disk. This should only be used if we need to save |
128 // immediately (basically, during shutdown). | 130 // immediately (basically, during shutdown). |
129 void CommitPendingWrite(); | 131 void CommitPendingWrite(); |
130 | 132 |
133 void AddObserver(PrefServiceObserver* observer); | |
134 void RemoveObserver(PrefServiceObserver* observer); | |
135 | |
136 // Returns true if preferences state has synchronized with the remote | |
137 // preferences. If true is returned it can be assumed the local preferences | |
138 // has applied changes from the remote preferences. The two may not be | |
139 // identical if a change is in flight (from either side). | |
140 bool HasSynced(); | |
sky
2012/10/23 00:24:21
I'm not the biggest fan of this name. If you have
| |
141 | |
142 // Invoked internally when the HasSynced() state changes. | |
143 void HasSyncedChanged(); | |
144 | |
131 // PrefServiceBase implementation. | 145 // PrefServiceBase implementation. |
132 virtual bool IsManagedPreference(const char* pref_name) const OVERRIDE; | 146 virtual bool IsManagedPreference(const char* pref_name) const OVERRIDE; |
133 virtual bool IsUserModifiablePreference(const char* pref_name) const OVERRIDE; | 147 virtual bool IsUserModifiablePreference(const char* pref_name) const OVERRIDE; |
134 virtual void RegisterBooleanPref(const char* path, | 148 virtual void RegisterBooleanPref(const char* path, |
135 bool default_value) OVERRIDE; | 149 bool default_value) OVERRIDE; |
136 virtual void RegisterIntegerPref(const char* path, | 150 virtual void RegisterIntegerPref(const char* path, |
137 int default_value) OVERRIDE; | 151 int default_value) OVERRIDE; |
138 virtual void RegisterDoublePref(const char* path, | 152 virtual void RegisterDoublePref(const char* path, |
139 double default_value) OVERRIDE; | 153 double default_value) OVERRIDE; |
140 virtual void RegisterStringPref(const char* path, | 154 virtual void RegisterStringPref(const char* path, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 mutable PreferenceSet prefs_; | 350 mutable PreferenceSet prefs_; |
337 | 351 |
338 // The model associator that maintains the links with the sync db. | 352 // The model associator that maintains the links with the sync db. |
339 scoped_ptr<PrefModelAssociator> pref_sync_associator_; | 353 scoped_ptr<PrefModelAssociator> pref_sync_associator_; |
340 | 354 |
341 // Whether CreateIncognitoPrefService() or | 355 // Whether CreateIncognitoPrefService() or |
342 // CreatePrefServiceWithPerTabPrefStore() have been called to create a | 356 // CreatePrefServiceWithPerTabPrefStore() have been called to create a |
343 // "forked" PrefService. | 357 // "forked" PrefService. |
344 bool pref_service_forked_; | 358 bool pref_service_forked_; |
345 | 359 |
360 ObserverList<PrefServiceObserver> observer_list_; | |
361 | |
346 DISALLOW_COPY_AND_ASSIGN(PrefService); | 362 DISALLOW_COPY_AND_ASSIGN(PrefService); |
347 }; | 363 }; |
348 | 364 |
349 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 365 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ |
OLD | NEW |