OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/tab_contents/render_view_host_manager.h" | 5 #include "content/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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
12 #include "chrome/common/render_messages_params.h" | 12 #include "chrome/common/render_messages_params.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "content/browser/content_browser_client.h" | 14 #include "content/browser/content_browser_client.h" |
15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
16 #include "content/browser/renderer_host/render_view_host_delegate.h" | 16 #include "content/browser/renderer_host/render_view_host_delegate.h" |
17 #include "content/browser/renderer_host/render_view_host_factory.h" | 17 #include "content/browser/renderer_host/render_view_host_factory.h" |
18 #include "content/browser/renderer_host/render_widget_host_view.h" | 18 #include "content/browser/renderer_host/render_widget_host_view.h" |
19 #include "content/browser/site_instance.h" | 19 #include "content/browser/site_instance.h" |
20 #include "content/browser/tab_contents/navigation_controller.h" | 20 #include "content/browser/tab_contents/navigation_controller.h" |
21 #include "content/browser/tab_contents/navigation_entry.h" | 21 #include "content/browser/tab_contents/navigation_entry.h" |
22 #include "content/browser/tab_contents/tab_contents_view.h" | 22 #include "content/browser/tab_contents/tab_contents_view.h" |
23 #include "content/browser/webui/web_ui.h" | 23 #include "content/browser/webui/web_ui.h" |
24 #include "content/browser/webui/web_ui_factory.h" | 24 #include "content/browser/webui/web_ui_factory.h" |
25 #include "content/common/content_client.h" | |
26 #include "content/common/notification_service.h" | 25 #include "content/common/notification_service.h" |
27 #include "content/common/notification_type.h" | 26 #include "content/common/notification_type.h" |
28 | 27 |
29 namespace base { | 28 namespace base { |
30 class WaitableEvent; | 29 class WaitableEvent; |
31 } | 30 } |
32 | 31 |
33 RenderViewHostManager::RenderViewHostManager( | 32 RenderViewHostManager::RenderViewHostManager( |
34 RenderViewHostDelegate* render_view_delegate, | 33 RenderViewHostDelegate* render_view_delegate, |
35 Delegate* delegate) | 34 Delegate* delegate) |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 480 |
482 bool RenderViewHostManager::InitRenderView(RenderViewHost* render_view_host, | 481 bool RenderViewHostManager::InitRenderView(RenderViewHost* render_view_host, |
483 const NavigationEntry& entry) { | 482 const NavigationEntry& entry) { |
484 // If the pending navigation is to a WebUI, tell the RenderView about any | 483 // If the pending navigation is to a WebUI, tell the RenderView about any |
485 // bindings it will need enabled. | 484 // bindings it will need enabled. |
486 if (pending_web_ui_.get()) | 485 if (pending_web_ui_.get()) |
487 render_view_host->AllowBindings(pending_web_ui_->bindings()); | 486 render_view_host->AllowBindings(pending_web_ui_->bindings()); |
488 | 487 |
489 // Give the embedder a chance to initialize the render view. | 488 // Give the embedder a chance to initialize the render view. |
490 Profile* profile = delegate_->GetControllerForRenderManager().profile(); | 489 Profile* profile = delegate_->GetControllerForRenderManager().profile(); |
491 content::GetContentClient()->browser_client()->OnRenderViewCreation( | 490 content::GetContentClient()->browser()->PreCreateRenderView( |
492 render_view_host, profile, entry.url()); | 491 render_view_host, profile, entry.url()); |
493 | 492 |
494 return delegate_->CreateRenderViewForRenderManager(render_view_host); | 493 return delegate_->CreateRenderViewForRenderManager(render_view_host); |
495 } | 494 } |
496 | 495 |
497 void RenderViewHostManager::CommitPending() { | 496 void RenderViewHostManager::CommitPending() { |
498 // First check whether we're going to want to focus the location bar after | 497 // First check whether we're going to want to focus the location bar after |
499 // this commit. We do this now because the navigation hasn't formally | 498 // this commit. We do this now because the navigation hasn't formally |
500 // committed yet, so if we've already cleared |pending_web_ui_| the call chain | 499 // committed yet, so if we've already cleared |pending_web_ui_| the call chain |
501 // this triggers won't be able to figure out what's going on. | 500 // 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... |
720 Source<NavigationController>(&delegate_->GetControllerForRenderManager()), | 719 Source<NavigationController>(&delegate_->GetControllerForRenderManager()), |
721 Details<RenderViewHostSwitchedDetails>(&details)); | 720 Details<RenderViewHostSwitchedDetails>(&details)); |
722 | 721 |
723 // This will cause the old RenderViewHost to delete itself. | 722 // This will cause the old RenderViewHost to delete itself. |
724 old_render_view_host->Shutdown(); | 723 old_render_view_host->Shutdown(); |
725 | 724 |
726 // Let the task manager know that we've swapped RenderViewHosts, since it | 725 // Let the task manager know that we've swapped RenderViewHosts, since it |
727 // might need to update its process groupings. | 726 // might need to update its process groupings. |
728 delegate_->NotifySwappedFromRenderManager(); | 727 delegate_->NotifySwappedFromRenderManager(); |
729 } | 728 } |
OLD | NEW |