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

Unified Diff: chrome/browser/ui/extensions/extension_install_ui_default.cc

Issue 15859011: Don't show post extension install bubbles when incognito mode is forced. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved incognito_mode_prefs from another CL Created 7 years, 7 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 | « chrome/browser/prefs/incognito_mode_prefs.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(&params);
+ if (browser) {
+ GURL url(chrome::IsInstantExtendedAPIEnabled() ?
+ chrome::kChromeUIAppsURL : chrome::kChromeUINewTabURL);
+ chrome::NavigateParams params(
+ chrome::GetSingletonTabNavigateParams(browser, url));
+ chrome::Navigate(&params);
- 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
}
« no previous file with comments | « chrome/browser/prefs/incognito_mode_prefs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698