Index: chrome/browser/ui/browser_navigator.cc |
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc |
index f7bd4838ecf7e7d2e52ee85c3bd758f45e9b4ad5..89f4278c697ee754d76b1ace3c06e774b2e30ad9 100644 |
--- a/chrome/browser/ui/browser_navigator.cc |
+++ b/chrome/browser/ui/browser_navigator.cc |
@@ -16,6 +16,7 @@ |
#include "chrome/browser/tabs/tab_strip_model.h" |
#include "chrome/browser/tab_contents/tab_contents.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/common/url_constants.h" |
namespace { |
@@ -94,6 +95,28 @@ int GetIndexOfSingletonTab(browser::NavigateParams* params) { |
return -1; |
} |
+// Change some of the navigation parameters based on the particular URL. |
+// Currently this applies to chrome://settings and the bookmark manager, |
+// which we always want to open in a normal (not incognito) window. |
+void AdjustNavigateParamsForURL(browser::NavigateParams* params) { |
+ if (!params->target_contents && |
+ params->url.scheme() == chrome::kChromeUIScheme && |
+ (params->url.host() == chrome::kChromeUISettingsHost || |
+ params->url.host() == chrome::kChromeUIBookmarksHost)) { |
+ Profile* profile = |
+ params->browser ? params->browser->profile() : params->profile; |
+ |
+ if (profile->IsOffTheRecord()) { |
+ profile = profile->GetOriginalProfile(); |
+ |
+ params->disposition = SINGLETON_TAB; |
+ params->profile = profile; |
+ params->browser = Browser::GetOrCreateTabbedBrowser(profile); |
+ params->show_window = true; |
+ } |
+ } |
+} |
+ |
// Returns a Browser that can host the navigation or tab addition specified in |
// |params|. This might just return the same Browser specified in |params|, or |
// some other if that Browser is deemed incompatible. |
@@ -281,6 +304,8 @@ NavigateParams::~NavigateParams() { |
} |
void Navigate(NavigateParams* params) { |
+ AdjustNavigateParamsForURL(params); |
+ |
params->browser = GetBrowserForDisposition(params); |
if (!params->browser) |
return; |