| 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/interstitial_page.h" | 5 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/thread.h" | 9 #include "base/thread.h" |
| 10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 InterstitialPage::InterstitialPage(WebContents* tab, | 104 InterstitialPage::InterstitialPage(WebContents* tab, |
| 105 bool new_navigation, | 105 bool new_navigation, |
| 106 const GURL& url) | 106 const GURL& url) |
| 107 : tab_(tab), | 107 : tab_(tab), |
| 108 url_(url), | 108 url_(url), |
| 109 new_navigation_(new_navigation), | 109 new_navigation_(new_navigation), |
| 110 enabled_(true), | 110 enabled_(true), |
| 111 action_taken_(false), | 111 action_taken_(false), |
| 112 render_view_host_(NULL), | 112 render_view_host_(NULL), |
| 113 original_rvh_process_id_(tab->render_view_host()->process()->host_id()), | 113 original_rvh_process_id_(tab->render_view_host()->process()->pid()), |
| 114 original_rvh_id_(tab->render_view_host()->routing_id()), | 114 original_rvh_id_(tab->render_view_host()->routing_id()), |
| 115 should_revert_tab_title_(false), | 115 should_revert_tab_title_(false), |
| 116 resource_dispatcher_host_notified_(false), | 116 resource_dispatcher_host_notified_(false), |
| 117 ui_loop_(MessageLoop::current()), | 117 ui_loop_(MessageLoop::current()), |
| 118 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( | 118 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( |
| 119 new InterstitialPageRVHViewDelegate(this))) { | 119 new InterstitialPageRVHViewDelegate(this))) { |
| 120 InitInterstitialPageMap(); | 120 InitInterstitialPageMap(); |
| 121 // It would be inconsistent to create an interstitial with no new navigation | 121 // It would be inconsistent to create an interstitial with no new navigation |
| 122 // (which is the case when the interstitial was triggered by a sub-resource on | 122 // (which is the case when the interstitial was triggered by a sub-resource on |
| 123 // a page) when we have a pending entry (in the process of loading a new top | 123 // a page) when we have a pending entry (in the process of loading a new top |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // new navigation. | 210 // new navigation. |
| 211 Disable(); | 211 Disable(); |
| 212 DCHECK(!resource_dispatcher_host_notified_); | 212 DCHECK(!resource_dispatcher_host_notified_); |
| 213 TakeActionOnResourceDispatcher(CANCEL); | 213 TakeActionOnResourceDispatcher(CANCEL); |
| 214 break; | 214 break; |
| 215 case NotificationType::RENDER_WIDGET_HOST_DESTROYED: | 215 case NotificationType::RENDER_WIDGET_HOST_DESTROYED: |
| 216 if (!action_taken_) { | 216 if (!action_taken_) { |
| 217 // The RenderViewHost is being destroyed (as part of the tab being | 217 // The RenderViewHost is being destroyed (as part of the tab being |
| 218 // closed), make sure we clear the blocked requests. | 218 // closed), make sure we clear the blocked requests. |
| 219 RenderViewHost* rvh = Source<RenderViewHost>(source).ptr(); | 219 RenderViewHost* rvh = Source<RenderViewHost>(source).ptr(); |
| 220 DCHECK(rvh->process()->host_id() == original_rvh_process_id_ && | 220 DCHECK(rvh->process()->pid() == original_rvh_process_id_ && |
| 221 rvh->routing_id() == original_rvh_id_); | 221 rvh->routing_id() == original_rvh_id_); |
| 222 TakeActionOnResourceDispatcher(CANCEL); | 222 TakeActionOnResourceDispatcher(CANCEL); |
| 223 } | 223 } |
| 224 break; | 224 break; |
| 225 case NotificationType::TAB_CONTENTS_DESTROYED: | 225 case NotificationType::TAB_CONTENTS_DESTROYED: |
| 226 case NotificationType::NAV_ENTRY_COMMITTED: | 226 case NotificationType::NAV_ENTRY_COMMITTED: |
| 227 if (!action_taken_) { | 227 if (!action_taken_) { |
| 228 // We are navigating away from the interstitial or closing a tab with an | 228 // We are navigating away from the interstitial or closing a tab with an |
| 229 // interstitial. Default to DontProceed(). We don't just call Hide as | 229 // interstitial. Default to DontProceed(). We don't just call Hide as |
| 230 // subclasses will almost certainly override DontProceed to do some work | 230 // subclasses will almost certainly override DontProceed to do some work |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 void InterstitialPage::InterstitialPageRVHViewDelegate:: | 489 void InterstitialPage::InterstitialPageRVHViewDelegate:: |
| 490 ForwardMessageToDevToolsClient(const IPC::Message& message) { | 490 ForwardMessageToDevToolsClient(const IPC::Message& message) { |
| 491 NOTREACHED() << "InterstitialPage does not support developer tools content."; | 491 NOTREACHED() << "InterstitialPage does not support developer tools content."; |
| 492 } | 492 } |
| 493 | 493 |
| 494 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 494 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
| 495 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 495 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 496 int active_match_ordinal, bool final_update) { | 496 int active_match_ordinal, bool final_update) { |
| 497 } | 497 } |
| OLD | NEW |