OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 SiteInstance* site_instance, | 50 SiteInstance* site_instance, |
51 int routing_id, | 51 int routing_id, |
52 base::WaitableEvent* modal_dialog_event) { | 52 base::WaitableEvent* modal_dialog_event) { |
53 // Create a RenderViewHost, once we have an instance. It is important to | 53 // Create a RenderViewHost, once we have an instance. It is important to |
54 // immediately give this SiteInstance to a RenderViewHost so that it is | 54 // immediately give this SiteInstance to a RenderViewHost so that it is |
55 // ref counted. | 55 // ref counted. |
56 if (!site_instance) | 56 if (!site_instance) |
57 site_instance = SiteInstance::CreateSiteInstance(profile); | 57 site_instance = SiteInstance::CreateSiteInstance(profile); |
58 render_view_host_ = RenderViewHostFactory::Create( | 58 render_view_host_ = RenderViewHostFactory::Create( |
59 site_instance, render_view_delegate_, routing_id, modal_dialog_event); | 59 site_instance, render_view_delegate_, routing_id, modal_dialog_event); |
| 60 NotificationService::current()->Notify( |
| 61 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, |
| 62 Source<RenderViewHostManager>(this), |
| 63 Details<RenderViewHost>(render_view_host_)); |
60 } | 64 } |
61 | 65 |
62 RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) { | 66 RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) { |
63 // This will possibly create (set to NULL) a DOM UI object for the pending | 67 // This will possibly create (set to NULL) a DOM UI object for the pending |
64 // page. We'll use this later to give the page special access. This must | 68 // page. We'll use this later to give the page special access. This must |
65 // happen before the new renderer is created below so it will get bindings. | 69 // happen before the new renderer is created below so it will get bindings. |
66 pending_dom_ui_.reset(delegate_->CreateDOMUIForRenderManager(entry.url())); | 70 pending_dom_ui_.reset(delegate_->CreateDOMUIForRenderManager(entry.url())); |
67 | 71 |
68 // Create a pending RenderViewHost. It will give us the one we should use | 72 // Create a pending RenderViewHost. It will give us the one we should use |
69 RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry); | 73 RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 NavigationEntry* curr_entry = | 403 NavigationEntry* curr_entry = |
400 delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); | 404 delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); |
401 if (curr_entry) { | 405 if (curr_entry) { |
402 DCHECK(!curr_entry->content_state().empty()); | 406 DCHECK(!curr_entry->content_state().empty()); |
403 // TODO(creis): Should send a message to the RenderView to let it know | 407 // TODO(creis): Should send a message to the RenderView to let it know |
404 // we're about to switch away, so that it sends an UpdateState message. | 408 // we're about to switch away, so that it sends an UpdateState message. |
405 } | 409 } |
406 | 410 |
407 pending_render_view_host_ = RenderViewHostFactory::Create( | 411 pending_render_view_host_ = RenderViewHostFactory::Create( |
408 instance, render_view_delegate_, MSG_ROUTING_NONE, NULL); | 412 instance, render_view_delegate_, MSG_ROUTING_NONE, NULL); |
| 413 NotificationService::current()->Notify( |
| 414 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, |
| 415 Source<RenderViewHostManager>(this), |
| 416 Details<RenderViewHost>(pending_render_view_host_)); |
409 | 417 |
410 bool success = delegate_->CreateRenderViewForRenderManager( | 418 bool success = delegate_->CreateRenderViewForRenderManager( |
411 pending_render_view_host_); | 419 pending_render_view_host_); |
412 if (success) { | 420 if (success) { |
413 // Don't show the view until we get a DidNavigate from it. | 421 // Don't show the view until we get a DidNavigate from it. |
414 pending_render_view_host_->view()->Hide(); | 422 pending_render_view_host_->view()->Hide(); |
415 } else { | 423 } else { |
416 CancelPending(); | 424 CancelPending(); |
417 } | 425 } |
418 return success; | 426 return success; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 | 572 |
565 pending_dom_ui_.reset(); | 573 pending_dom_ui_.reset(); |
566 } | 574 } |
567 | 575 |
568 void RenderViewHostManager::CrossSiteNavigationCanceled() { | 576 void RenderViewHostManager::CrossSiteNavigationCanceled() { |
569 DCHECK(cross_navigation_pending_); | 577 DCHECK(cross_navigation_pending_); |
570 cross_navigation_pending_ = false; | 578 cross_navigation_pending_ = false; |
571 if (pending_render_view_host_) | 579 if (pending_render_view_host_) |
572 CancelPending(); | 580 CancelPending(); |
573 } | 581 } |
OLD | NEW |