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

Unified Diff: chrome/browser/extensions/chrome_extensions_browser_client.cc

Issue 381283002: Refactor code that defers extension background page loading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: larger DeferLoadingBackgroundHosts Created 6 years, 5 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 | « no previous file | chrome/browser/extensions/chrome_notification_observer.h » ('j') | extensions/DEPS » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/chrome_extensions_browser_client.cc
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc
index c66d02366f9fe3ccf28297d9e0556fd024d914d4..1a0d6c741163813261d82f81f9fc780855bef4b0 100644
--- a/chrome/browser/extensions/chrome_extensions_browser_client.cc
+++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -162,8 +162,16 @@ bool ChromeExtensionsBrowserClient::DeferLoadingBackgroundHosts(
content::BrowserContext* context) const {
Profile* profile = static_cast<Profile*>(context);
+ // Defer forever if current session is a Guest mode session and current
+ // browser context is *not* off-the-record. Such context is artificial and
+ // background page shouldn't be created in it.
+ if (profile->IsGuestSession() && !profile->IsOffTheRecord())
+ return true;
+
// The profile may not be valid yet if it is still being initialized.
// In that case, defer loading, since it depends on an initialized profile.
+ // Background hosts will be loaded later via NOTIFICATION_PROFILE_CREATED
+ // in ChromeNotificationObserver.
// http://crbug.com/222473
if (!g_browser_process->profile_manager()->IsValidProfile(profile))
return true;
@@ -172,7 +180,8 @@ bool ChromeExtensionsBrowserClient::DeferLoadingBackgroundHosts(
return false;
#else
// There are no browser windows open and the browser process was
- // started to show the app launcher.
+ // started to show the app launcher. Background hosts will be loaded later
+ // via NOTIFICATION_BROWSER_WINDOW_READY in ChromeNotificationObserver.
return chrome::GetTotalBrowserCountForProfile(profile) == 0 &&
CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList);
#endif
@@ -180,11 +189,8 @@ bool ChromeExtensionsBrowserClient::DeferLoadingBackgroundHosts(
bool ChromeExtensionsBrowserClient::IsBackgroundPageAllowed(
content::BrowserContext* context) const {
- // Returns true if current session is Guest mode session and current
- // browser context is *not* off-the-record. Such context is artificial and
- // background page shouldn't be created in it.
- return !static_cast<Profile*>(context)->IsGuestSession() ||
- context->IsOffTheRecord();
+//JAMES remove me
+ return true;
}
scoped_ptr<ExtensionHostDelegate>
« no previous file with comments | « no previous file | chrome/browser/extensions/chrome_notification_observer.h » ('j') | extensions/DEPS » ('J')

Powered by Google App Engine
This is Rietveld 408576698