diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 01:48:24 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 01:48:24 +0000 |
commit | 8f51a1c8674ecb5c5e8a0499e41b587c82f73334 (patch) | |
tree | dbf42509e7b75944e4a7c87c257ea53f6cd90641 /chrome/browser/extensions | |
parent | 552a01e6eef2a1344c0c80285732bcd0661d9868 (diff) | |
download | chromium_src-8f51a1c8674ecb5c5e8a0499e41b587c82f73334.zip chromium_src-8f51a1c8674ecb5c5e8a0499e41b587c82f73334.tar.gz chromium_src-8f51a1c8674ecb5c5e8a0499e41b587c82f73334.tar.bz2 |
Change EXTENSION_PROCESS_CREATED observers to use EXTENSION_HOST_CREATED.
Change EXTENSION_HOST_CREATED to be fired on RenderViewReady.
Remove the EXTENSION_PROCESS_CREATED notification.
This is related to fixing bug 71629, in particular, making the correct things appear in the task manager when the extension host reuses a process. This affects the new reload path (but only for unpacked extensions), but it's also visible when a process isn't created for a popup in lots-of-tabs situations.
The extension settings page (the other observer) already listens to enough notifications that it updates properly (too many of them, but that's another story -- see bug).
BUG=102950
TEST=TaskManagerBrowserTest.* and also: Open Task Manager. Open an extension popup, extension notification, and extension page in a tab; check that they all appear. Kill an extension with a background page and reload it from the notification bubble; check that it reappears.
Review URL: http://codereview.chromium.org/8480007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109163 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
5 files changed, 8 insertions, 20 deletions
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index c49be53..1631724 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -466,11 +466,6 @@ void ExtensionBrowserTest::Observe( MessageLoopForUI::current()->Quit(); break; - case chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED: - VLOG(1) << "Got EXTENSION_PROCESS_CREATED notification."; - MessageLoopForUI::current()->Quit(); - break; - case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: VLOG(1) << "Got EXTENSION_PROCESS_TERMINATED notification."; MessageLoopForUI::current()->Quit(); diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 8b2eba1..b718c62 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -148,10 +148,6 @@ ExtensionHost::ExtensionHost(const Extension* extension, if (enable_dom_automation_) render_view_host_->AllowBindings(content::BINDINGS_POLICY_DOM_AUTOMATION); - // Listen for when the render process' handle is available so we can add it - // to the task manager then. - registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::Source<RenderProcessHost>(render_process_host())); // Listen for when an extension is unloaded from the same profile, as it may // be the same extension that this points to. registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, @@ -297,12 +293,6 @@ void ExtensionHost::Observe(int type, IsBackgroundPageReady(extension_)); NavigateToURL(url_); break; - case content::NOTIFICATION_RENDERER_PROCESS_CREATED: - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED, - content::Source<Profile>(profile_), - content::Details<ExtensionHost>(this)); - break; case chrome::NOTIFICATION_EXTENSION_UNLOADED: // The extension object will be deleted after this notification has been // sent. NULL it out so that dirty pointer issues don't arise in cases @@ -809,3 +799,10 @@ void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); } } + +void ExtensionHost::RenderViewReady(RenderViewHost* render_view_host) { + content::NotificationService::current()->Notify( + chrome::NOTIFICATION_EXTENSION_HOST_CREATED, + content::Source<Profile>(profile_), + content::Details<ExtensionHost>(this)); +} diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index 0adc57d..fca8504 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -116,6 +116,7 @@ class ExtensionHost : public RenderViewHostDelegate, virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual const GURL& GetURL() const OVERRIDE; virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; + virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE; virtual content::ViewType GetRenderViewType() const OVERRIDE; virtual void RenderViewGone(RenderViewHost* render_view_host, base::TerminationStatus status, diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index b79a35e..cf9b70b 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -534,10 +534,6 @@ void ExtensionProcessManager::OnExtensionHostCreated(ExtensionHost* host, all_hosts_.insert(host); if (is_background) background_hosts_.insert(host); - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_EXTENSION_HOST_CREATED, - content::Source<ExtensionProcessManager>(this), - content::Details<ExtensionHost>(host)); } void ExtensionProcessManager::CloseBackgroundHost(ExtensionHost* host) { diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h index d99ee09..476c053 100644 --- a/chrome/browser/extensions/extension_process_manager.h +++ b/chrome/browser/extensions/extension_process_manager.h @@ -163,7 +163,6 @@ class ExtensionProcessManager : public content::NotificationObserver { typedef std::set<RenderViewHost*> RenderViewHostSet; RenderViewHostSet all_extension_views_; - private: // Close the given |host| iff it's a background page. void CloseBackgroundHost(ExtensionHost* host); |