| 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" |
| 11 #include "chrome/browser/extensions/extensions_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/renderer_host/render_view_host.h" | 13 #include "chrome/browser/renderer_host/render_view_host.h" |
| 14 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 14 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 15 #include "chrome/browser/renderer_host/render_view_host_factory.h" | 15 #include "chrome/browser/renderer_host/render_view_host_factory.h" |
| 16 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 16 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 17 #include "chrome/browser/renderer_host/site_instance.h" | 17 #include "chrome/browser/renderer_host/site_instance.h" |
| 18 #include "chrome/browser/tab_contents/navigation_controller.h" | 18 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 19 #include "chrome/browser/tab_contents/navigation_entry.h" | 19 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 20 #include "chrome/browser/tab_contents/tab_contents_view.h" | 20 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 473 |
| 474 bool RenderViewHostManager::InitRenderView(RenderViewHost* render_view_host, | 474 bool RenderViewHostManager::InitRenderView(RenderViewHost* render_view_host, |
| 475 const NavigationEntry& entry) { | 475 const NavigationEntry& entry) { |
| 476 // If the pending navigation is to a DOMUI, tell the RenderView about any | 476 // If the pending navigation is to a DOMUI, tell the RenderView about any |
| 477 // bindings it will need enabled. | 477 // bindings it will need enabled. |
| 478 if (pending_dom_ui_.get()) | 478 if (pending_dom_ui_.get()) |
| 479 render_view_host->AllowBindings(pending_dom_ui_->bindings()); | 479 render_view_host->AllowBindings(pending_dom_ui_->bindings()); |
| 480 | 480 |
| 481 // Tell the RenderView whether it will be used for an extension process. | 481 // Tell the RenderView whether it will be used for an extension process. |
| 482 Profile* profile = delegate_->GetControllerForRenderManager().profile(); | 482 Profile* profile = delegate_->GetControllerForRenderManager().profile(); |
| 483 bool is_extension_process = profile->GetExtensionsService() && | 483 bool is_extension_process = profile->GetExtensionService() && |
| 484 profile->GetExtensionsService()->ExtensionBindingsAllowed(entry.url()); | 484 profile->GetExtensionService()->ExtensionBindingsAllowed(entry.url()); |
| 485 render_view_host->set_is_extension_process(is_extension_process); | 485 render_view_host->set_is_extension_process(is_extension_process); |
| 486 | 486 |
| 487 return delegate_->CreateRenderViewForRenderManager(render_view_host); | 487 return delegate_->CreateRenderViewForRenderManager(render_view_host); |
| 488 } | 488 } |
| 489 | 489 |
| 490 void RenderViewHostManager::CommitPending() { | 490 void RenderViewHostManager::CommitPending() { |
| 491 // First check whether we're going to want to focus the location bar after | 491 // First check whether we're going to want to focus the location bar after |
| 492 // this commit. We do this now because the navigation hasn't formally | 492 // this commit. We do this now because the navigation hasn't formally |
| 493 // committed yet, so if we've already cleared |pending_dom_ui_| the call chain | 493 // committed yet, so if we've already cleared |pending_dom_ui_| the call chain |
| 494 // this triggers won't be able to figure out what's going on. | 494 // this triggers won't be able to figure out what's going on. |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 Source<NavigationController>(&delegate_->GetControllerForRenderManager()), | 713 Source<NavigationController>(&delegate_->GetControllerForRenderManager()), |
| 714 Details<RenderViewHostSwitchedDetails>(&details)); | 714 Details<RenderViewHostSwitchedDetails>(&details)); |
| 715 | 715 |
| 716 // This will cause the old RenderViewHost to delete itself. | 716 // This will cause the old RenderViewHost to delete itself. |
| 717 old_render_view_host->Shutdown(); | 717 old_render_view_host->Shutdown(); |
| 718 | 718 |
| 719 // Let the task manager know that we've swapped RenderViewHosts, since it | 719 // Let the task manager know that we've swapped RenderViewHosts, since it |
| 720 // might need to update its process groupings. | 720 // might need to update its process groupings. |
| 721 delegate_->NotifySwappedFromRenderManager(); | 721 delegate_->NotifySwappedFromRenderManager(); |
| 722 } | 722 } |
| OLD | NEW |