diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 23:33:08 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 23:33:08 +0000 |
commit | eca25813c3bd229f1a7923219d94d53bf71ac0bd (patch) | |
tree | a4753edfa57b572604f2abd0bdca45166d9678d7 /chrome/browser/ui/browser_navigator.cc | |
parent | 98546a1e47d36c0fc96d45c45eb9e95e7d24273e (diff) | |
download | chromium_src-eca25813c3bd229f1a7923219d94d53bf71ac0bd.zip chromium_src-eca25813c3bd229f1a7923219d94d53bf71ac0bd.tar.gz chromium_src-eca25813c3bd229f1a7923219d94d53bf71ac0bd.tar.bz2 |
Don't show tabbed options page or bookmarks manager in OTR browser window.
Instead, always show it in a normal window (creating one if necessary).
The change is made in BrowserNavigator because that is the control flow bottleneck.
BUG=61813
TEST=manual
Review URL: http://codereview.chromium.org/4655002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_navigator.cc')
-rw-r--r-- | chrome/browser/ui/browser_navigator.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index f7bd483..89f4278 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; |