| 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 "content/browser/tab_contents/interstitial_page.h" | 5 #include "content/browser/tab_contents/interstitial_page.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "content/browser/renderer_host/render_process_host.h" | 14 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
| 16 #include "content/browser/renderer_host/render_widget_host_view.h" | 16 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 17 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 17 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 18 #include "content/browser/site_instance.h" | 18 #include "content/browser/site_instance.h" |
| 19 #include "content/browser/tab_contents/navigation_controller.h" | 19 #include "content/browser/tab_contents/navigation_controller.h" |
| 20 #include "content/browser/tab_contents/navigation_entry.h" | 20 #include "content/browser/tab_contents/navigation_entry.h" |
| 21 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
| 22 #include "content/browser/tab_contents/tab_contents_view.h" | 22 #include "content/browser/tab_contents/tab_contents_view.h" |
| 23 #include "content/common/dom_storage_common.h" | 23 #include "content/common/dom_storage_common.h" |
| 24 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 bool new_navigation, | 134 bool new_navigation, |
| 135 const GURL& url) | 135 const GURL& url) |
| 136 : tab_(tab), | 136 : tab_(tab), |
| 137 url_(url), | 137 url_(url), |
| 138 new_navigation_(new_navigation), | 138 new_navigation_(new_navigation), |
| 139 should_discard_pending_nav_entry_(new_navigation), | 139 should_discard_pending_nav_entry_(new_navigation), |
| 140 reload_on_dont_proceed_(false), | 140 reload_on_dont_proceed_(false), |
| 141 enabled_(true), | 141 enabled_(true), |
| 142 action_taken_(NO_ACTION), | 142 action_taken_(NO_ACTION), |
| 143 render_view_host_(NULL), | 143 render_view_host_(NULL), |
| 144 original_child_id_(tab->render_view_host()->process()->id()), | 144 original_child_id_(tab->render_view_host()->process()->GetID()), |
| 145 original_rvh_id_(tab->render_view_host()->routing_id()), | 145 original_rvh_id_(tab->render_view_host()->routing_id()), |
| 146 should_revert_tab_title_(false), | 146 should_revert_tab_title_(false), |
| 147 tab_was_loading_(false), | 147 tab_was_loading_(false), |
| 148 resource_dispatcher_host_notified_(false), | 148 resource_dispatcher_host_notified_(false), |
| 149 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( | 149 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( |
| 150 new InterstitialPageRVHViewDelegate(this))) { | 150 new InterstitialPageRVHViewDelegate(this))) { |
| 151 InitInterstitialPageMap(); | 151 InitInterstitialPageMap(); |
| 152 // It would be inconsistent to create an interstitial with no new navigation | 152 // It would be inconsistent to create an interstitial with no new navigation |
| 153 // (which is the case when the interstitial was triggered by a sub-resource on | 153 // (which is the case when the interstitial was triggered by a sub-resource on |
| 154 // a page) when we have a pending entry (in the process of loading a new top | 154 // a page) when we have a pending entry (in the process of loading a new top |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // new navigation. | 278 // new navigation. |
| 279 Disable(); | 279 Disable(); |
| 280 TakeActionOnResourceDispatcher(CANCEL); | 280 TakeActionOnResourceDispatcher(CANCEL); |
| 281 break; | 281 break; |
| 282 case content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: | 282 case content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: |
| 283 if (action_taken_ == NO_ACTION) { | 283 if (action_taken_ == NO_ACTION) { |
| 284 // The RenderViewHost is being destroyed (as part of the tab being | 284 // The RenderViewHost is being destroyed (as part of the tab being |
| 285 // closed); make sure we clear the blocked requests. | 285 // closed); make sure we clear the blocked requests. |
| 286 RenderViewHost* rvh = static_cast<RenderViewHost*>( | 286 RenderViewHost* rvh = static_cast<RenderViewHost*>( |
| 287 content::Source<RenderWidgetHost>(source).ptr()); | 287 content::Source<RenderWidgetHost>(source).ptr()); |
| 288 DCHECK(rvh->process()->id() == original_child_id_ && | 288 DCHECK(rvh->process()->GetID() == original_child_id_ && |
| 289 rvh->routing_id() == original_rvh_id_); | 289 rvh->routing_id() == original_rvh_id_); |
| 290 TakeActionOnResourceDispatcher(CANCEL); | 290 TakeActionOnResourceDispatcher(CANCEL); |
| 291 } | 291 } |
| 292 break; | 292 break; |
| 293 case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: | 293 case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: |
| 294 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: | 294 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: |
| 295 if (action_taken_ == NO_ACTION) { | 295 if (action_taken_ == NO_ACTION) { |
| 296 // We are navigating away from the interstitial or closing a tab with an | 296 // We are navigating away from the interstitial or closing a tab with an |
| 297 // interstitial. Default to DontProceed(). We don't just call Hide as | 297 // interstitial. Default to DontProceed(). We don't just call Hide as |
| 298 // subclasses will almost certainly override DontProceed to do some work | 298 // subclasses will almost certainly override DontProceed to do some work |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 void InterstitialPage::InterstitialPageRVHViewDelegate::TakeFocus( | 658 void InterstitialPage::InterstitialPageRVHViewDelegate::TakeFocus( |
| 659 bool reverse) { | 659 bool reverse) { |
| 660 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) | 660 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) |
| 661 interstitial_page_->tab()->GetViewDelegate()->TakeFocus(reverse); | 661 interstitial_page_->tab()->GetViewDelegate()->TakeFocus(reverse); |
| 662 } | 662 } |
| 663 | 663 |
| 664 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 664 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
| 665 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 665 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 666 int active_match_ordinal, bool final_update) { | 666 int active_match_ordinal, bool final_update) { |
| 667 } | 667 } |
| OLD | NEW |