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

Unified Diff: chrome/browser/extensions/settings/settings_frontend.h

Issue 8670012: Extension Settings API: move the API functions into an object SettingsNamepace, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bug / sync Created 9 years, 1 month 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/settings/settings_frontend.h
diff --git a/chrome/browser/extensions/settings/settings_frontend.h b/chrome/browser/extensions/settings/settings_frontend.h
index 66cb48884debb985107b2137d9efe306390918dc..f30792a09e271d9e0f02c55cad31d993e63348e7 100644
--- a/chrome/browser/extensions/settings/settings_frontend.h
+++ b/chrome/browser/extensions/settings/settings_frontend.h
@@ -14,6 +14,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/observer_list_threadsafe.h"
#include "chrome/browser/extensions/settings/settings_leveldb_storage.h"
+#include "chrome/browser/extensions/settings/settings_namespace.h"
#include "chrome/browser/extensions/settings/settings_observer.h"
#include "chrome/browser/sync/api/syncable_service.h"
#include "content/public/browser/notification_observer.h"
@@ -34,8 +35,7 @@ class SettingsFrontend {
static SettingsFrontend* Create(Profile* profile);
static SettingsFrontend* Create(
- // Ownership taken.
- SettingsStorageFactory* storage_factory,
+ const scoped_refptr<SettingsStorageFactory>& storage_factory,
// Owership NOT taken.
Profile* profile);
@@ -53,7 +53,9 @@ class SettingsFrontend {
// |extension_id|. If there is no extension with that ID, the storage area
// will be NULL.
void RunWithStorage(
- const std::string& extension_id, const StorageCallback& callback);
+ const std::string& extension_id,
+ settings_namespace::Namespace settings_namespace,
+ const StorageCallback& callback);
// Deletes the settings for an extension (on the FILE thread).
void DeleteStorageSoon(const std::string& extension_id);
@@ -62,25 +64,8 @@ class SettingsFrontend {
scoped_refptr<SettingsObserverList> GetObservers();
private:
- // Settings change Observer which forwards changes on to the extension
- // processes for |profile| and its incognito partner if it exists.
- class DefaultObserver : public SettingsObserver {
- public:
- explicit DefaultObserver(Profile* profile);
- virtual ~DefaultObserver();
-
- // SettingsObserver implementation.
- virtual void OnSettingsChanged(
- const std::string& extension_id,
- const std::string& change_json) OVERRIDE;
-
- private:
- Profile* const profile_;
- };
-
SettingsFrontend(
- // Ownership taken.
- SettingsStorageFactory* storage_factory,
+ const scoped_refptr<SettingsStorageFactory>& storage_factory,
// Ownership NOT taken.
Profile* profile);
@@ -91,11 +76,21 @@ class SettingsFrontend {
scoped_refptr<SettingsObserverList> observers_;
// Observer for |profile_|.
- DefaultObserver default_observer_;
-
- // Ref-counted container for the SettingsBackend object.
- class Core;
- scoped_refptr<Core> core_;
+ scoped_ptr<SettingsObserver> profile_observer_;
+
+ // Ref-counted container for each SettingsBackend object. There are 4: an
+ // apps and an extensions Backend for the LOCAL namespace, and likewise for
+ // the SYNC namespace. They only differ in what directory the database for
+ // each exists in (and the Backends in the SYNC namespace happen to be
+ // returned from RunWithSyncableService).
+ class BackendWrapper;
+ struct BackendWrappers {
+ BackendWrappers();
+ ~BackendWrappers();
+ scoped_refptr<BackendWrapper> app;
+ scoped_refptr<BackendWrapper> extension;
+ };
+ std::map<settings_namespace::Namespace, BackendWrappers> backends_;
DISALLOW_COPY_AND_ASSIGN(SettingsFrontend);
};
« no previous file with comments | « chrome/browser/extensions/settings/settings_backend.cc ('k') | chrome/browser/extensions/settings/settings_frontend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698