Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/dom_ui/options/options_ui.h" | 5 #include "chrome/browser/dom_ui/options/options_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 DOMUI::RenderViewCreated(render_view_host); | 233 DOMUI::RenderViewCreated(render_view_host); |
| 234 } | 234 } |
| 235 | 235 |
| 236 // static | 236 // static |
| 237 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { | 237 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { |
| 238 return ResourceBundle::GetSharedInstance(). | 238 return ResourceBundle::GetSharedInstance(). |
| 239 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); | 239 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void OptionsUI::InitializeHandlers() { | 242 void OptionsUI::InitializeHandlers() { |
| 243 // Don't open a settings tab in an OTR profile. For most cases, we won't | |
| 244 // get this far as browser::Navigate() will redirect the request to a | |
| 245 // non-OTR profile, but there are some corner cases where a chrome://settings | |
| 246 // load can slip through (such as dragging an anchor link to the tab strip). | |
| 247 Profile* profile = GetProfile(); | |
| 248 if (profile->IsOffTheRecord()) { | |
| 249 // Re-open the tab in a normal window. | |
| 250 Browser* normal_browser = Browser::GetOrCreateTabbedBrowser( | |
| 251 profile->GetOriginalProfile()); | |
| 252 normal_browser->AddSelectedTabWithURL(GURL(chrome::kChromeUISettingsURL), | |
| 253 PageTransition::LINK); | |
| 254 | |
| 255 // Close this tab. | |
| 256 Browser* otr_browser = Browser::GetOrCreateTabbedBrowser(profile); | |
| 257 otr_browser->CloseTabContents(tab_contents()); | |
| 258 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
| |
| 259 } | |
| 260 | |
| 243 std::vector<DOMMessageHandler*>::iterator iter; | 261 std::vector<DOMMessageHandler*>::iterator iter; |
| 244 for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) { | 262 for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) { |
| 245 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); | 263 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); |
| 246 } | 264 } |
| 247 } | 265 } |
| 248 | 266 |
| 249 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, | 267 void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings, |
| 250 OptionsPageUIHandler* handler_raw) { | 268 OptionsPageUIHandler* handler_raw) { |
| 251 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); | 269 scoped_ptr<OptionsPageUIHandler> handler(handler_raw); |
| 252 DCHECK(handler.get()); | 270 DCHECK(handler.get()); |
| 253 // Add only if handler's service is enabled. | 271 // Add only if handler's service is enabled. |
| 254 if (handler->IsEnabled()) { | 272 if (handler->IsEnabled()) { |
| 255 handler->GetLocalizedValues(localized_strings); | 273 handler->GetLocalizedValues(localized_strings); |
| 256 // Add handler to the list and also pass the ownership. | 274 // Add handler to the list and also pass the ownership. |
| 257 AddMessageHandler(handler.release()->Attach(this)); | 275 AddMessageHandler(handler.release()->Attach(this)); |
| 258 } | 276 } |
| 259 } | 277 } |
| OLD | NEW |