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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 // Sets a non-extension app icon associated with WebContents and fires an | 119 // Sets a non-extension app icon associated with WebContents and fires an |
120 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. | 120 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. |
121 void SetAppIcon(const SkBitmap& app_icon); | 121 void SetAppIcon(const SkBitmap& app_icon); |
122 | 122 |
123 // Sets the factory used to create inline webstore item installers. | 123 // Sets the factory used to create inline webstore item installers. |
124 // Used for testing. Takes ownership of the factory instance. | 124 // Used for testing. Takes ownership of the factory instance. |
125 void SetWebstoreInlineInstallerFactoryForTests( | 125 void SetWebstoreInlineInstallerFactoryForTests( |
126 WebstoreInlineInstallerFactory* factory); | 126 WebstoreInlineInstallerFactory* factory); |
127 | 127 |
128 private: | 128 private: |
129 class InlineInstallObserver; | |
130 | |
129 // Utility function to invoke member functions on all relevant | 131 // Utility function to invoke member functions on all relevant |
130 // ContentRulesRegistries. | 132 // ContentRulesRegistries. |
131 template <class Func> | 133 template <class Func> |
132 void InvokeForContentRulesRegistries(const Func& func); | 134 void InvokeForContentRulesRegistries(const Func& func); |
133 | 135 |
134 // Different types of action when web app info is available. | 136 // Different types of action when web app info is available. |
135 // OnDidGetApplicationInfo uses this to dispatch calls. | 137 // OnDidGetApplicationInfo uses this to dispatch calls. |
136 enum WebAppAction { | 138 enum WebAppAction { |
137 NONE, // No action at all. | 139 NONE, // No action at all. |
138 CREATE_SHORTCUT, // Bring up create application shortcut dialog. | 140 CREATE_SHORTCUT, // Bring up create application shortcut dialog. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 // the extension's image asynchronously. | 193 // the extension's image asynchronously. |
192 void UpdateExtensionAppIcon(const Extension* extension); | 194 void UpdateExtensionAppIcon(const Extension* extension); |
193 | 195 |
194 const Extension* GetExtension(const std::string& extension_app_id); | 196 const Extension* GetExtension(const std::string& extension_app_id); |
195 | 197 |
196 void OnImageLoaded(const gfx::Image& image); | 198 void OnImageLoaded(const gfx::Image& image); |
197 | 199 |
198 // WebstoreStandaloneInstaller::Callback. | 200 // WebstoreStandaloneInstaller::Callback. |
199 void OnInlineInstallComplete(int install_id, | 201 void OnInlineInstallComplete(int install_id, |
200 int return_route_id, | 202 int return_route_id, |
203 const std::string& extension_id, | |
201 bool success, | 204 bool success, |
202 const std::string& error, | 205 const std::string& error, |
203 webstore_install::Result result); | 206 webstore_install::Result result); |
204 | 207 |
205 // ExtensionReenabler::Callback. | 208 // ExtensionReenabler::Callback. |
206 void OnReenableComplete(int install_id, | 209 void OnReenableComplete(int install_id, |
207 int return_route_id, | 210 int return_route_id, |
211 const std::string& extension_id, | |
208 ExtensionReenabler::ReenableResult result); | 212 ExtensionReenabler::ReenableResult result); |
209 | 213 |
210 // content::NotificationObserver. | 214 // content::NotificationObserver. |
211 void Observe(int type, | 215 void Observe(int type, |
212 const content::NotificationSource& source, | 216 const content::NotificationSource& source, |
213 const content::NotificationDetails& details) override; | 217 const content::NotificationDetails& details) override; |
214 | 218 |
215 // Requests application info for the specified page. This is an asynchronous | 219 // Requests application info for the specified page. This is an asynchronous |
216 // request. The delegate is notified by way of OnDidGetApplicationInfo when | 220 // request. The delegate is notified by way of OnDidGetApplicationInfo when |
217 // the data is available. | 221 // the data is available. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 // Creates WebstoreInlineInstaller instances for inline install triggers. | 267 // Creates WebstoreInlineInstaller instances for inline install triggers. |
264 std::unique_ptr<WebstoreInlineInstallerFactory> | 268 std::unique_ptr<WebstoreInlineInstallerFactory> |
265 webstore_inline_installer_factory_; | 269 webstore_inline_installer_factory_; |
266 | 270 |
267 // The reenable prompt for disabled extensions, if any. | 271 // The reenable prompt for disabled extensions, if any. |
268 std::unique_ptr<ExtensionReenabler> extension_reenabler_; | 272 std::unique_ptr<ExtensionReenabler> extension_reenabler_; |
269 | 273 |
270 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 274 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
271 registry_observer_; | 275 registry_observer_; |
272 | 276 |
277 std::map<std::string, std::unique_ptr<InlineInstallObserver>> | |
lazyboy
2016/06/29 21:03:04
Add comment describing this member. or maybe use E
Devlin
2016/06/29 22:32:09
Done. Opted against ExtensionId because a) it woul
lazyboy
2016/06/29 23:10:27
Acknowledged.
| |
278 install_observers_; | |
279 | |
280 // The set of extension ids that are currently being installed. | |
281 std::set<std::string> pending_inline_installations_; | |
282 | |
273 // Vend weak pointers that can be invalidated to stop in-progress loads. | 283 // Vend weak pointers that can be invalidated to stop in-progress loads. |
274 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; | 284 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; |
275 | 285 |
276 // Generic weak ptr factory for posting callbacks. | 286 // Generic weak ptr factory for posting callbacks. |
277 base::WeakPtrFactory<TabHelper> weak_ptr_factory_; | 287 base::WeakPtrFactory<TabHelper> weak_ptr_factory_; |
278 | 288 |
279 DISALLOW_COPY_AND_ASSIGN(TabHelper); | 289 DISALLOW_COPY_AND_ASSIGN(TabHelper); |
280 }; | 290 }; |
281 | 291 |
282 } // namespace extensions | 292 } // namespace extensions |
283 | 293 |
284 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ | 294 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ |
OLD | NEW |