OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_SETTINGS_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_SETTINGS_PRIVATE_API_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/values.h" |
| 13 #include "extensions/browser/extension_function.h" |
| 14 |
| 15 namespace extensions { |
| 16 |
| 17 // Implements the chrome.settingsPrivate.setBooleanPref method. |
| 18 class SettingsPrivateSetBooleanPrefFunction : public AsyncExtensionFunction { |
| 19 public: |
| 20 SettingsPrivateSetBooleanPrefFunction() {} |
| 21 DECLARE_EXTENSION_FUNCTION("settingsPrivate.setBooleanPref", |
| 22 SETTINGSPRIVATE_SETBOOLEANPREF); |
| 23 |
| 24 protected: |
| 25 ~SettingsPrivateSetBooleanPrefFunction() override; |
| 26 |
| 27 // AsyncExtensionFunction overrides. |
| 28 bool RunAsync() override; |
| 29 |
| 30 private: |
| 31 void Success(bool result); |
| 32 void Failure(const std::string& error_name); |
| 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(SettingsPrivateSetBooleanPrefFunction); |
| 35 }; |
| 36 |
| 37 // Implements the chrome.settingsPrivate.setNumericPref method. |
| 38 class SettingsPrivateSetNumericPrefFunction : public AsyncExtensionFunction { |
| 39 public: |
| 40 SettingsPrivateSetNumericPrefFunction() {} |
| 41 DECLARE_EXTENSION_FUNCTION("settingsPrivate.setNumericPref", |
| 42 SETTINGSPRIVATE_SETNUMERICPREF); |
| 43 |
| 44 protected: |
| 45 ~SettingsPrivateSetNumericPrefFunction() override; |
| 46 |
| 47 // AsyncExtensionFunction overrides. |
| 48 bool RunAsync() override; |
| 49 |
| 50 private: |
| 51 void Success(bool result); |
| 52 void Failure(const std::string& error); |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(SettingsPrivateSetNumericPrefFunction); |
| 55 }; |
| 56 |
| 57 // Implements the chrome.settingsPrivate.setStringPref method. |
| 58 class SettingsPrivateSetStringPrefFunction : public AsyncExtensionFunction { |
| 59 public: |
| 60 SettingsPrivateSetStringPrefFunction() {} |
| 61 DECLARE_EXTENSION_FUNCTION("settingsPrivate.setStringPref", |
| 62 SETTINGSPRIVATE_SETSTRINGPREF); |
| 63 |
| 64 protected: |
| 65 ~SettingsPrivateSetStringPrefFunction() override; |
| 66 |
| 67 // AsyncExtensionFunction overrides. |
| 68 bool RunAsync() override; |
| 69 |
| 70 private: |
| 71 void Success(bool result); |
| 72 void Failure(const std::string& error); |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(SettingsPrivateSetStringPrefFunction); |
| 75 }; |
| 76 |
| 77 // Implements the chrome.settingsPrivate.getAllPrefs method. |
| 78 class SettingsPrivateGetAllPrefsFunction : public AsyncExtensionFunction { |
| 79 public: |
| 80 SettingsPrivateGetAllPrefsFunction() {} |
| 81 DECLARE_EXTENSION_FUNCTION("settingsPrivate.getAllPrefs", |
| 82 SETTINGSPRIVATE_GETALLPREFS); |
| 83 |
| 84 protected: |
| 85 ~SettingsPrivateGetAllPrefsFunction() override; |
| 86 |
| 87 // AsyncExtensionFunction overrides. |
| 88 bool RunAsync() override; |
| 89 |
| 90 private: |
| 91 void Success(scoped_ptr<base::ListValue> result); |
| 92 void Failure(const std::string& error); |
| 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(SettingsPrivateGetAllPrefsFunction); |
| 95 }; |
| 96 |
| 97 } // namespace extensions |
| 98 |
| 99 #endif // CHROME_BROWSER_EXTENSIONS_API_SETTINGS_PRIVATE_SETTINGS_PRIVATE_API_H
_ |
OLD | NEW |