| 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_SEARCH_ENGINES_PRIVATE_SEARCH_ENGINES_PRIV
ATE_API_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SEARCH_ENGINES_PRIVATE_SEARCH_ENGINES_PRIV
ATE_API_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "chrome/browser/extensions/chrome_extension_function_details.h" | |
| 12 #include "chrome/common/extensions/api/search_engines_private.h" | |
| 13 #include "extensions/browser/extension_function.h" | |
| 14 | |
| 15 namespace extensions { | |
| 16 | |
| 17 // Implements the chrome.searchEnginesPrivate.getSearchEngines method. | |
| 18 class SearchEnginesPrivateGetSearchEnginesFunction | |
| 19 : public UIThreadExtensionFunction { | |
| 20 public: | |
| 21 SearchEnginesPrivateGetSearchEnginesFunction(); | |
| 22 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.getSearchEngines", | |
| 23 SEARCHENGINESPRIVATE_GETSEARCHENGINES); | |
| 24 | |
| 25 protected: | |
| 26 ~SearchEnginesPrivateGetSearchEnginesFunction() override; | |
| 27 | |
| 28 // ExtensionFunction overrides. | |
| 29 ResponseAction Run() override; | |
| 30 | |
| 31 private: | |
| 32 ChromeExtensionFunctionDetails chrome_details_; | |
| 33 | |
| 34 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateGetSearchEnginesFunction); | |
| 35 }; | |
| 36 | |
| 37 // Implements the chrome.searchEnginesPrivate.setSelectedSearchEngine method. | |
| 38 class SearchEnginesPrivateSetSelectedSearchEngineFunction | |
| 39 : public UIThreadExtensionFunction { | |
| 40 public: | |
| 41 SearchEnginesPrivateSetSelectedSearchEngineFunction(); | |
| 42 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.setSelectedSearchEngine", | |
| 43 SEARCHENGINESPRIVATE_SETSELECTEDSEARCHENGINE); | |
| 44 | |
| 45 protected: | |
| 46 ~SearchEnginesPrivateSetSelectedSearchEngineFunction() override; | |
| 47 | |
| 48 // AsyncExtensionFunction overrides. | |
| 49 ResponseAction Run() override; | |
| 50 | |
| 51 private: | |
| 52 ChromeExtensionFunctionDetails chrome_details_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateSetSelectedSearchEngineFunction); | |
| 55 }; | |
| 56 | |
| 57 // Implements the chrome.searchEnginesPrivate.addOtherSearchEngine method. | |
| 58 class SearchEnginesPrivateAddOtherSearchEngineFunction | |
| 59 : public UIThreadExtensionFunction { | |
| 60 public: | |
| 61 SearchEnginesPrivateAddOtherSearchEngineFunction(); | |
| 62 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.addOtherSearchEngine", | |
| 63 SEARCHENGINESPRIVATE_ADDOTHERSEARCHENGINE); | |
| 64 | |
| 65 protected: | |
| 66 ~SearchEnginesPrivateAddOtherSearchEngineFunction() override; | |
| 67 | |
| 68 // ExtensionFunction overrides. | |
| 69 ResponseAction Run() override; | |
| 70 | |
| 71 private: | |
| 72 ChromeExtensionFunctionDetails chrome_details_; | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateAddOtherSearchEngineFunction); | |
| 75 }; | |
| 76 | |
| 77 // Implements the chrome.searchEnginesPrivate.updateSearchEngine method. | |
| 78 class SearchEnginesPrivateUpdateSearchEngineFunction | |
| 79 : public UIThreadExtensionFunction { | |
| 80 public: | |
| 81 SearchEnginesPrivateUpdateSearchEngineFunction(); | |
| 82 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.updateSearchEngine", | |
| 83 SEARCHENGINESPRIVATE_UPDATESEARCHENGINE); | |
| 84 | |
| 85 protected: | |
| 86 ~SearchEnginesPrivateUpdateSearchEngineFunction() override; | |
| 87 | |
| 88 // ExtensionFunction overrides. | |
| 89 ResponseAction Run() override; | |
| 90 | |
| 91 private: | |
| 92 ChromeExtensionFunctionDetails chrome_details_; | |
| 93 | |
| 94 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateUpdateSearchEngineFunction); | |
| 95 }; | |
| 96 | |
| 97 // Implements the chrome.searchEnginesPrivate.removeSearchEngine method. | |
| 98 class SearchEnginesPrivateRemoveSearchEngineFunction | |
| 99 : public UIThreadExtensionFunction { | |
| 100 public: | |
| 101 SearchEnginesPrivateRemoveSearchEngineFunction(); | |
| 102 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.removeSearchEngine", | |
| 103 SEARCHENGINESPRIVATE_REMOVESEARCHENGINE); | |
| 104 | |
| 105 protected: | |
| 106 ~SearchEnginesPrivateRemoveSearchEngineFunction() override; | |
| 107 | |
| 108 // ExtensionFunction overrides. | |
| 109 ResponseAction Run() override; | |
| 110 | |
| 111 private: | |
| 112 ChromeExtensionFunctionDetails chrome_details_; | |
| 113 | |
| 114 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateRemoveSearchEngineFunction); | |
| 115 }; | |
| 116 | |
| 117 // Implements the chrome.searchEnginesPrivate.getHotwordState method. | |
| 118 class SearchEnginesPrivateGetHotwordStateFunction | |
| 119 : public UIThreadExtensionFunction { | |
| 120 public: | |
| 121 SearchEnginesPrivateGetHotwordStateFunction(); | |
| 122 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.getHotwordState", | |
| 123 SEARCHENGINESPRIVATE_GETHOTWORDSTATE); | |
| 124 | |
| 125 protected: | |
| 126 ~SearchEnginesPrivateGetHotwordStateFunction() override; | |
| 127 | |
| 128 // ExtensionFunction overrides. | |
| 129 ResponseAction Run() override; | |
| 130 | |
| 131 private: | |
| 132 void OnAudioHistoryChecked( | |
| 133 scoped_ptr<api::search_engines_private::HotwordState> state, | |
| 134 const base::string16& audio_history_state, | |
| 135 bool success, | |
| 136 bool logging_enabled); | |
| 137 | |
| 138 ChromeExtensionFunctionDetails chrome_details_; | |
| 139 | |
| 140 // Used to get WeakPtr to self for use on the UI thread. | |
| 141 base::WeakPtrFactory<SearchEnginesPrivateGetHotwordStateFunction> | |
| 142 weak_ptr_factory_; | |
| 143 | |
| 144 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateGetHotwordStateFunction); | |
| 145 }; | |
| 146 | |
| 147 // Implements the chrome.searchEnginesPrivate.optIntoHotwording method. | |
| 148 class SearchEnginesPrivateOptIntoHotwordingFunction | |
| 149 : public UIThreadExtensionFunction { | |
| 150 public: | |
| 151 SearchEnginesPrivateOptIntoHotwordingFunction(); | |
| 152 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.optIntoHotwording", | |
| 153 SEARCHENGINESPRIVATE_OPTINTOHOTWORDING); | |
| 154 | |
| 155 protected: | |
| 156 ~SearchEnginesPrivateOptIntoHotwordingFunction() override; | |
| 157 | |
| 158 // ExtensionFunction overrides. | |
| 159 ResponseAction Run() override; | |
| 160 | |
| 161 private: | |
| 162 ChromeExtensionFunctionDetails chrome_details_; | |
| 163 | |
| 164 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateOptIntoHotwordingFunction); | |
| 165 }; | |
| 166 | |
| 167 } // namespace extensions | |
| 168 | |
| 169 #endif // CHROME_BROWSER_EXTENSIONS_API_SEARCH_ENGINES_PRIVATE_SEARCH_ENGINES_P
RIVATE_API_H_ | |
| OLD | NEW |