| 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;
|
|
|