| 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 "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/web_ui.h" | 9 #include "chrome/browser/dom_ui/web_ui.h" |
| 10 #include "chrome/browser/dom_ui/web_ui_factory.h" | 10 #include "chrome/browser/dom_ui/web_ui_factory.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // A navigation in the original page has taken place. Cancel the pending | 192 // A navigation in the original page has taken place. Cancel the pending |
| 193 // one. | 193 // one. |
| 194 CancelPending(); | 194 CancelPending(); |
| 195 cross_navigation_pending_ = false; | 195 cross_navigation_pending_ = false; |
| 196 } else { | 196 } else { |
| 197 // No one else should be sending us DidNavigate in this state. | 197 // No one else should be sending us DidNavigate in this state. |
| 198 DCHECK(false); | 198 DCHECK(false); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 void RenderViewHostManager::SetDOMUIPostCommit(WebUI* web_ui) { | 202 void RenderViewHostManager::SetWebUIPostCommit(WebUI* web_ui) { |
| 203 DCHECK(!web_ui_.get()); | 203 DCHECK(!web_ui_.get()); |
| 204 web_ui_.reset(web_ui); | 204 web_ui_.reset(web_ui); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void RenderViewHostManager::RendererAbortedProvisionalLoad( | 207 void RenderViewHostManager::RendererAbortedProvisionalLoad( |
| 208 RenderViewHost* render_view_host) { | 208 RenderViewHost* render_view_host) { |
| 209 // We used to cancel the pending renderer here for cross-site downloads. | 209 // We used to cancel the pending renderer here for cross-site downloads. |
| 210 // However, it's not safe to do that because the download logic repeatedly | 210 // However, it's not safe to do that because the download logic repeatedly |
| 211 // looks for this TabContents based on a render view ID. Instead, we just | 211 // looks for this TabContents based on a render view ID. Instead, we just |
| 212 // leave the pending renderer around until the next navigation event | 212 // leave the pending renderer around until the next navigation event |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 CancelPending(); | 572 CancelPending(); |
| 573 cross_navigation_pending_ = false; | 573 cross_navigation_pending_ = false; |
| 574 } | 574 } |
| 575 | 575 |
| 576 // This will possibly create (set to NULL) a Web UI object for the pending | 576 // This will possibly create (set to NULL) a Web UI object for the pending |
| 577 // page. We'll use this later to give the page special access. This must | 577 // page. We'll use this later to give the page special access. This must |
| 578 // happen before the new renderer is created below so it will get bindings. | 578 // happen before the new renderer is created below so it will get bindings. |
| 579 // It must also happen after the above conditional call to CancelPending(), | 579 // It must also happen after the above conditional call to CancelPending(), |
| 580 // otherwise CancelPending may clear the pending_web_ui_ and the page will | 580 // otherwise CancelPending may clear the pending_web_ui_ and the page will |
| 581 // not have it's bindings set appropriately. | 581 // not have it's bindings set appropriately. |
| 582 pending_web_ui_.reset(delegate_->CreateDOMUIForRenderManager(entry.url())); | 582 pending_web_ui_.reset(delegate_->CreateWebUIForRenderManager(entry.url())); |
| 583 | 583 |
| 584 // render_view_host_ will not be deleted before the end of this method, so we | 584 // render_view_host_ will not be deleted before the end of this method, so we |
| 585 // don't have to worry about this SiteInstance's ref count dropping to zero. | 585 // don't have to worry about this SiteInstance's ref count dropping to zero. |
| 586 SiteInstance* curr_instance = render_view_host_->site_instance(); | 586 SiteInstance* curr_instance = render_view_host_->site_instance(); |
| 587 | 587 |
| 588 // Determine if we need a new SiteInstance for this entry. | 588 // Determine if we need a new SiteInstance for this entry. |
| 589 // Again, new_instance won't be deleted before the end of this method, so it | 589 // Again, new_instance won't be deleted before the end of this method, so it |
| 590 // is safe to use a normal pointer here. | 590 // is safe to use a normal pointer here. |
| 591 SiteInstance* new_instance = curr_instance; | 591 SiteInstance* new_instance = curr_instance; |
| 592 bool force_swap = ShouldSwapProcessesForNavigation( | 592 bool force_swap = ShouldSwapProcessesForNavigation( |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 Source<NavigationController>(&delegate_->GetControllerForRenderManager()), | 720 Source<NavigationController>(&delegate_->GetControllerForRenderManager()), |
| 721 Details<RenderViewHostSwitchedDetails>(&details)); | 721 Details<RenderViewHostSwitchedDetails>(&details)); |
| 722 | 722 |
| 723 // This will cause the old RenderViewHost to delete itself. | 723 // This will cause the old RenderViewHost to delete itself. |
| 724 old_render_view_host->Shutdown(); | 724 old_render_view_host->Shutdown(); |
| 725 | 725 |
| 726 // Let the task manager know that we've swapped RenderViewHosts, since it | 726 // Let the task manager know that we've swapped RenderViewHosts, since it |
| 727 // might need to update its process groupings. | 727 // might need to update its process groupings. |
| 728 delegate_->NotifySwappedFromRenderManager(); | 728 delegate_->NotifySwappedFromRenderManager(); |
| 729 } | 729 } |
| OLD | NEW |