Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(755)

Unified Diff: chrome/browser/extensions/extension_settings_backend.h

Issue 8177022: Add onChanged events to the extension settings API, both from sync and between (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..c2c9320a40c2b7578eba5526a3fc2b539975e7d8 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,
+ const scoped_refptr<ObserverListThreadSafe<ExtensionSettingsObserver> >&
+ observers);
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_;
akalin 2011/10/12 22:26:30 const scoped_refptr
not at google - send to devlin 2011/10/13 06:40:43 Done.
+
// 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> >

Powered by Google App Engine
This is Rietveld 408576698