Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / search_engines_private / search_engines_private_api.h
blobce45bf1e2e50d320f4a6b75bf5bbeab527fa25f2
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_
8 #include <string>
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 {
20 public:
21 SearchEnginesPrivateGetSearchEnginesFunction();
22 DECLARE_EXTENSION_FUNCTION("searchEnginesPrivate.getSearchEngines",
23 SEARCHENGINESPRIVATE_GETSEARCHENGINES);
25 protected:
26 ~SearchEnginesPrivateGetSearchEnginesFunction() override;
28 // ExtensionFunction overrides.
29 ResponseAction Run() override;
31 private:
32 ChromeExtensionFunctionDetails chrome_details_;
34 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateGetSearchEnginesFunction);
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);
45 protected:
46 ~SearchEnginesPrivateSetSelectedSearchEngineFunction() override;
48 // AsyncExtensionFunction overrides.
49 ResponseAction Run() override;
51 private:
52 ChromeExtensionFunctionDetails chrome_details_;
54 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateSetSelectedSearchEngineFunction);
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);
65 protected:
66 ~SearchEnginesPrivateAddOtherSearchEngineFunction() override;
68 // ExtensionFunction overrides.
69 ResponseAction Run() override;
71 private:
72 ChromeExtensionFunctionDetails chrome_details_;
74 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateAddOtherSearchEngineFunction);
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);
85 protected:
86 ~SearchEnginesPrivateUpdateSearchEngineFunction() override;
88 // ExtensionFunction overrides.
89 ResponseAction Run() override;
91 private:
92 ChromeExtensionFunctionDetails chrome_details_;
94 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateUpdateSearchEngineFunction);
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);
105 protected:
106 ~SearchEnginesPrivateRemoveSearchEngineFunction() override;
108 // ExtensionFunction overrides.
109 ResponseAction Run() override;
111 private:
112 ChromeExtensionFunctionDetails chrome_details_;
114 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateRemoveSearchEngineFunction);
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);
125 protected:
126 ~SearchEnginesPrivateGetHotwordStateFunction() override;
128 // ExtensionFunction overrides.
129 ResponseAction Run() override;
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);
138 ChromeExtensionFunctionDetails chrome_details_;
140 // Used to get WeakPtr to self for use on the UI thread.
141 base::WeakPtrFactory<SearchEnginesPrivateGetHotwordStateFunction>
142 weak_ptr_factory_;
144 DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateGetHotwordStateFunction);
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);
155 protected:
156 ~SearchEnginesPrivateOptIntoHotwordingFunction() override;
158 // ExtensionFunction overrides.
159 ResponseAction Run() override;
161 private:
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_