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

Side by Side Diff: chrome/browser/extensions/api/omnibox/omnibox_api.h

Issue 2344653002: [Extensions] Convert some ChromeSyncExtensionFunctions (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // The user has cleared the keyword, or closed the omnibox popup. This is 67 // The user has cleared the keyword, or closed the omnibox popup. This is
68 // sent at most once in a give input session, after any OnInputChanged events. 68 // sent at most once in a give input session, after any OnInputChanged events.
69 static void OnInputCancelled( 69 static void OnInputCancelled(
70 Profile* profile, const std::string& extension_id); 70 Profile* profile, const std::string& extension_id);
71 71
72 private: 72 private:
73 DISALLOW_COPY_AND_ASSIGN(ExtensionOmniboxEventRouter); 73 DISALLOW_COPY_AND_ASSIGN(ExtensionOmniboxEventRouter);
74 }; 74 };
75 75
76 class OmniboxSendSuggestionsFunction : public ChromeSyncExtensionFunction { 76 class OmniboxSendSuggestionsFunction : public UIThreadExtensionFunction {
77 public: 77 public:
78 DECLARE_EXTENSION_FUNCTION("omnibox.sendSuggestions", OMNIBOX_SENDSUGGESTIONS) 78 DECLARE_EXTENSION_FUNCTION("omnibox.sendSuggestions", OMNIBOX_SENDSUGGESTIONS)
79 79
80 protected: 80 protected:
81 ~OmniboxSendSuggestionsFunction() override {} 81 ~OmniboxSendSuggestionsFunction() override {}
82 82
83 // ExtensionFunction: 83 // ExtensionFunction:
84 bool RunSync() override; 84 ResponseAction Run() override;
85 }; 85 };
86 86
87 class OmniboxAPI : public BrowserContextKeyedAPI, 87 class OmniboxAPI : public BrowserContextKeyedAPI,
88 public ExtensionRegistryObserver { 88 public ExtensionRegistryObserver {
89 public: 89 public:
90 explicit OmniboxAPI(content::BrowserContext* context); 90 explicit OmniboxAPI(content::BrowserContext* context);
91 ~OmniboxAPI() override; 91 ~OmniboxAPI() override;
92 92
93 // BrowserContextKeyedAPI implementation. 93 // BrowserContextKeyedAPI implementation.
94 static BrowserContextKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance(); 94 static BrowserContextKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 ExtensionIconManager omnibox_popup_icon_manager_; 143 ExtensionIconManager omnibox_popup_icon_manager_;
144 144
145 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_; 145 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_;
146 146
147 DISALLOW_COPY_AND_ASSIGN(OmniboxAPI); 147 DISALLOW_COPY_AND_ASSIGN(OmniboxAPI);
148 }; 148 };
149 149
150 template <> 150 template <>
151 void BrowserContextKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies(); 151 void BrowserContextKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies();
152 152
153 class OmniboxSetDefaultSuggestionFunction : public ChromeSyncExtensionFunction { 153 class OmniboxSetDefaultSuggestionFunction : public UIThreadExtensionFunction {
154 public: 154 public:
155 DECLARE_EXTENSION_FUNCTION("omnibox.setDefaultSuggestion", 155 DECLARE_EXTENSION_FUNCTION("omnibox.setDefaultSuggestion",
156 OMNIBOX_SETDEFAULTSUGGESTION) 156 OMNIBOX_SETDEFAULTSUGGESTION)
157 157
158 protected: 158 protected:
159 ~OmniboxSetDefaultSuggestionFunction() override {} 159 ~OmniboxSetDefaultSuggestionFunction() override {}
160 160
161 // ExtensionFunction: 161 // ExtensionFunction:
162 bool RunSync() override; 162 ResponseAction Run() override;
163 }; 163 };
164 164
165 // If the extension has set a custom default suggestion via 165 // If the extension has set a custom default suggestion via
166 // omnibox.setDefaultSuggestion, apply that to |match|. Otherwise, do nothing. 166 // omnibox.setDefaultSuggestion, apply that to |match|. Otherwise, do nothing.
167 void ApplyDefaultSuggestionForExtensionKeyword( 167 void ApplyDefaultSuggestionForExtensionKeyword(
168 Profile* profile, 168 Profile* profile,
169 const TemplateURL* keyword, 169 const TemplateURL* keyword,
170 const base::string16& remaining_input, 170 const base::string16& remaining_input,
171 AutocompleteMatch* match); 171 AutocompleteMatch* match);
172 172
173 // This function converts style information populated by the JSON schema 173 // This function converts style information populated by the JSON schema
174 // // compiler into an ACMatchClassifications object. 174 // // compiler into an ACMatchClassifications object.
175 ACMatchClassifications StyleTypesToACMatchClassifications( 175 ACMatchClassifications StyleTypesToACMatchClassifications(
176 const api::omnibox::SuggestResult &suggestion); 176 const api::omnibox::SuggestResult &suggestion);
177 177
178 } // namespace extensions 178 } // namespace extensions
179 179
180 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ 180 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_api.cc ('k') | chrome/browser/extensions/api/omnibox/omnibox_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698