| 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/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/thread.h" | 10 #include "base/thread.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 url_(url), | 125 url_(url), |
| 126 new_navigation_(new_navigation), | 126 new_navigation_(new_navigation), |
| 127 should_discard_pending_nav_entry_(new_navigation), | 127 should_discard_pending_nav_entry_(new_navigation), |
| 128 enabled_(true), | 128 enabled_(true), |
| 129 action_taken_(false), | 129 action_taken_(false), |
| 130 render_view_host_(NULL), | 130 render_view_host_(NULL), |
| 131 original_child_id_(tab->render_view_host()->process()->id()), | 131 original_child_id_(tab->render_view_host()->process()->id()), |
| 132 original_rvh_id_(tab->render_view_host()->routing_id()), | 132 original_rvh_id_(tab->render_view_host()->routing_id()), |
| 133 should_revert_tab_title_(false), | 133 should_revert_tab_title_(false), |
| 134 resource_dispatcher_host_notified_(false), | 134 resource_dispatcher_host_notified_(false), |
| 135 ui_loop_(MessageLoop::current()), | |
| 136 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( | 135 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( |
| 137 new InterstitialPageRVHViewDelegate(this))) { | 136 new InterstitialPageRVHViewDelegate(this))) { |
| 138 InitInterstitialPageMap(); | 137 InitInterstitialPageMap(); |
| 139 // It would be inconsistent to create an interstitial with no new navigation | 138 // It would be inconsistent to create an interstitial with no new navigation |
| 140 // (which is the case when the interstitial was triggered by a sub-resource on | 139 // (which is the case when the interstitial was triggered by a sub-resource on |
| 141 // a page) when we have a pending entry (in the process of loading a new top | 140 // a page) when we have a pending entry (in the process of loading a new top |
| 142 // frame). | 141 // frame). |
| 143 DCHECK(new_navigation || !tab->controller().pending_entry()); | 142 DCHECK(new_navigation || !tab->controller().pending_entry()); |
| 144 | 143 |
| 145 #if defined(TOOLKIT_GTK) | 144 #if defined(TOOLKIT_GTK) |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 void InterstitialPage::FocusThroughTabTraversal(bool reverse) { | 476 void InterstitialPage::FocusThroughTabTraversal(bool reverse) { |
| 478 render_view_host_->SetInitialFocus(reverse); | 477 render_view_host_->SetInitialFocus(reverse); |
| 479 } | 478 } |
| 480 | 479 |
| 481 void InterstitialPage::Disable() { | 480 void InterstitialPage::Disable() { |
| 482 enabled_ = false; | 481 enabled_ = false; |
| 483 } | 482 } |
| 484 | 483 |
| 485 void InterstitialPage::TakeActionOnResourceDispatcher( | 484 void InterstitialPage::TakeActionOnResourceDispatcher( |
| 486 ResourceRequestAction action) { | 485 ResourceRequestAction action) { |
| 487 DCHECK(MessageLoop::current() == ui_loop_) << | 486 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)) << |
| 488 "TakeActionOnResourceDispatcher should be called on the main thread."; | 487 "TakeActionOnResourceDispatcher should be called on the main thread."; |
| 489 | 488 |
| 490 if (action == CANCEL || action == RESUME) { | 489 if (action == CANCEL || action == RESUME) { |
| 491 if (resource_dispatcher_host_notified_) | 490 if (resource_dispatcher_host_notified_) |
| 492 return; | 491 return; |
| 493 resource_dispatcher_host_notified_ = true; | 492 resource_dispatcher_host_notified_ = true; |
| 494 } | 493 } |
| 495 | 494 |
| 496 // The tab might not have a render_view_host if it was closed (in which case, | 495 // The tab might not have a render_view_host if it was closed (in which case, |
| 497 // we have taken care of the blocked requests when processing | 496 // we have taken care of the blocked requests when processing |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 } | 603 } |
| 605 | 604 |
| 606 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 605 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
| 607 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 606 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 608 int active_match_ordinal, bool final_update) { | 607 int active_match_ordinal, bool final_update) { |
| 609 } | 608 } |
| 610 | 609 |
| 611 int InterstitialPage::GetBrowserWindowID() const { | 610 int InterstitialPage::GetBrowserWindowID() const { |
| 612 return tab_->GetBrowserWindowID(); | 611 return tab_->GetBrowserWindowID(); |
| 613 } | 612 } |
| OLD | NEW |