OLD | NEW |
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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 }; | 73 }; |
74 | 74 |
75 class OmniboxSendSuggestionsFunction : public ChromeSyncExtensionFunction { | 75 class OmniboxSendSuggestionsFunction : public ChromeSyncExtensionFunction { |
76 public: | 76 public: |
77 DECLARE_EXTENSION_FUNCTION("omnibox.sendSuggestions", OMNIBOX_SENDSUGGESTIONS) | 77 DECLARE_EXTENSION_FUNCTION("omnibox.sendSuggestions", OMNIBOX_SENDSUGGESTIONS) |
78 | 78 |
79 protected: | 79 protected: |
80 virtual ~OmniboxSendSuggestionsFunction() {} | 80 virtual ~OmniboxSendSuggestionsFunction() {} |
81 | 81 |
82 // ExtensionFunction: | 82 // ExtensionFunction: |
83 virtual bool RunImpl() OVERRIDE; | 83 virtual bool RunSync() OVERRIDE; |
84 }; | 84 }; |
85 | 85 |
86 class OmniboxAPI : public BrowserContextKeyedAPI, | 86 class OmniboxAPI : public BrowserContextKeyedAPI, |
87 public ExtensionRegistryObserver { | 87 public ExtensionRegistryObserver { |
88 public: | 88 public: |
89 explicit OmniboxAPI(content::BrowserContext* context); | 89 explicit OmniboxAPI(content::BrowserContext* context); |
90 virtual ~OmniboxAPI(); | 90 virtual ~OmniboxAPI(); |
91 | 91 |
92 // BrowserContextKeyedAPI implementation. | 92 // BrowserContextKeyedAPI implementation. |
93 static BrowserContextKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance(); | 93 static BrowserContextKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 class OmniboxSetDefaultSuggestionFunction : public ChromeSyncExtensionFunction { | 153 class OmniboxSetDefaultSuggestionFunction : public ChromeSyncExtensionFunction { |
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 virtual ~OmniboxSetDefaultSuggestionFunction() {} | 159 virtual ~OmniboxSetDefaultSuggestionFunction() {} |
160 | 160 |
161 // ExtensionFunction: | 161 // ExtensionFunction: |
162 virtual bool RunImpl() OVERRIDE; | 162 virtual bool RunSync() 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_ |
OLD | NEW |