| 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 is the base interface for a preference services that provides | 5 // This is the base interface for a preference services that provides |
| 6 // a way to access the application's current preferences. | 6 // a way to access the application's current preferences. |
| 7 // | 7 // |
| 8 // This base interface assumes all preferences are local. See | 8 // This base interface assumes all preferences are local. See |
| 9 // SyncablePrefServiceBase for the interface to a preference service | 9 // SyncablePrefServiceBase for the interface to a preference service |
| 10 // that stores preferences that can be synced. | 10 // that stores preferences that can be synced. |
| 11 // | 11 // |
| 12 // Chromium settings and storage represent user-selected preferences and | 12 // Chromium settings and storage represent user-selected preferences and |
| 13 // information and MUST not be extracted, overwritten or modified except | 13 // information and MUST not be extracted, overwritten or modified except |
| 14 // through Chromium defined APIs. | 14 // through Chromium defined APIs. |
| 15 | 15 |
| 16 #ifndef BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ | 16 #ifndef BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ |
| 17 #define BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ | 17 #define BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ |
| 18 | 18 |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class BrowserContext; | 22 class BrowserContext; |
| 23 class NotificationObserver; | |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace subtle { | 25 namespace subtle { |
| 27 class PrefMemberBase; | 26 class PrefMemberBase; |
| 28 } | 27 } |
| 29 | 28 |
| 30 class FilePath; | 29 class FilePath; |
| 30 class PrefObserver; |
| 31 class Profile; | 31 class Profile; |
| 32 class TabContents; | 32 class TabContents; |
| 33 | 33 |
| 34 class PrefServiceBase { | 34 class PrefServiceBase { |
| 35 public: | 35 public: |
| 36 // Retrieves a PrefServiceBase for the given context. | 36 // Retrieves a PrefServiceBase for the given context. |
| 37 static PrefServiceBase* FromBrowserContext(content::BrowserContext* context); | 37 static PrefServiceBase* FromBrowserContext(content::BrowserContext* context); |
| 38 | 38 |
| 39 virtual ~PrefServiceBase() {} | 39 virtual ~PrefServiceBase() {} |
| 40 | 40 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // access to the otherwise protected members Add/RemovePrefObserver. | 252 // access to the otherwise protected members Add/RemovePrefObserver. |
| 253 // PrefMember registers for preferences changes notification directly to | 253 // PrefMember registers for preferences changes notification directly to |
| 254 // avoid the storage overhead of the registrar, so its base class must be | 254 // avoid the storage overhead of the registrar, so its base class must be |
| 255 // declared as a friend, too. | 255 // declared as a friend, too. |
| 256 friend class PrefChangeRegistrar; | 256 friend class PrefChangeRegistrar; |
| 257 friend class subtle::PrefMemberBase; | 257 friend class subtle::PrefMemberBase; |
| 258 | 258 |
| 259 // These are protected so they can only be accessed by the friend | 259 // These are protected so they can only be accessed by the friend |
| 260 // classes listed above. | 260 // classes listed above. |
| 261 // | 261 // |
| 262 // If the pref at the given path changes, we call the observer's Observe | 262 // If the pref at the given path changes, we call the observer's |
| 263 // method with PREF_CHANGED. Note that observers should not call these methods | 263 // OnPreferenceChanged method. Note that observers should not call |
| 264 // directly but rather use a PrefChangeRegistrar to make sure the observer | 264 // these methods directly but rather use a PrefChangeRegistrar to |
| 265 // gets cleaned up properly. | 265 // make sure the observer gets cleaned up properly. |
| 266 virtual void AddPrefObserver(const char* path, | 266 virtual void AddPrefObserver(const char* path, PrefObserver* obs) = 0; |
| 267 content::NotificationObserver* obs) = 0; | 267 virtual void RemovePrefObserver(const char* path, PrefObserver* obs) = 0; |
| 268 virtual void RemovePrefObserver(const char* path, | |
| 269 content::NotificationObserver* obs) = 0; | |
| 270 }; | 268 }; |
| 271 | 269 |
| 272 #endif // BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ | 270 #endif // BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ |
| OLD | NEW |