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_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Sets a non-extension app icon associated with WebContents and fires an | 116 // Sets a non-extension app icon associated with WebContents and fires an |
117 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. | 117 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. |
118 void SetAppIcon(const SkBitmap& app_icon); | 118 void SetAppIcon(const SkBitmap& app_icon); |
119 | 119 |
120 // Sets the factory used to create inline webstore item installers. | 120 // Sets the factory used to create inline webstore item installers. |
121 // Used for testing. Takes ownership of the factory instance. | 121 // Used for testing. Takes ownership of the factory instance. |
122 void SetWebstoreInlineInstallerFactoryForTests( | 122 void SetWebstoreInlineInstallerFactoryForTests( |
123 WebstoreInlineInstallerFactory* factory); | 123 WebstoreInlineInstallerFactory* factory); |
124 | 124 |
125 private: | 125 private: |
| 126 class InlineInstallObserver; |
| 127 |
126 // Utility function to invoke member functions on all relevant | 128 // Utility function to invoke member functions on all relevant |
127 // ContentRulesRegistries. | 129 // ContentRulesRegistries. |
128 template <class Func> | 130 template <class Func> |
129 void InvokeForContentRulesRegistries(const Func& func); | 131 void InvokeForContentRulesRegistries(const Func& func); |
130 | 132 |
131 // Different types of action when web app info is available. | 133 // Different types of action when web app info is available. |
132 // OnDidGetApplicationInfo uses this to dispatch calls. | 134 // OnDidGetApplicationInfo uses this to dispatch calls. |
133 enum WebAppAction { | 135 enum WebAppAction { |
134 NONE, // No action at all. | 136 NONE, // No action at all. |
135 CREATE_SHORTCUT, // Bring up create application shortcut dialog. | 137 CREATE_SHORTCUT, // Bring up create application shortcut dialog. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // the extension's image asynchronously. | 185 // the extension's image asynchronously. |
184 void UpdateExtensionAppIcon(const Extension* extension); | 186 void UpdateExtensionAppIcon(const Extension* extension); |
185 | 187 |
186 const Extension* GetExtension(const std::string& extension_app_id); | 188 const Extension* GetExtension(const std::string& extension_app_id); |
187 | 189 |
188 void OnImageLoaded(const gfx::Image& image); | 190 void OnImageLoaded(const gfx::Image& image); |
189 | 191 |
190 // WebstoreStandaloneInstaller::Callback. | 192 // WebstoreStandaloneInstaller::Callback. |
191 void OnInlineInstallComplete(int install_id, | 193 void OnInlineInstallComplete(int install_id, |
192 int return_route_id, | 194 int return_route_id, |
| 195 const std::string& extension_id, |
193 bool success, | 196 bool success, |
194 const std::string& error, | 197 const std::string& error, |
195 webstore_install::Result result); | 198 webstore_install::Result result); |
196 | 199 |
197 // ExtensionReenabler::Callback. | 200 // ExtensionReenabler::Callback. |
198 void OnReenableComplete(int install_id, | 201 void OnReenableComplete(int install_id, |
199 int return_route_id, | 202 int return_route_id, |
| 203 const std::string& extension_id, |
200 ExtensionReenabler::ReenableResult result); | 204 ExtensionReenabler::ReenableResult result); |
201 | 205 |
202 // content::NotificationObserver. | 206 // content::NotificationObserver. |
203 void Observe(int type, | 207 void Observe(int type, |
204 const content::NotificationSource& source, | 208 const content::NotificationSource& source, |
205 const content::NotificationDetails& details) override; | 209 const content::NotificationDetails& details) override; |
206 | 210 |
207 // Requests application info for the specified page. This is an asynchronous | 211 // Requests application info for the specified page. This is an asynchronous |
208 // request. The delegate is notified by way of OnDidGetApplicationInfo when | 212 // request. The delegate is notified by way of OnDidGetApplicationInfo when |
209 // the data is available. | 213 // the data is available. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 256 |
253 std::unique_ptr<BookmarkAppHelper> bookmark_app_helper_; | 257 std::unique_ptr<BookmarkAppHelper> bookmark_app_helper_; |
254 | 258 |
255 // Creates WebstoreInlineInstaller instances for inline install triggers. | 259 // Creates WebstoreInlineInstaller instances for inline install triggers. |
256 std::unique_ptr<WebstoreInlineInstallerFactory> | 260 std::unique_ptr<WebstoreInlineInstallerFactory> |
257 webstore_inline_installer_factory_; | 261 webstore_inline_installer_factory_; |
258 | 262 |
259 // The reenable prompt for disabled extensions, if any. | 263 // The reenable prompt for disabled extensions, if any. |
260 std::unique_ptr<ExtensionReenabler> extension_reenabler_; | 264 std::unique_ptr<ExtensionReenabler> extension_reenabler_; |
261 | 265 |
| 266 // Map of extension id -> InlineInstallObserver for inline installations that |
| 267 // have progress listeners. |
| 268 std::map<std::string, std::unique_ptr<InlineInstallObserver>> |
| 269 install_observers_; |
| 270 |
| 271 // The set of extension ids that are currently being installed. |
| 272 std::set<std::string> pending_inline_installations_; |
| 273 |
262 // Vend weak pointers that can be invalidated to stop in-progress loads. | 274 // Vend weak pointers that can be invalidated to stop in-progress loads. |
263 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; | 275 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; |
264 | 276 |
265 // Generic weak ptr factory for posting callbacks. | 277 // Generic weak ptr factory for posting callbacks. |
266 base::WeakPtrFactory<TabHelper> weak_ptr_factory_; | 278 base::WeakPtrFactory<TabHelper> weak_ptr_factory_; |
267 | 279 |
268 DISALLOW_COPY_AND_ASSIGN(TabHelper); | 280 DISALLOW_COPY_AND_ASSIGN(TabHelper); |
269 }; | 281 }; |
270 | 282 |
271 } // namespace extensions | 283 } // namespace extensions |
272 | 284 |
273 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 285 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
OLD | NEW |