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

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: comments 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 28b0e8a523252900731b0203c06ba37acd65d80d..81c1067f580600f1e2875953228839efdee46306 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();
@@ -37,6 +43,13 @@ class ExtensionSettingsBackend : public SyncableService {
// Deletes all setting data for an extension. Call on the FILE thread.
void DeleteExtensionData(const std::string& extension_id);
+ // 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 ExtensionSettingChanges& changes) const;
+
// SyncableService implementation.
virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE;
virtual SyncError MergeDataAndStartSyncing(
@@ -64,6 +77,10 @@ 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.
+ const 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> >

Powered by Google App Engine
This is Rietveld 408576698