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

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

Issue 4655002: Don't show tabbed options page in OTR browser window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dcheck instead Created 10 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.cc ('k') | no next file » | 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 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;
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698