Index: chrome/browser/prefs/pref_notifier.h |
diff --git a/chrome/browser/prefs/pref_notifier.h b/chrome/browser/prefs/pref_notifier.h |
index 7334a514f29d28d87745abd0d9b980447a2a87bb..7c9ad52c12b7dd2f1806880f784af189a911466e 100644 |
--- a/chrome/browser/prefs/pref_notifier.h |
+++ b/chrome/browser/prefs/pref_notifier.h |
@@ -12,68 +12,24 @@ |
#include "base/hash_tables.h" |
#include "base/non_thread_safe.h" |
#include "base/observer_list.h" |
-#include "chrome/common/notification_observer.h" |
-#include "chrome/common/notification_registrar.h" |
class NotificationObserver; |
class PrefService; |
-class PrefValueStore; |
-class Value; |
// Registers observers for particular preferences and sends notifications when |
// preference values or sources (i.e., which preference layer controls the |
// preference) change. |
-class PrefNotifier : public NonThreadSafe, |
- public NotificationObserver { |
+class PrefNotifier : public NonThreadSafe { |
danno
2010/12/02 10:31:52
Make complete delegate interface that the PrefServ
Mattias Nissler (ping if slow)
2010/12/02 16:38:24
Done.
|
public: |
- // PrefStores must be listed here in order from highest to lowest priority. |
- // MANAGED_PLATFORM contains all managed preference values that are |
- // provided by a platform-specific policy mechanism (e.g. Windows |
- // Group Policy). |
- // DEVICE_MANAGEMENT contains all managed preference values supplied |
- // by the device management server (cloud policy). |
- // EXTENSION contains preference values set by extensions. |
- // COMMAND_LINE contains preference values set by command-line switches. |
- // USER contains all user-set preference values. |
- // RECOMMENDED contains all recommended (policy) preference values. |
- // DEFAULT contains all application default preference values. |
- // This enum is kept in pref_notifier.h rather than pref_value_store.h in |
- // order to minimize additional headers needed by the *PrefStore files. |
- enum PrefStoreType { |
- // INVALID_STORE is not associated with an actual PrefStore but used as |
- // an invalid marker, e.g. as a return value. |
- INVALID_STORE = -1, |
- MANAGED_PLATFORM_STORE = 0, |
- DEVICE_MANAGEMENT_STORE, |
- EXTENSION_STORE, |
- COMMAND_LINE_STORE, |
- USER_STORE, |
- RECOMMENDED_STORE, |
- DEFAULT_STORE, |
- PREF_STORE_TYPE_MAX = DEFAULT_STORE |
- }; |
- |
- // The |service| with which this notifier is associated will be sent as the |
- // source of any notifications. |
- PrefNotifier(PrefService* service, PrefValueStore* value_store); |
- |
+ PrefNotifier(PrefService* service); |
virtual ~PrefNotifier(); |
- // For the given pref_name, fire any observer of the pref if the effective |
- // value of the pref or the store controlling its value has changed, been |
- // added, or been removed (but not if it's re-setting the same value it had |
- // already). |new_store| should be the PrefStoreType of the store reporting |
- // the change. |
- void OnPreferenceSet(const char* pref_name, |
- PrefNotifier::PrefStoreType new_store); |
+ // Sends out a change notification for the preference identified by |
+ // |pref_name|. |
+ virtual void OnPreferenceChanged(const std::string& pref_name); |
- // Convenience method to be called when a preference is set in the |
- // USER_STORE. See OnPreferenceSet(). |
- void OnUserPreferenceSet(const char* pref_name); |
- |
- // For the given pref_name, fire any observer of the pref. Virtual so it can |
- // be mocked for unit testing. |
- virtual void FireObservers(const char* path); |
+ // Broadcasts the intialization completed notification. |
+ virtual void OnInitializationCompleted(); |
// If the pref at the given path changes, we call the observer's Observe |
// method with PREF_CHANGED. |
@@ -89,29 +45,16 @@ class PrefNotifier : public NonThreadSafe, |
PrefObserverMap; |
const PrefObserverMap* pref_observers() { return &pref_observers_; } |
+ // For the given pref_name, fire any observer of the pref. Virtual so it can |
battre (please use the other)
2010/12/02 10:41:19
|pref_name| vs. |path| below
Mattias Nissler (ping if slow)
2010/12/02 16:38:24
not applicable any longer.
|
+ // be mocked for unit tests. |
+ virtual void FireObservers(const std::string& path); |
+ |
private: |
- // Weak references. |
+ // Weak reference; the notifier is owned by the PrefService. |
PrefService* pref_service_; |
- PrefValueStore* pref_value_store_; |
- |
- NotificationRegistrar registrar_; |
PrefObserverMap pref_observers_; |
- // Called after a policy refresh to notify relevant preference observers. |
- // |changed_prefs_paths| is the vector of preference paths changed by the |
- // policy update. It is passed by value and not reference because |
- // this method is called asynchronously as a callback from another thread. |
- // Copying the vector guarantees that the vector's lifecycle spans the |
- // method's invocation. |
- void FireObserversForRefreshedManagedPrefs( |
- std::vector<std::string> changed_prefs_paths); |
- |
- // NotificationObserver methods: |
- virtual void Observe(NotificationType type, |
- const NotificationSource& source, |
- const NotificationDetails& details); |
- |
DISALLOW_COPY_AND_ASSIGN(PrefNotifier); |
}; |