| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // looks for this TabContents based on a render view ID. Instead, we just | 210 // looks for this TabContents based on a render view ID. Instead, we just |
| 211 // leave the pending renderer around until the next navigation event | 211 // leave the pending renderer around until the next navigation event |
| 212 // (Navigate, DidNavigate, etc), which will clean it up properly. | 212 // (Navigate, DidNavigate, etc), which will clean it up properly. |
| 213 // TODO(creis): All of this will go away when we move the cross-site logic | 213 // TODO(creis): All of this will go away when we move the cross-site logic |
| 214 // to ResourceDispatcherHost, so that we intercept responses rather than | 214 // to ResourceDispatcherHost, so that we intercept responses rather than |
| 215 // navigation events. (That's necessary to support onunload anyway.) Once | 215 // navigation events. (That's necessary to support onunload anyway.) Once |
| 216 // we've made that change, we won't create a pending renderer until we know | 216 // we've made that change, we won't create a pending renderer until we know |
| 217 // the response is not a download. | 217 // the response is not a download. |
| 218 } | 218 } |
| 219 | 219 |
| 220 void RenderViewHostManager::set_interstitial_page( | |
| 221 InterstitialPage* interstitial_page) { | |
| 222 DCHECK(!interstitial_page_ && interstitial_page); | |
| 223 interstitial_page_ = interstitial_page; | |
| 224 } | |
| 225 | |
| 226 void RenderViewHostManager::remove_interstitial_page() { | |
| 227 DCHECK(interstitial_page_); | |
| 228 interstitial_page_ = NULL; | |
| 229 } | |
| 230 | |
| 231 void RenderViewHostManager::ShouldClosePage(bool for_cross_site_transition, | 220 void RenderViewHostManager::ShouldClosePage(bool for_cross_site_transition, |
| 232 bool proceed) { | 221 bool proceed) { |
| 233 if (for_cross_site_transition) { | 222 if (for_cross_site_transition) { |
| 234 // Ignore if we're not in a cross-site navigation. | 223 // Ignore if we're not in a cross-site navigation. |
| 235 if (!cross_navigation_pending_) | 224 if (!cross_navigation_pending_) |
| 236 return; | 225 return; |
| 237 | 226 |
| 238 if (proceed) { | 227 if (proceed) { |
| 239 // Ok to unload the current page, so proceed with the cross-site | 228 // Ok to unload the current page, so proceed with the cross-site |
| 240 // navigation. Note that if navigations are not currently suspended, it | 229 // navigation. Note that if navigations are not currently suspended, it |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 // deleted (not sure from where) but not NULLed. | 670 // deleted (not sure from where) but not NULLed. |
| 682 if (rvh == pending_render_view_host_) { | 671 if (rvh == pending_render_view_host_) { |
| 683 // If you hit this NOTREACHED, please report it in the following bug | 672 // If you hit this NOTREACHED, please report it in the following bug |
| 684 // http://crbug.com/23411 Make sure to include what you were doing when it | 673 // http://crbug.com/23411 Make sure to include what you were doing when it |
| 685 // happened (navigating to a new page, closing a tab...) and if you can | 674 // happened (navigating to a new page, closing a tab...) and if you can |
| 686 // reproduce. | 675 // reproduce. |
| 687 NOTREACHED(); | 676 NOTREACHED(); |
| 688 pending_render_view_host_ = NULL; | 677 pending_render_view_host_ = NULL; |
| 689 } | 678 } |
| 690 } | 679 } |
| OLD | NEW |