| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void RenderViewHostManager::Init(Profile* profile, | 52 void RenderViewHostManager::Init(Profile* profile, |
| 53 SiteInstance* site_instance, | 53 SiteInstance* site_instance, |
| 54 int routing_id) { | 54 int routing_id) { |
| 55 // Create a RenderViewHost, once we have an instance. It is important to | 55 // Create a RenderViewHost, once we have an instance. It is important to |
| 56 // immediately give this SiteInstance to a RenderViewHost so that it is | 56 // immediately give this SiteInstance to a RenderViewHost so that it is |
| 57 // ref counted. | 57 // ref counted. |
| 58 if (!site_instance) | 58 if (!site_instance) |
| 59 site_instance = SiteInstance::CreateSiteInstance(profile); | 59 site_instance = SiteInstance::CreateSiteInstance(profile); |
| 60 render_view_host_ = RenderViewHostFactory::Create( | 60 render_view_host_ = RenderViewHostFactory::Create( |
| 61 site_instance, render_view_delegate_, routing_id, delegate_-> | 61 site_instance, render_view_delegate_, routing_id, delegate_-> |
| 62 GetControllerForRenderManager().session_storage_namespace_id()); | 62 GetControllerForRenderManager().session_storage_namespace()); |
| 63 NotificationService::current()->Notify( | 63 NotificationService::current()->Notify( |
| 64 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, | 64 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, |
| 65 Source<RenderViewHostManager>(this), | 65 Source<RenderViewHostManager>(this), |
| 66 Details<RenderViewHost>(render_view_host_)); | 66 Details<RenderViewHost>(render_view_host_)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 RenderWidgetHostView* RenderViewHostManager::GetRenderWidgetHostView() const { | 69 RenderWidgetHostView* RenderViewHostManager::GetRenderWidgetHostView() const { |
| 70 if (!render_view_host_) | 70 if (!render_view_host_) |
| 71 return NULL; | 71 return NULL; |
| 72 return render_view_host_->view(); | 72 return render_view_host_->view(); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 NavigationEntry* curr_entry = | 441 NavigationEntry* curr_entry = |
| 442 delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); | 442 delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); |
| 443 if (curr_entry) { | 443 if (curr_entry) { |
| 444 DCHECK(!curr_entry->content_state().empty()); | 444 DCHECK(!curr_entry->content_state().empty()); |
| 445 // TODO(creis): Should send a message to the RenderView to let it know | 445 // TODO(creis): Should send a message to the RenderView to let it know |
| 446 // we're about to switch away, so that it sends an UpdateState message. | 446 // we're about to switch away, so that it sends an UpdateState message. |
| 447 } | 447 } |
| 448 | 448 |
| 449 pending_render_view_host_ = RenderViewHostFactory::Create( | 449 pending_render_view_host_ = RenderViewHostFactory::Create( |
| 450 instance, render_view_delegate_, MSG_ROUTING_NONE, delegate_-> | 450 instance, render_view_delegate_, MSG_ROUTING_NONE, delegate_-> |
| 451 GetControllerForRenderManager().session_storage_namespace_id()); | 451 GetControllerForRenderManager().session_storage_namespace()); |
| 452 NotificationService::current()->Notify( | 452 NotificationService::current()->Notify( |
| 453 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, | 453 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, |
| 454 Source<RenderViewHostManager>(this), | 454 Source<RenderViewHostManager>(this), |
| 455 Details<RenderViewHost>(pending_render_view_host_)); | 455 Details<RenderViewHost>(pending_render_view_host_)); |
| 456 | 456 |
| 457 bool success = InitRenderView(pending_render_view_host_, entry); | 457 bool success = InitRenderView(pending_render_view_host_, entry); |
| 458 if (success) { | 458 if (success) { |
| 459 // Don't show the view until we get a DidNavigate from it. | 459 // Don't show the view until we get a DidNavigate from it. |
| 460 pending_render_view_host_->view()->Hide(); | 460 pending_render_view_host_->view()->Hide(); |
| 461 } else { | 461 } else { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 // deleted (not sure from where) but not NULLed. | 662 // deleted (not sure from where) but not NULLed. |
| 663 if (rvh == pending_render_view_host_) { | 663 if (rvh == pending_render_view_host_) { |
| 664 // If you hit this NOTREACHED, please report it in the following bug | 664 // 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 | 665 // 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 | 666 // happened (navigating to a new page, closing a tab...) and if you can |
| 667 // reproduce. | 667 // reproduce. |
| 668 NOTREACHED(); | 668 NOTREACHED(); |
| 669 pending_render_view_host_ = NULL; | 669 pending_render_view_host_ = NULL; |
| 670 } | 670 } |
| 671 } | 671 } |
| OLD | NEW |