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

Unified Diff: chrome/browser/dom_ui/options/options_ui.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: pkasting nits 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 | « no previous file | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('j') | chrome/browser/ui/browser_navigator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/options/options_ui.cc
diff --git a/chrome/browser/dom_ui/options/options_ui.cc b/chrome/browser/dom_ui/options/options_ui.cc
index 0ee7188ab10dad1fc7a045ba4ca9f83be8c20135..61ba7acc8572884c0525d2ec19234481ecf4c978 100644
--- a/chrome/browser/dom_ui/options/options_ui.cc
+++ b/chrome/browser/dom_ui/options/options_ui.cc
@@ -240,6 +240,24 @@ RefCountedMemory* OptionsUI::GetFaviconResourceBytes() {
}
void OptionsUI::InitializeHandlers() {
+ // Don't open a settings tab in an OTR profile. For most cases, we won't
+ // get this far as browser::Navigate() will redirect the request to a
+ // non-OTR profile, but there are some corner cases where a chrome://settings
+ // load can slip through (such as dragging an anchor link to the tab strip).
+ Profile* profile = GetProfile();
+ if (profile->IsOffTheRecord()) {
+ // Re-open the tab in a normal window.
+ Browser* normal_browser = Browser::GetOrCreateTabbedBrowser(
+ profile->GetOriginalProfile());
+ normal_browser->AddSelectedTabWithURL(GURL(chrome::kChromeUISettingsURL),
+ PageTransition::LINK);
+
+ // Close this tab.
+ Browser* otr_browser = Browser::GetOrCreateTabbedBrowser(profile);
+ otr_browser->CloseTabContents(tab_contents());
+ return;
Ben Goodger (Google) 2010/11/15 18:21:04 Why are you also handling this here when you did s
Evan Stade 2010/11/15 18:51:47 see CL description
Ben Goodger (Google) 2010/11/15 18:57:19 Can you make the drag and drop handling code use b
+ }
+
std::vector<DOMMessageHandler*>::iterator iter;
for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) {
(static_cast<OptionsPageUIHandler*>(*iter))->Initialize();
« no previous file with comments | « no previous file | chrome/browser/gtk/tabs/tab_strip_gtk.cc » ('j') | chrome/browser/ui/browser_navigator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698