| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 void RenderViewHostManager::Init(Profile* profile, | 49 void RenderViewHostManager::Init(Profile* profile, |
| 50 SiteInstance* site_instance, | 50 SiteInstance* site_instance, |
| 51 int routing_id) { | 51 int routing_id) { |
| 52 // Create a RenderViewHost, once we have an instance. It is important to | 52 // Create a RenderViewHost, once we have an instance. It is important to |
| 53 // immediately give this SiteInstance to a RenderViewHost so that it is | 53 // immediately give this SiteInstance to a RenderViewHost so that it is |
| 54 // ref counted. | 54 // ref counted. |
| 55 if (!site_instance) | 55 if (!site_instance) |
| 56 site_instance = SiteInstance::CreateSiteInstance(profile); | 56 site_instance = SiteInstance::CreateSiteInstance(profile); |
| 57 render_view_host_ = RenderViewHostFactory::Create( | 57 render_view_host_ = RenderViewHostFactory::Create( |
| 58 site_instance, render_view_delegate_, routing_id); | 58 site_instance, render_view_delegate_, routing_id, delegate_-> |
| 59 GetControllerForRenderManager().session_storage_namespace_id()); |
| 59 NotificationService::current()->Notify( | 60 NotificationService::current()->Notify( |
| 60 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, | 61 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, |
| 61 Source<RenderViewHostManager>(this), | 62 Source<RenderViewHostManager>(this), |
| 62 Details<RenderViewHost>(render_view_host_)); | 63 Details<RenderViewHost>(render_view_host_)); |
| 63 } | 64 } |
| 64 | 65 |
| 65 RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) { | 66 RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) { |
| 66 // Create a pending RenderViewHost. It will give us the one we should use | 67 // Create a pending RenderViewHost. It will give us the one we should use |
| 67 RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry); | 68 RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry); |
| 68 if (!dest_render_view_host) | 69 if (!dest_render_view_host) |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 bool RenderViewHostManager::CreatePendingRenderView(SiteInstance* instance) { | 406 bool RenderViewHostManager::CreatePendingRenderView(SiteInstance* instance) { |
| 406 NavigationEntry* curr_entry = | 407 NavigationEntry* curr_entry = |
| 407 delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); | 408 delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); |
| 408 if (curr_entry) { | 409 if (curr_entry) { |
| 409 DCHECK(!curr_entry->content_state().empty()); | 410 DCHECK(!curr_entry->content_state().empty()); |
| 410 // TODO(creis): Should send a message to the RenderView to let it know | 411 // TODO(creis): Should send a message to the RenderView to let it know |
| 411 // we're about to switch away, so that it sends an UpdateState message. | 412 // we're about to switch away, so that it sends an UpdateState message. |
| 412 } | 413 } |
| 413 | 414 |
| 414 pending_render_view_host_ = RenderViewHostFactory::Create( | 415 pending_render_view_host_ = RenderViewHostFactory::Create( |
| 415 instance, render_view_delegate_, MSG_ROUTING_NONE); | 416 instance, render_view_delegate_, MSG_ROUTING_NONE, delegate_-> |
| 417 GetControllerForRenderManager().session_storage_namespace_id()); |
| 416 NotificationService::current()->Notify( | 418 NotificationService::current()->Notify( |
| 417 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, | 419 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, |
| 418 Source<RenderViewHostManager>(this), | 420 Source<RenderViewHostManager>(this), |
| 419 Details<RenderViewHost>(pending_render_view_host_)); | 421 Details<RenderViewHost>(pending_render_view_host_)); |
| 420 | 422 |
| 421 bool success = delegate_->CreateRenderViewForRenderManager( | 423 bool success = delegate_->CreateRenderViewForRenderManager( |
| 422 pending_render_view_host_); | 424 pending_render_view_host_); |
| 423 if (success) { | 425 if (success) { |
| 424 // Don't show the view until we get a DidNavigate from it. | 426 // Don't show the view until we get a DidNavigate from it. |
| 425 pending_render_view_host_->view()->Hide(); | 427 pending_render_view_host_->view()->Hide(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 // deleted (not sure from where) but not NULLed. | 602 // deleted (not sure from where) but not NULLed. |
| 601 if (rvh == pending_render_view_host_) { | 603 if (rvh == pending_render_view_host_) { |
| 602 // If you hit this NOTREACHED, please report it in the following bug | 604 // If you hit this NOTREACHED, please report it in the following bug |
| 603 // http://crbug.com/23411 Make sure to include what you were doing when it | 605 // http://crbug.com/23411 Make sure to include what you were doing when it |
| 604 // happened (navigating to a new page, closing a tab...) and if you can | 606 // happened (navigating to a new page, closing a tab...) and if you can |
| 605 // reproduce. | 607 // reproduce. |
| 606 NOTREACHED(); | 608 NOTREACHED(); |
| 607 pending_render_view_host_ = NULL; | 609 pending_render_view_host_ = NULL; |
| 608 } | 610 } |
| 609 } | 611 } |
| OLD | NEW |