Index: chrome/browser/ui/browser_navigator.cc |
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc |
index 54edd144c7823c7e45588c0e5ad516685f562ace..d91b5efb8b5b5c2f83a72c339cd7c172cf7bd037 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,33 @@ 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) { |
+ bool isChromeUrl = params->url.scheme() == chrome::kChromeUIScheme; |
+ bool isSettingsPage = isChromeUrl && |
+ params->url.host() == chrome::kChromeUISettingsHost; |
+ bool isBookmarksManager = isChromeUrl && |
+ params->url.host() == chrome::kChromeUIBookmarksHost; |
+ |
+ if (!params->target_contents && (isSettingsPage || isBookmarksManager)) { |
Peter Kasting
2010/11/12 19:49:01
Nit: It seems like it'd be simpler (and less redun
Evan Stade
2010/11/12 20:47:12
ok
|
+ Profile* profile = |
+ params->browser ? params->browser->profile() : params->profile; |
+ |
+ if (profile->IsOffTheRecord()) { |
+ profile = profile->GetOriginalProfile(); |
+ Browser* browser = Browser::GetOrCreateTabbedBrowser(profile); |
+ |
+ params->disposition = NEW_FOREGROUND_TAB; |
+ params->profile = profile; |
+ params->browser = browser; |
+ params->tabstrip_add_types = TabStripModel::ADD_SELECTED; |
+ 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 +309,8 @@ NavigateParams::~NavigateParams() { |
} |
void Navigate(NavigateParams* params) { |
+ AdjustNavigateParamsForURL(params); |
+ |
params->browser = GetBrowserForDisposition(params); |
if (!params->browser) |
return; |