Chromium Code Reviews| Index: chrome/browser/extensions/extension_settings_backend.h |
| diff --git a/chrome/browser/extensions/extension_settings_backend.h b/chrome/browser/extensions/extension_settings_backend.h |
| index 43b90a3382657aaed07bc657ece3fcdc874c79f3..834c9e57326f7206e7ea417296968a998e60a198 100644 |
| --- a/chrome/browser/extensions/extension_settings_backend.h |
| +++ b/chrome/browser/extensions/extension_settings_backend.h |
| @@ -10,7 +10,9 @@ |
| #include "base/file_path.h" |
| #include "base/memory/linked_ptr.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/observer_list_threadsafe.h" |
| #include "base/task.h" |
| +#include "chrome/browser/extensions/extension_settings_observer.h" |
| #include "chrome/browser/extensions/syncable_extension_settings_storage.h" |
| #include "chrome/browser/sync/api/syncable_service.h" |
| @@ -19,9 +21,13 @@ |
| // Lives entirely on the FILE thread. |
| class ExtensionSettingsBackend : public SyncableService { |
| public: |
| - // File path is the base of the extension settings directory. |
| - // The databases will be at base_path/extension_id. |
| - explicit ExtensionSettingsBackend(const FilePath& base_path); |
| + // |base_path| is the base of the extension settings directory, so the |
| + // databases will be at base_path/extension_id. |
| + // |observers| is the list of observers to settings changes. |
| + explicit ExtensionSettingsBackend( |
| + const FilePath& base_path, |
| + // Reference taken. |
| + ObserverListThreadSafe<ExtensionSettingsObserver>* observers); |
|
akalin
2011/10/07 21:06:23
pass a const ref to scoped_refptr
not at google - send to devlin
2011/10/10 01:00:16
Done.
|
| virtual ~ExtensionSettingsBackend(); |
| @@ -34,6 +40,13 @@ class ExtensionSettingsBackend : public SyncableService { |
| ExtensionSettingsStorage* GetStorage( |
| const std::string& extension_id) const; |
| + // Sends a change event to the observer list. |profile| is the profile which |
| + // generated the change. Must be called on the FILE thread. |
| + void TriggerOnSettingsChanged( |
| + Profile* profile, |
| + const std::string& extension_id, |
| + const std::string& event_json); |
| + |
| // SyncableService implementation. |
| virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE; |
| virtual SyncError MergeDataAndStartSyncing( |
| @@ -61,6 +74,9 @@ class ExtensionSettingsBackend : public SyncableService { |
| // The base file path to create any leveldb databases at. |
| const FilePath base_path_; |
| + // The list of observers to settings changes. |
| + scoped_refptr<ObserverListThreadSafe<ExtensionSettingsObserver> > observers_; |
| + |
| // A cache of ExtensionSettingsStorage objects that have already been created. |
| // Ensure that there is only ever one created per extension. |
| typedef std::map<std::string, linked_ptr<SyncableExtensionSettingsStorage> > |