Index: chrome/browser/ui/extensions/extension_install_ui_default.cc |
diff --git a/chrome/browser/ui/extensions/extension_install_ui_default.cc b/chrome/browser/ui/extensions/extension_install_ui_default.cc |
index eff9b8a23fb31632bacfa588ce0ad04ae313d236..9a44267b083025905cfa5f007ca6bd9b569caf61 100644 |
--- a/chrome/browser/ui/extensions/extension_install_ui_default.cc |
+++ b/chrome/browser/ui/extensions/extension_install_ui_default.cc |
@@ -12,6 +12,7 @@ |
#include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
#include "chrome/browser/infobars/confirm_infobar_delegate.h" |
#include "chrome/browser/infobars/infobar_service.h" |
+#include "chrome/browser/prefs/incognito_mode_prefs.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/search/search.h" |
#include "chrome/browser/themes/theme_service.h" |
@@ -55,6 +56,10 @@ namespace { |
bool disable_failure_ui_for_tests = false; |
Browser* FindOrCreateVisibleBrowser(Profile* profile) { |
+ // TODO(mpcomplete): remove this workaround for http://crbug.com/244246 |
+ // after fixing http://crbug.com/38676. |
+ if (!IncognitoModePrefs::CanOpenBrowser(profile)) |
+ return NULL; |
Browser* browser = |
chrome::FindOrCreateTabbedBrowser(profile, chrome::GetActiveDesktop()); |
if (browser->tab_strip_model()->count() == 0) |
@@ -67,7 +72,8 @@ void ShowExtensionInstalledBubble(const extensions::Extension* extension, |
Profile* profile, |
const SkBitmap& icon) { |
Browser* browser = FindOrCreateVisibleBrowser(profile); |
- chrome::ShowExtensionInstalledBubble(extension, browser, icon); |
+ if (browser) |
+ chrome::ShowExtensionInstalledBubble(extension, browser, icon); |
} |
void OnAppLauncherEnabledCompleted(const extensions::Extension* extension, |
@@ -176,16 +182,18 @@ void ExtensionInstallUI::OpenAppInstalledUI(Profile* profile, |
content::Details<const std::string>(&app_id)); |
#else |
Browser* browser = FindOrCreateVisibleBrowser(profile); |
- GURL url(chrome::IsInstantExtendedAPIEnabled() ? |
- chrome::kChromeUIAppsURL : chrome::kChromeUINewTabURL); |
- chrome::NavigateParams params( |
- chrome::GetSingletonTabNavigateParams(browser, url)); |
- chrome::Navigate(¶ms); |
+ if (browser) { |
+ GURL url(chrome::IsInstantExtendedAPIEnabled() ? |
+ chrome::kChromeUIAppsURL : chrome::kChromeUINewTabURL); |
+ chrome::NavigateParams params( |
+ chrome::GetSingletonTabNavigateParams(browser, url)); |
+ chrome::Navigate(¶ms); |
- content::NotificationService::current()->Notify( |
- chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, |
- content::Source<WebContents>(params.target_contents), |
- content::Details<const std::string>(&app_id)); |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, |
+ content::Source<WebContents>(params.target_contents), |
+ content::Details<const std::string>(&app_id)); |
+ } |
#endif |
} |