Chromium Code Reviews| 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..d616d3e0130399c555a6553848f1fbd99ac70565 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,30 @@ 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(); |
| + Browser* browser = Browser::GetOrCreateTabbedBrowser(profile); |
|
Ben Goodger (Google)
2010/11/15 18:21:04
nix this line
|
| + |
| + params->disposition = NEW_FOREGROUND_TAB; |
|
sadrul
2010/11/12 21:46:54
I think it should be SINGLETON_TAB here? In additi
Evan Stade
2010/11/12 23:53:41
oh yea, I think you're right.
|
| + params->profile = profile; |
| + params->browser = browser; |
|
Ben Goodger (Google)
2010/11/15 18:21:04
params->browser = Browser::GetOrCreateTabbedBrowse
Evan Stade
2010/11/15 18:51:47
Done.
|
| + params->tabstrip_add_types = TabStripModel::ADD_SELECTED; |
|
Ben Goodger (Google)
2010/11/15 18:21:04
This should be inferred from NEW_FOREGROUND_TAB
sadrul
2010/11/15 18:41:00
I believe it should be SINGLETON_TAB (as noted ear
|
| + 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 +306,8 @@ NavigateParams::~NavigateParams() { |
| } |
| void Navigate(NavigateParams* params) { |
| + AdjustNavigateParamsForURL(params); |
| + |
| params->browser = GetBrowserForDisposition(params); |
| if (!params->browser) |
| return; |