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

Unified Diff: chrome/browser/extensions/settings/settings_api.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
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/settings/settings_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/settings/settings_api.h
diff --git a/chrome/browser/extensions/settings/settings_api.h b/chrome/browser/extensions/settings/settings_api.h
index 9e0c712ecbee821e40900e7be4b5f4b67e33072b..a73e5fe83ac814e01e054f6434cf49cc8f9b341e 100644
--- a/chrome/browser/extensions/settings/settings_api.h
+++ b/chrome/browser/extensions/settings/settings_api.h
@@ -10,12 +10,17 @@
#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/extensions/settings/settings_backend.h"
+#include "chrome/browser/extensions/settings/settings_namespace.h"
#include "chrome/browser/extensions/settings/settings_storage.h"
namespace extensions {
// Superclass of all settings functions.
class SettingsFunction : public AsyncExtensionFunction {
+ public:
+ SettingsFunction();
+ virtual ~SettingsFunction();
+
protected:
virtual bool RunImpl() OVERRIDE;
@@ -24,28 +29,28 @@ class SettingsFunction : public AsyncExtensionFunction {
//
// Implementations should fill in args themselves, though (like RunImpl)
// may return false to imply failure.
- virtual bool RunWithStorage(
- scoped_refptr<SettingsObserverList> observers,
- SettingsStorage* storage) = 0;
+ virtual bool RunWithStorage(SettingsStorage* storage) = 0;
// Sets error_ or result_ depending on the value of a storage ReadResult, and
// returns whether the result implies success (i.e. !error).
- bool UseReadResult(
- const SettingsStorage::ReadResult& result);
+ bool UseReadResult(const SettingsStorage::ReadResult& result);
// Sets error_ depending on the value of a storage WriteResult, sends a
// change notification if needed, and returns whether the result implies
// success (i.e. !error).
- bool UseWriteResult(
- scoped_refptr<SettingsObserverList> observers,
- const SettingsStorage::WriteResult& result);
+ bool UseWriteResult(const SettingsStorage::WriteResult& result);
private:
// Called via PostTask from RunImpl. Calls RunWithStorage and then
// SendReponse with its success value.
- void RunWithStorageOnFileThread(
- scoped_refptr<SettingsObserverList> observers,
- SettingsStorage* storage);
+ void RunWithStorageOnFileThread(SettingsStorage* storage);
+
+ // The settings namespace the call was for. For example, SYNC if the API
+ // call was chrome.settings.experimental.sync..., LOCAL if .local, etc.
+ settings_namespace::Namespace settings_namespace_;
+
+ // Observers, cached so that it's only grabbed from the UI thread.
+ scoped_refptr<SettingsObserverList> observers_;
};
class GetSettingsFunction : public SettingsFunction {
@@ -53,9 +58,7 @@ class GetSettingsFunction : public SettingsFunction {
DECLARE_EXTENSION_FUNCTION_NAME("experimental.settings.get");
protected:
- virtual bool RunWithStorage(
- scoped_refptr<SettingsObserverList> observers,
- SettingsStorage* storage) OVERRIDE;
+ virtual bool RunWithStorage(SettingsStorage* storage) OVERRIDE;
};
class SetSettingsFunction : public SettingsFunction {
@@ -63,9 +66,7 @@ class SetSettingsFunction : public SettingsFunction {
DECLARE_EXTENSION_FUNCTION_NAME("experimental.settings.set");
protected:
- virtual bool RunWithStorage(
- scoped_refptr<SettingsObserverList> observers,
- SettingsStorage* storage) OVERRIDE;
+ virtual bool RunWithStorage(SettingsStorage* storage) OVERRIDE;
virtual void GetQuotaLimitHeuristics(
QuotaLimitHeuristics* heuristics) const OVERRIDE;
@@ -76,9 +77,7 @@ class RemoveSettingsFunction : public SettingsFunction {
DECLARE_EXTENSION_FUNCTION_NAME("experimental.settings.remove");
protected:
- virtual bool RunWithStorage(
- scoped_refptr<SettingsObserverList> observers,
- SettingsStorage* storage) OVERRIDE;
+ virtual bool RunWithStorage(SettingsStorage* storage) OVERRIDE;
virtual void GetQuotaLimitHeuristics(
QuotaLimitHeuristics* heuristics) const OVERRIDE;
@@ -89,9 +88,7 @@ class ClearSettingsFunction : public SettingsFunction {
DECLARE_EXTENSION_FUNCTION_NAME("experimental.settings.clear");
protected:
- virtual bool RunWithStorage(
- scoped_refptr<SettingsObserverList> observers,
- SettingsStorage* storage) OVERRIDE;
+ virtual bool RunWithStorage(SettingsStorage* storage) OVERRIDE;
virtual void GetQuotaLimitHeuristics(
QuotaLimitHeuristics* heuristics) const OVERRIDE;
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/settings/settings_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698