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

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: Test passes! Don't know if it's right though 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
« no previous file with comments | « extensions/browser/process_manager.h ('k') | extensions/browser/service_worker_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/process_manager.cc
diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc
index 3b1841dc0bcd2fbb26b73ce1a550ff1fe98f9b16..02a8e3e393efee0d52e46fcc82df7f7e5a4f8fe9 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:
@@ -283,7 +284,8 @@ const ProcessManager::ViewSet ProcessManager::GetAllViews() const {
}
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() ||
@@ -293,13 +295,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;
}
@@ -890,12 +895,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.
« no previous file with comments | « extensions/browser/process_manager.h ('k') | extensions/browser/service_worker_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698