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

Unified Diff: chrome/browser/ui/browser_navigator.cc

Issue 8588013: Fix crash in SyncSetupWizard::IsVisible() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 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
« no previous file with comments | « chrome/browser/ui/browser_navigator.h ('k') | chrome/browser/ui/browser_navigator_browsertest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_navigator.cc
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index ad0a54163d3cd15e40b1e1e328da00627fd02dd4..555da223f43ef0e8d089dbafd98a3701471f80f9 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -71,36 +71,37 @@ bool CompareURLsWithReplacements(
}
// Change some of the navigation parameters based on the particular URL.
-// Currently this applies to chrome://settings, the bookmark manager,
-// and chrome://extensions, which we always want to open in a normal
-// (not incognito) window. Guest session is an exception.
-// chrome://extensions is on the list because it redirects to
-// chrome://settings.
+// Currently this applies to some chrome:// pages which we always want to open
+// in a non-incognito window. Note that even though a ChromeOS guest session is
+// technically an incognito window, these URLs are allowed.
// Returns true on success. Otherwise, if changing params leads the browser into
// an erroneous state, returns false.
bool AdjustNavigateParamsForURL(browser::NavigateParams* params) {
- if (!params->target_contents &&
- browser::IsURLAllowedInIncognito(params->url)) {
- Profile* profile =
- params->browser ? params->browser->profile() : params->profile;
-
- if ((profile->IsOffTheRecord() && !Profile::IsGuestSession()) ||
- params->disposition == OFF_THE_RECORD) {
- profile = profile->GetOriginalProfile();
-
- // If incognito is forced, we punt.
- PrefService* prefs = profile->GetPrefs();
- if (prefs && IncognitoModePrefs::GetAvailability(prefs) ==
- IncognitoModePrefs::FORCED) {
- return false;
- }
+ if (params->target_contents != NULL ||
+ browser::IsURLAllowedInIncognito(params->url) ||
+ Profile::IsGuestSession()) {
+ return true;
+ }
+
+ Profile* profile =
+ params->browser ? params->browser->profile() : params->profile;
- params->disposition = SINGLETON_TAB;
- params->profile = profile;
- params->browser = Browser::GetOrCreateTabbedBrowser(profile);
- params->window_action = browser::NavigateParams::SHOW_WINDOW;
+ if (profile->IsOffTheRecord() || params->disposition == OFF_THE_RECORD) {
+ profile = profile->GetOriginalProfile();
+
+ // If incognito is forced, we punt.
+ PrefService* prefs = profile->GetPrefs();
+ if (prefs && IncognitoModePrefs::GetAvailability(prefs) ==
+ IncognitoModePrefs::FORCED) {
+ return false;
}
+
+ params->disposition = SINGLETON_TAB;
+ params->profile = profile;
+ params->browser = Browser::GetOrCreateTabbedBrowser(profile);
+ params->window_action = browser::NavigateParams::SHOW_WINDOW;
}
+
return true;
}
@@ -632,10 +633,15 @@ int GetIndexOfSingletonTab(browser::NavigateParams* params) {
}
bool IsURLAllowedInIncognito(const GURL& url) {
- return url.scheme() == chrome::kChromeUIScheme &&
+ // Most URLs are allowed in incognito; the following are exceptions.
+ // chrome://extensions is on the list because it redirects to
+ // chrome://settings.
+
+ return !(url.scheme() == chrome::kChromeUIScheme &&
(url.host() == chrome::kChromeUISettingsHost ||
url.host() == chrome::kChromeUIExtensionsHost ||
- url.host() == chrome::kChromeUIBookmarksHost);
+ url.host() == chrome::kChromeUIBookmarksHost ||
+ url.host() == chrome::kChromeUISyncPromoHost));
}
} // namespace browser
« no previous file with comments | « chrome/browser/ui/browser_navigator.h ('k') | chrome/browser/ui/browser_navigator_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698