| 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 #include <vector> | 10 #include <vector> |
| (...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 content::NotificationObserver { | 87 public content::NotificationObserver { |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 class OmniboxSetDefaultSuggestionFunction : public ChromeSyncExtensionFunction { | 148 class OmniboxSetDefaultSuggestionFunction : public ChromeSyncExtensionFunction { |
| 149 public: | 149 public: |
| 150 DECLARE_EXTENSION_FUNCTION("omnibox.setDefaultSuggestion", | 150 DECLARE_EXTENSION_FUNCTION("omnibox.setDefaultSuggestion", |
| 151 OMNIBOX_SETDEFAULTSUGGESTION) | 151 OMNIBOX_SETDEFAULTSUGGESTION) |
| 152 | 152 |
| 153 protected: | 153 protected: |
| 154 virtual ~OmniboxSetDefaultSuggestionFunction() {} | 154 virtual ~OmniboxSetDefaultSuggestionFunction() {} |
| 155 | 155 |
| 156 // ExtensionFunction: | 156 // ExtensionFunction: |
| 157 virtual bool RunImpl() OVERRIDE; | 157 virtual bool RunSync() OVERRIDE; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 // If the extension has set a custom default suggestion via | 160 // If the extension has set a custom default suggestion via |
| 161 // omnibox.setDefaultSuggestion, apply that to |match|. Otherwise, do nothing. | 161 // omnibox.setDefaultSuggestion, apply that to |match|. Otherwise, do nothing. |
| 162 void ApplyDefaultSuggestionForExtensionKeyword( | 162 void ApplyDefaultSuggestionForExtensionKeyword( |
| 163 Profile* profile, | 163 Profile* profile, |
| 164 const TemplateURL* keyword, | 164 const TemplateURL* keyword, |
| 165 const base::string16& remaining_input, | 165 const base::string16& remaining_input, |
| 166 AutocompleteMatch* match); | 166 AutocompleteMatch* match); |
| 167 | 167 |
| 168 // This function converts style information populated by the JSON schema | 168 // This function converts style information populated by the JSON schema |
| 169 // // compiler into an ACMatchClassifications object. | 169 // // compiler into an ACMatchClassifications object. |
| 170 ACMatchClassifications StyleTypesToACMatchClassifications( | 170 ACMatchClassifications StyleTypesToACMatchClassifications( |
| 171 const api::omnibox::SuggestResult &suggestion); | 171 const api::omnibox::SuggestResult &suggestion); |
| 172 | 172 |
| 173 } // namespace extensions | 173 } // namespace extensions |
| 174 | 174 |
| 175 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ | 175 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ |
| OLD | NEW |