| 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();
|
|
|