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

Unified Diff: extensions/browser/process_manager.cc

Issue 182253010: Register a Service Worker when an extension is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to r261176 Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/process_manager.cc
diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc
index a33a948d0da5c35ac47ff787e7ecb2f374868ac6..622e1b5b6b936c7f863152d9b4070f1427a92997 100644
--- a/extensions/browser/process_manager.cc
+++ b/extensions/browser/process_manager.cc
@@ -99,7 +99,8 @@ class IncognitoProcessManager : public ProcessManager {
ProcessManager* original_manager);
virtual ~IncognitoProcessManager() {}
virtual bool CreateBackgroundHost(const Extension* extension,
- const GURL& url) OVERRIDE;
+ const GURL& url,
+ const base::Closure& continuation) OVERRIDE;
virtual SiteInstance* GetSiteInstanceForURL(const GURL& url) OVERRIDE;
private:
@@ -291,7 +292,8 @@ void ProcessManager::RemoveObserver(ProcessManagerObserver* observer) {
}
bool ProcessManager::CreateBackgroundHost(const Extension* extension,
- const GURL& url) {
+ const GURL& url,
+ const base::Closure& continuation) {
// Hosted apps are taken care of from BackgroundContentsService. Ignore them
// here.
if (extension->is_hosted_app() ||
@@ -301,13 +303,16 @@ bool ProcessManager::CreateBackgroundHost(const Extension* extension,
}
// Don't create multiple background hosts for an extension.
- if (GetBackgroundHostForExtension(extension->id()))
+ if (GetBackgroundHostForExtension(extension->id())) {
+ if (!continuation.is_null())
+ continuation.Run();
return true; // TODO(kalman): return false here? It might break things...
+ }
ExtensionHost* host =
new ExtensionHost(extension, GetSiteInstanceForURL(url), url,
VIEW_TYPE_EXTENSION_BACKGROUND_PAGE);
- host->CreateRenderViewSoon();
+ host->CreateRenderViewSoon(continuation);
OnBackgroundHostCreated(host);
return true;
}
@@ -899,12 +904,14 @@ IncognitoProcessManager::IncognitoProcessManager(
content::Source<BrowserContext>(original_context));
}
-bool IncognitoProcessManager::CreateBackgroundHost(const Extension* extension,
- const GURL& url) {
+bool IncognitoProcessManager::CreateBackgroundHost(
+ const Extension* extension,
+ const GURL& url,
+ const base::Closure& continuation) {
if (IncognitoInfo::IsSplitMode(extension)) {
if (ExtensionsBrowserClient::Get()->IsExtensionIncognitoEnabled(
extension->id(), GetBrowserContext()))
- return ProcessManager::CreateBackgroundHost(extension, url);
+ return ProcessManager::CreateBackgroundHost(extension, url, continuation);
} else {
// Do nothing. If an extension is spanning, then its original-profile
// background page is shared with incognito, so we don't create another.

Powered by Google App Engine
This is Rietveld 408576698