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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SEARCH_ENGINES_PRIVATE_SEARCH_ENGINES_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_SEARCH_ENGINES_PRIVATE_SEARCH_ENGINES_PRIVATE_API_H_
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"
15 namespace extensions
{
17 // Implements the chrome.searchEnginesPrivate.getSearchEngines method.
18 class SearchEnginesPrivateGetSearchEnginesFunction
19 : public UIThreadExtensionFunction
{
21 SearchEnginesPrivateGetSearchEnginesFunction();
22 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.getSearchEngines",
23 SEARCHENGINESPRIVATE_GETSEARCHENGINES
);
26 ~SearchEnginesPrivateGetSearchEnginesFunction() override
;
28 // ExtensionFunction overrides.
29 ResponseAction
Run() override
;
32 ChromeExtensionFunctionDetails chrome_details_
;
34 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateGetSearchEnginesFunction
);
37 // Implements the chrome.searchEnginesPrivate.setSelectedSearchEngine method.
38 class SearchEnginesPrivateSetSelectedSearchEngineFunction
39 : public UIThreadExtensionFunction
{
41 SearchEnginesPrivateSetSelectedSearchEngineFunction();
42 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.setSelectedSearchEngine",
43 SEARCHENGINESPRIVATE_SETSELECTEDSEARCHENGINE
);
46 ~SearchEnginesPrivateSetSelectedSearchEngineFunction() override
;
48 // AsyncExtensionFunction overrides.
49 ResponseAction
Run() override
;
52 ChromeExtensionFunctionDetails chrome_details_
;
54 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateSetSelectedSearchEngineFunction
);
57 // Implements the chrome.searchEnginesPrivate.addOtherSearchEngine method.
58 class SearchEnginesPrivateAddOtherSearchEngineFunction
59 : public UIThreadExtensionFunction
{
61 SearchEnginesPrivateAddOtherSearchEngineFunction();
62 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.addOtherSearchEngine",
63 SEARCHENGINESPRIVATE_ADDOTHERSEARCHENGINE
);
66 ~SearchEnginesPrivateAddOtherSearchEngineFunction() override
;
68 // ExtensionFunction overrides.
69 ResponseAction
Run() override
;
72 ChromeExtensionFunctionDetails chrome_details_
;
74 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateAddOtherSearchEngineFunction
);
77 // Implements the chrome.searchEnginesPrivate.updateSearchEngine method.
78 class SearchEnginesPrivateUpdateSearchEngineFunction
79 : public UIThreadExtensionFunction
{
81 SearchEnginesPrivateUpdateSearchEngineFunction();
82 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.updateSearchEngine",
83 SEARCHENGINESPRIVATE_UPDATESEARCHENGINE
);
86 ~SearchEnginesPrivateUpdateSearchEngineFunction() override
;
88 // ExtensionFunction overrides.
89 ResponseAction
Run() override
;
92 ChromeExtensionFunctionDetails chrome_details_
;
94 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateUpdateSearchEngineFunction
);
97 // Implements the chrome.searchEnginesPrivate.removeSearchEngine method.
98 class SearchEnginesPrivateRemoveSearchEngineFunction
99 : public UIThreadExtensionFunction
{
101 SearchEnginesPrivateRemoveSearchEngineFunction();
102 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.removeSearchEngine",
103 SEARCHENGINESPRIVATE_REMOVESEARCHENGINE
);
106 ~SearchEnginesPrivateRemoveSearchEngineFunction() override
;
108 // ExtensionFunction overrides.
109 ResponseAction
Run() override
;
112 ChromeExtensionFunctionDetails chrome_details_
;
114 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateRemoveSearchEngineFunction
);
117 // Implements the chrome.searchEnginesPrivate.getHotwordState method.
118 class SearchEnginesPrivateGetHotwordStateFunction
119 : public UIThreadExtensionFunction
{
121 SearchEnginesPrivateGetHotwordStateFunction();
122 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.getHotwordState",
123 SEARCHENGINESPRIVATE_GETHOTWORDSTATE
);
126 ~SearchEnginesPrivateGetHotwordStateFunction() override
;
128 // ExtensionFunction overrides.
129 ResponseAction
Run() override
;
132 void OnAudioHistoryChecked(
133 scoped_ptr
<api::search_engines_private::HotwordState
> state
,
134 const base::string16
& audio_history_state
,
136 bool logging_enabled
);
138 ChromeExtensionFunctionDetails chrome_details_
;
140 // Used to get WeakPtr to self for use on the UI thread.
141 base::WeakPtrFactory
<SearchEnginesPrivateGetHotwordStateFunction
>
144 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateGetHotwordStateFunction
);
147 // Implements the chrome.searchEnginesPrivate.optIntoHotwording method.
148 class SearchEnginesPrivateOptIntoHotwordingFunction
149 : public UIThreadExtensionFunction
{
151 SearchEnginesPrivateOptIntoHotwordingFunction();
152 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.optIntoHotwording",
153 SEARCHENGINESPRIVATE_OPTINTOHOTWORDING
);
156 ~SearchEnginesPrivateOptIntoHotwordingFunction() override
;
158 // ExtensionFunction overrides.
159 ResponseAction
Run() override
;
162 ChromeExtensionFunctionDetails chrome_details_
;
164 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateOptIntoHotwordingFunction
);
167 } // namespace extensions
169 #endif // CHROME_BROWSER_EXTENSIONS_API_SEARCH_ENGINES_PRIVATE_SEARCH_ENGINES_PRIVATE_API_H_