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

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

Issue 57813003: Reland: Convert ExtensionProcessManager to BrowserContext, part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable on windows Created 7 years, 1 month 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: 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 e2ba427acde33b6ebae3c2c58bc7a74b02a703fd..f2d2c8fe6ea59917437f376193c751a06cf35029 100644
--- a/chrome/browser/extensions/chrome_extensions_browser_client.cc
+++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -4,8 +4,12 @@
#include "chrome/browser/extensions/chrome_extensions_browser_client.h"
+#include "base/command_line.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/common/chrome_switches.h"
namespace extensions {
@@ -41,6 +45,31 @@ content::BrowserContext* ChromeExtensionsBrowserClient::GetOffTheRecordContext(
return static_cast<Profile*>(context)->GetOffTheRecordProfile();
}
+content::BrowserContext* ChromeExtensionsBrowserClient::GetOriginalContext(
+ content::BrowserContext* context) {
+ return static_cast<Profile*>(context)->GetOriginalProfile();
+}
+
+bool ChromeExtensionsBrowserClient::DeferLoadingBackgroundHosts(
+ content::BrowserContext* context) const {
+ Profile* profile = static_cast<Profile*>(context);
+
+ // 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.
+ // http://crbug.com/222473
+ if (!g_browser_process->profile_manager()->IsValidProfile(profile))
+ return true;
+
+#if defined(OS_ANDROID)
+ return false;
+#else
+ // There are no browser windows open and the browser process was
+ // started to show the app launcher.
+ return chrome::GetTotalBrowserCountForProfile(profile) == 0 &&
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList);
+#endif
+}
+
// static
ChromeExtensionsBrowserClient* ChromeExtensionsBrowserClient::GetInstance() {
return g_client.Pointer();

Powered by Google App Engine
This is Rietveld 408576698