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

Unified Diff: chrome/browser/extensions/api/settings_private/settings_private_api.h

Issue 1015623005: chrome.settingsPrivate: Basic stub implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update API to reflect design changes. Still error on calling method. Created 5 years, 9 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/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_

Powered by Google App Engine
This is Rietveld 408576698