Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: chrome/browser/extensions/tab_helper.h

Issue 2037873002: [Extensions] Observe unloading extensions in the TabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Istiaque's Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "base/scoped_observer.h"
16 #include "chrome/browser/extensions/active_tab_permission_granter.h" 17 #include "chrome/browser/extensions/active_tab_permission_granter.h"
17 #include "chrome/browser/extensions/extension_reenabler.h" 18 #include "chrome/browser/extensions/extension_reenabler.h"
18 #include "chrome/common/extensions/webstore_install_result.h" 19 #include "chrome/common/extensions/webstore_install_result.h"
19 #include "chrome/common/web_application_info.h" 20 #include "chrome/common/web_application_info.h"
20 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/browser/web_contents_observer.h" 23 #include "content/public/browser/web_contents_observer.h"
23 #include "content/public/browser/web_contents_user_data.h" 24 #include "content/public/browser/web_contents_user_data.h"
24 #include "extensions/browser/extension_function_dispatcher.h" 25 #include "extensions/browser/extension_function_dispatcher.h"
26 #include "extensions/browser/extension_registry_observer.h"
25 #include "extensions/browser/script_execution_observer.h" 27 #include "extensions/browser/script_execution_observer.h"
26 #include "extensions/browser/script_executor.h" 28 #include "extensions/browser/script_executor.h"
27 #include "extensions/common/stack_frame.h" 29 #include "extensions/common/stack_frame.h"
28 #include "third_party/skia/include/core/SkBitmap.h" 30 #include "third_party/skia/include/core/SkBitmap.h"
29 31
30 class FaviconDownloader; 32 class FaviconDownloader;
31 33
32 namespace content { 34 namespace content {
33 struct LoadCommittedDetails; 35 struct LoadCommittedDetails;
34 class RenderFrameHost; 36 class RenderFrameHost;
35 } 37 }
36 38
37 namespace gfx { 39 namespace gfx {
38 class Image; 40 class Image;
39 } 41 }
40 42
41 namespace extensions { 43 namespace extensions {
42 class ExtensionActionRunner; 44 class ExtensionActionRunner;
43 class BookmarkAppHelper; 45 class BookmarkAppHelper;
44 class Extension; 46 class Extension;
45 class LocationBarController; 47 class LocationBarController;
46 class WebstoreInlineInstallerFactory; 48 class WebstoreInlineInstallerFactory;
47 49
48 // Per-tab extension helper. Also handles non-extension apps. 50 // Per-tab extension helper. Also handles non-extension apps.
49 class TabHelper : public content::WebContentsObserver, 51 class TabHelper : public content::WebContentsObserver,
50 public extensions::ExtensionFunctionDispatcher::Delegate, 52 public ExtensionFunctionDispatcher::Delegate,
53 public ExtensionRegistryObserver,
51 public base::SupportsWeakPtr<TabHelper>, 54 public base::SupportsWeakPtr<TabHelper>,
52 public content::NotificationObserver, 55 public content::NotificationObserver,
53 public content::WebContentsUserData<TabHelper> { 56 public content::WebContentsUserData<TabHelper> {
54 public: 57 public:
55 ~TabHelper() override; 58 ~TabHelper() override;
56 59
57 void CreateApplicationShortcuts(); 60 void CreateApplicationShortcuts();
58 void CreateHostedAppFromWebContents(); 61 void CreateHostedAppFromWebContents();
59 bool CanCreateApplicationShortcuts() const; 62 bool CanCreateApplicationShortcuts() const;
60 bool CanCreateBookmarkApp() const; 63 bool CanCreateBookmarkApp() const;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 bool OnMessageReceived(const IPC::Message& message, 156 bool OnMessageReceived(const IPC::Message& message,
154 content::RenderFrameHost* render_frame_host) override; 157 content::RenderFrameHost* render_frame_host) override;
155 void DidCloneToNewWebContents( 158 void DidCloneToNewWebContents(
156 content::WebContents* old_web_contents, 159 content::WebContents* old_web_contents,
157 content::WebContents* new_web_contents) override; 160 content::WebContents* new_web_contents) override;
158 161
159 // extensions::ExtensionFunctionDispatcher::Delegate overrides. 162 // extensions::ExtensionFunctionDispatcher::Delegate overrides.
160 extensions::WindowController* GetExtensionWindowController() const override; 163 extensions::WindowController* GetExtensionWindowController() const override;
161 content::WebContents* GetAssociatedWebContents() const override; 164 content::WebContents* GetAssociatedWebContents() const override;
162 165
166 // ExtensionRegistryObserver:
167 void OnExtensionUnloaded(content::BrowserContext* browser_context,
168 const Extension* extension,
169 UnloadedExtensionInfo::Reason reason) override;
170
163 // Message handlers. 171 // Message handlers.
164 void OnDidGetWebApplicationInfo(const WebApplicationInfo& info); 172 void OnDidGetWebApplicationInfo(const WebApplicationInfo& info);
165 void OnInlineWebstoreInstall(content::RenderFrameHost* host, 173 void OnInlineWebstoreInstall(content::RenderFrameHost* host,
166 int install_id, 174 int install_id,
167 int return_route_id, 175 int return_route_id,
168 const std::string& webstore_item_id, 176 const std::string& webstore_item_id,
169 const GURL& requestor_url, 177 const GURL& requestor_url,
170 int listeners_mask); 178 int listeners_mask);
171 void OnGetAppInstallState(content::RenderFrameHost* host, 179 void OnGetAppInstallState(content::RenderFrameHost* host,
172 const GURL& requestor_url, 180 const GURL& requestor_url,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 260
253 std::unique_ptr<BookmarkAppHelper> bookmark_app_helper_; 261 std::unique_ptr<BookmarkAppHelper> bookmark_app_helper_;
254 262
255 // Creates WebstoreInlineInstaller instances for inline install triggers. 263 // Creates WebstoreInlineInstaller instances for inline install triggers.
256 std::unique_ptr<WebstoreInlineInstallerFactory> 264 std::unique_ptr<WebstoreInlineInstallerFactory>
257 webstore_inline_installer_factory_; 265 webstore_inline_installer_factory_;
258 266
259 // The reenable prompt for disabled extensions, if any. 267 // The reenable prompt for disabled extensions, if any.
260 std::unique_ptr<ExtensionReenabler> extension_reenabler_; 268 std::unique_ptr<ExtensionReenabler> extension_reenabler_;
261 269
270 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
271 registry_observer_;
272
262 // Vend weak pointers that can be invalidated to stop in-progress loads. 273 // Vend weak pointers that can be invalidated to stop in-progress loads.
263 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_; 274 base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_;
264 275
265 // Generic weak ptr factory for posting callbacks. 276 // Generic weak ptr factory for posting callbacks.
266 base::WeakPtrFactory<TabHelper> weak_ptr_factory_; 277 base::WeakPtrFactory<TabHelper> weak_ptr_factory_;
267 278
268 DISALLOW_COPY_AND_ASSIGN(TabHelper); 279 DISALLOW_COPY_AND_ASSIGN(TabHelper);
269 }; 280 };
270 281
271 } // namespace extensions 282 } // namespace extensions
272 283
273 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_ 284 #endif // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698