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 <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // BrowserContextKeyedAPI implementation. | 89 // BrowserContextKeyedAPI implementation. |
90 static BrowserContextKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance(); | 90 static BrowserContextKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance(); |
91 | 91 |
92 // Convenience method to get the OmniboxAPI for a profile. | 92 // Convenience method to get the OmniboxAPI for a profile. |
93 static OmniboxAPI* Get(content::BrowserContext* context); | 93 static OmniboxAPI* Get(content::BrowserContext* context); |
94 | 94 |
95 // KeyedService implementation. | 95 // KeyedService implementation. |
96 void Shutdown() override; | 96 void Shutdown() override; |
97 | 97 |
98 // Returns the icon to display in the omnibox for the given extension. | 98 // Returns the icon to display in the location bar or omnibox popup for the |
| 99 // given extension. |
99 gfx::Image GetOmniboxIcon(const std::string& extension_id); | 100 gfx::Image GetOmniboxIcon(const std::string& extension_id); |
100 | 101 |
101 // Returns the icon to display in the omnibox popup window for the given | |
102 // extension. | |
103 gfx::Image GetOmniboxPopupIcon(const std::string& extension_id); | |
104 | |
105 private: | 102 private: |
106 friend class BrowserContextKeyedAPIFactory<OmniboxAPI>; | 103 friend class BrowserContextKeyedAPIFactory<OmniboxAPI>; |
107 | 104 |
108 typedef std::set<const Extension*> PendingExtensions; | 105 typedef std::set<const Extension*> PendingExtensions; |
109 | 106 |
110 void OnTemplateURLsLoaded(); | 107 void OnTemplateURLsLoaded(); |
111 | 108 |
112 // ExtensionRegistryObserver implementation. | 109 // ExtensionRegistryObserver implementation. |
113 void OnExtensionLoaded(content::BrowserContext* browser_context, | 110 void OnExtensionLoaded(content::BrowserContext* browser_context, |
114 const Extension* extension) override; | 111 const Extension* extension) override; |
(...skipping 14 matching lines...) Expand all Loading... |
129 // List of extensions waiting for the TemplateURLService to Load to | 126 // List of extensions waiting for the TemplateURLService to Load to |
130 // have keywords registered. | 127 // have keywords registered. |
131 PendingExtensions pending_extensions_; | 128 PendingExtensions pending_extensions_; |
132 | 129 |
133 // Listen to extension load, unloaded notifications. | 130 // Listen to extension load, unloaded notifications. |
134 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 131 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
135 extension_registry_observer_; | 132 extension_registry_observer_; |
136 | 133 |
137 // Keeps track of favicon-sized omnibox icons for extensions. | 134 // Keeps track of favicon-sized omnibox icons for extensions. |
138 ExtensionIconManager omnibox_icon_manager_; | 135 ExtensionIconManager omnibox_icon_manager_; |
139 ExtensionIconManager omnibox_popup_icon_manager_; | |
140 | 136 |
141 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_; | 137 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_; |
142 | 138 |
143 DISALLOW_COPY_AND_ASSIGN(OmniboxAPI); | 139 DISALLOW_COPY_AND_ASSIGN(OmniboxAPI); |
144 }; | 140 }; |
145 | 141 |
146 template <> | 142 template <> |
147 void BrowserContextKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies(); | 143 void BrowserContextKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies(); |
148 | 144 |
149 class OmniboxSetDefaultSuggestionFunction : public UIThreadExtensionFunction { | 145 class OmniboxSetDefaultSuggestionFunction : public UIThreadExtensionFunction { |
(...skipping 17 matching lines...) Expand all Loading... |
167 AutocompleteMatch* match); | 163 AutocompleteMatch* match); |
168 | 164 |
169 // This function converts style information populated by the JSON schema | 165 // This function converts style information populated by the JSON schema |
170 // // compiler into an ACMatchClassifications object. | 166 // // compiler into an ACMatchClassifications object. |
171 ACMatchClassifications StyleTypesToACMatchClassifications( | 167 ACMatchClassifications StyleTypesToACMatchClassifications( |
172 const api::omnibox::SuggestResult &suggestion); | 168 const api::omnibox::SuggestResult &suggestion); |
173 | 169 |
174 } // namespace extensions | 170 } // namespace extensions |
175 | 171 |
176 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ | 172 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ |
OLD | NEW |