| 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;
|
| + }
|
| +
|
| std::vector<DOMMessageHandler*>::iterator iter;
|
| for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) {
|
| (static_cast<OptionsPageUIHandler*>(*iter))->Initialize();
|
|
|