summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_process_manager.cc
diff options
context:
space:
mode:
authorbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 03:45:08 +0000
committerbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 03:45:08 +0000
commitd72d3a6b57d88fe88d3db71dd17239166a1c59ff (patch)
tree6839eb3eb47e530f28f617c48d7bec2b3f72de82 /chrome/browser/extensions/extension_process_manager.cc
parent325940225f8caffea733f85f209db0ef12d6c0fb (diff)
downloadchromium_src-d72d3a6b57d88fe88d3db71dd17239166a1c59ff.zip
chromium_src-d72d3a6b57d88fe88d3db71dd17239166a1c59ff.tar.gz
chromium_src-d72d3a6b57d88fe88d3db71dd17239166a1c59ff.tar.bz2
Pull shell window stuff out of ExtensionHost and put in ShellWindow
This will let us iterate quicker on ShellWindow and platform apps and let them do things (like have TabContentsWrappers) that normal ExtensionHost windows shouldn't do. BUG=None TEST=Platform apps still work, browser tests. Review URL: https://chromiumcodereview.appspot.com/10119003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_process_manager.cc')
-rw-r--r--chrome/browser/extensions/extension_process_manager.cc51
1 files changed, 24 insertions, 27 deletions
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index 8b606e7..9bc68d6 100644
--- a/chrome/browser/extensions/extension_process_manager.cc
+++ b/chrome/browser/extensions/extension_process_manager.cc
@@ -170,22 +170,6 @@ ExtensionProcessManager::~ExtensionProcessManager() {
DCHECK(background_hosts_.empty());
}
-ExtensionHost* ExtensionProcessManager::CreateShellHost(
- const Extension* extension,
- const GURL& url) {
- DCHECK(extension);
- ExtensionHost* host = new ExtensionHost(extension,
- GetSiteInstanceForURL(url),
- url,
- chrome::VIEW_TYPE_APP_SHELL);
- host->CreateViewWithoutBrowser();
- content::WebContents* host_contents = host->host_contents();
- host_contents->GetMutableRendererPrefs()->browser_handles_all_requests = true;
- host_contents->GetRenderViewHost()->SyncRendererPrefs();
- OnExtensionHostCreated(host, false /* not a background host */);
- return host;
-}
-
void ExtensionProcessManager::EnsureBrowserWhenRequired(
Browser* browser,
content::ViewType view_type) {
@@ -361,6 +345,11 @@ void ExtensionProcessManager::UnregisterRenderViewHost(
if (view == all_extension_views_.end())
return;
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED,
+ content::Source<Profile>(GetProfile()),
+ content::Details<RenderViewHost>(render_view_host));
+
content::ViewType view_type = view->second;
all_extension_views_.erase(view);
@@ -381,18 +370,17 @@ void ExtensionProcessManager::UpdateRegisteredRenderView(
if (view == all_extension_views_.end())
return;
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED,
+ content::Source<Profile>(GetProfile()),
+ content::Details<RenderViewHost>(render_view_host));
+
view->second = render_view_host->GetDelegate()->GetRenderViewType();
// Keep the lazy background page alive as long as any non-background-page
// extension views are visible. Keepalive count balanced in
// UnregisterRenderViewHost.
- if (view->second != content::VIEW_TYPE_INVALID &&
- view->second != chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
- const Extension* extension = GetExtensionForRenderViewHost(
- render_view_host);
- if (extension)
- IncrementLazyKeepaliveCount(extension);
- }
+ IncrementLazyKeepaliveCountForView(render_view_host);
}
SiteInstance* ExtensionProcessManager::GetSiteInstanceForURL(const GURL& url) {
@@ -442,6 +430,18 @@ int ExtensionProcessManager::DecrementLazyKeepaliveCount(
return count;
}
+void ExtensionProcessManager::IncrementLazyKeepaliveCountForView(
+ RenderViewHost* render_view_host) {
+ content::ViewType view_type =
+ render_view_host->GetDelegate()->GetRenderViewType();
+ if (view_type != content::VIEW_TYPE_INVALID &&
+ view_type != chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
+ const Extension* extension = GetExtensionForRenderViewHost(
+ render_view_host);
+ if (extension)
+ IncrementLazyKeepaliveCount(extension);
+ }
+}
void ExtensionProcessManager::OnLazyBackgroundPageIdle(
const std::string& extension_id, int sequence_id) {
@@ -552,7 +552,6 @@ void ExtensionProcessManager::Observe(
ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
if (background_hosts_.erase(host))
ClearBackgroundPageData(host->extension()->id());
- platform_app_hosts_.erase(host);
break;
}
@@ -623,8 +622,6 @@ void ExtensionProcessManager::OnExtensionHostCreated(ExtensionHost* host,
DCHECK_EQ(site_instance_->GetBrowserContext(), host->profile());
if (is_background)
background_hosts_.insert(host);
- if (host->extension()->is_platform_app())
- platform_app_hosts_.insert(host);
}
void ExtensionProcessManager::CloseBackgroundHost(ExtensionHost* host) {
@@ -653,7 +650,7 @@ void ExtensionProcessManager::ClearBackgroundPageData(
for (ExtensionRenderViews::const_iterator it = all_extension_views_.begin();
it != all_extension_views_.end(); ++it) {
if (GetExtensionID(it->first) == extension_id)
- UpdateRegisteredRenderView(it->first);
+ IncrementLazyKeepaliveCountForView(it->first);
}
}