Index: chrome/browser/extensions/api/settings_private/settings_private_api.h |
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_api.h b/chrome/browser/extensions/api/settings_private/settings_private_api.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8a79ce6c5c49e81dfdc2f03c2de95cb9c52d63e1 |
--- /dev/null |
+++ b/chrome/browser/extensions/api/settings_private/settings_private_api.h |
@@ -0,0 +1,99 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_SETTINGS_PRIVATE_API_H_ |
+#define CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_SETTINGS_PRIVATE_API_H_ |
+ |
+#include <string> |
+ |
+#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/values.h" |
+#include "extensions/browser/extension_function.h" |
+ |
+namespace extensions { |
+ |
+// Implements the chrome.settingsPrivate.setBooleanPref method. |
+class SettingsPrivateSetBooleanPrefFunction : public AsyncExtensionFunction { |
+ public: |
+ SettingsPrivateSetBooleanPrefFunction() {} |
+ DECLARE_EXTENSION_FUNCTION("settingsPrivate.setBooleanPref", |
+ SETTINGSPRIVATE_SETBOOLEANPREF); |
+ |
+ protected: |
+ ~SettingsPrivateSetBooleanPrefFunction() override; |
+ |
+ // AsyncExtensionFunction overrides. |
+ bool RunAsync() override; |
+ |
+ private: |
+ void Success(bool result); |
+ void Failure(const std::string& error_name); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SettingsPrivateSetBooleanPrefFunction); |
+}; |
+ |
+// Implements the chrome.settingsPrivate.setNumericPref method. |
+class SettingsPrivateSetNumericPrefFunction : public AsyncExtensionFunction { |
+ public: |
+ SettingsPrivateSetNumericPrefFunction() {} |
+ DECLARE_EXTENSION_FUNCTION("settingsPrivate.setNumericPref", |
+ SETTINGSPRIVATE_SETNUMERICPREF); |
+ |
+ protected: |
+ ~SettingsPrivateSetNumericPrefFunction() override; |
+ |
+ // AsyncExtensionFunction overrides. |
+ bool RunAsync() override; |
+ |
+ private: |
+ void Success(bool result); |
+ void Failure(const std::string& error); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SettingsPrivateSetNumericPrefFunction); |
+}; |
+ |
+// Implements the chrome.settingsPrivate.setStringPref method. |
+class SettingsPrivateSetStringPrefFunction : public AsyncExtensionFunction { |
+ public: |
+ SettingsPrivateSetStringPrefFunction() {} |
+ DECLARE_EXTENSION_FUNCTION("settingsPrivate.setStringPref", |
+ SETTINGSPRIVATE_SETSTRINGPREF); |
+ |
+ protected: |
+ ~SettingsPrivateSetStringPrefFunction() override; |
+ |
+ // AsyncExtensionFunction overrides. |
+ bool RunAsync() override; |
+ |
+ private: |
+ void Success(bool result); |
+ void Failure(const std::string& error); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SettingsPrivateSetStringPrefFunction); |
+}; |
+ |
+// Implements the chrome.settingsPrivate.getAllPrefs method. |
+class SettingsPrivateGetAllPrefsFunction : public AsyncExtensionFunction { |
+ public: |
+ SettingsPrivateGetAllPrefsFunction() {} |
+ DECLARE_EXTENSION_FUNCTION("settingsPrivate.getAllPrefs", |
+ SETTINGSPRIVATE_GETALLPREFS); |
+ |
+ protected: |
+ ~SettingsPrivateGetAllPrefsFunction() override; |
+ |
+ // AsyncExtensionFunction overrides. |
+ bool RunAsync() override; |
+ |
+ private: |
+ void Success(scoped_ptr<base::ListValue> result); |
+ void Failure(const std::string& error); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SettingsPrivateGetAllPrefsFunction); |
+}; |
+ |
+} // namespace extensions |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_SETTINGS_PRIVATE_API_H_ |