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/tab_contents/render_view_host_manager.h" | 5 #include "chrome/browser/tab_contents/render_view_host_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/dom_ui/dom_ui.h" | 9 #include "chrome/browser/dom_ui/dom_ui.h" |
10 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 10 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // We can't switch a RenderView between view source and non-view source mode | 303 // We can't switch a RenderView between view source and non-view source mode |
304 // without screwing up the session history sometimes (when navigating between | 304 // without screwing up the session history sometimes (when navigating between |
305 // "view-source:http://foo.com/" and "http://foo.com/", WebKit doesn't treat | 305 // "view-source:http://foo.com/" and "http://foo.com/", WebKit doesn't treat |
306 // it as a new navigation). So require a view switch. | 306 // it as a new navigation). So require a view switch. |
307 if (cur_entry->IsViewSourceMode() != new_entry->IsViewSourceMode()) | 307 if (cur_entry->IsViewSourceMode() != new_entry->IsViewSourceMode()) |
308 return true; | 308 return true; |
309 | 309 |
310 // For security, we should transition between processes when one is a DOM UI | 310 // For security, we should transition between processes when one is a DOM UI |
311 // page and one isn't. | 311 // page and one isn't. |
312 Profile* profile = delegate_->GetControllerForRenderManager().profile(); | 312 Profile* profile = delegate_->GetControllerForRenderManager().profile(); |
313 if (DOMUIFactory::UseDOMUIForURL(profile, cur_entry->url()) != | 313 if (DOMUIFactory::UseDOMUIForURL(profile, cur_entry->url())) { |
314 DOMUIFactory::UseDOMUIForURL(profile, new_entry->url())) | 314 // Force swap if it's not an acceptable URL for DOM UI. |
315 return true; | 315 if (!DOMUIFactory::IsURLAcceptableForDOMUI(profile, new_entry->url())) |
| 316 return true; |
| 317 } else { |
| 318 // Force swap if it's a DOM UI URL. |
| 319 if (DOMUIFactory::UseDOMUIForURL(profile, new_entry->url())) |
| 320 return true; |
| 321 } |
316 | 322 |
317 // Also, we must switch if one is an extension and the other is not the exact | 323 // Also, we must switch if one is an extension and the other is not the exact |
318 // same extension. | 324 // same extension. |
319 if (cur_entry->url().SchemeIs(chrome::kExtensionScheme) || | 325 if (cur_entry->url().SchemeIs(chrome::kExtensionScheme) || |
320 new_entry->url().SchemeIs(chrome::kExtensionScheme)) { | 326 new_entry->url().SchemeIs(chrome::kExtensionScheme)) { |
321 if (cur_entry->url().GetOrigin() != new_entry->url().GetOrigin()) | 327 if (cur_entry->url().GetOrigin() != new_entry->url().GetOrigin()) |
322 return true; | 328 return true; |
323 } | 329 } |
324 | 330 |
325 return false; | 331 return false; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 // deleted (not sure from where) but not NULLed. | 668 // deleted (not sure from where) but not NULLed. |
663 if (rvh == pending_render_view_host_) { | 669 if (rvh == pending_render_view_host_) { |
664 // If you hit this NOTREACHED, please report it in the following bug | 670 // If you hit this NOTREACHED, please report it in the following bug |
665 // http://crbug.com/23411 Make sure to include what you were doing when it | 671 // http://crbug.com/23411 Make sure to include what you were doing when it |
666 // happened (navigating to a new page, closing a tab...) and if you can | 672 // happened (navigating to a new page, closing a tab...) and if you can |
667 // reproduce. | 673 // reproduce. |
668 NOTREACHED(); | 674 NOTREACHED(); |
669 pending_render_view_host_ = NULL; | 675 pending_render_view_host_ = NULL; |
670 } | 676 } |
671 } | 677 } |
OLD | NEW |