| 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/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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 TakeActionOnResourceDispatcher(RESUME); | 454 TakeActionOnResourceDispatcher(RESUME); |
| 455 | 455 |
| 456 // No need to hide if we are a new navigation, we'll get hidden when the | 456 // No need to hide if we are a new navigation, we'll get hidden when the |
| 457 // navigation is committed. | 457 // navigation is committed. |
| 458 if (!new_navigation_) { | 458 if (!new_navigation_) { |
| 459 Hide(); | 459 Hide(); |
| 460 // WARNING: we are now deleted! | 460 // WARNING: we are now deleted! |
| 461 } | 461 } |
| 462 } | 462 } |
| 463 | 463 |
| 464 std::string InterstitialPage::GetHTMLContents() { |
| 465 return std::string(); |
| 466 } |
| 467 |
| 464 void InterstitialPage::DontProceed() { | 468 void InterstitialPage::DontProceed() { |
| 465 DCHECK(action_taken_ != DONT_PROCEED_ACTION); | 469 DCHECK(action_taken_ != DONT_PROCEED_ACTION); |
| 466 | 470 |
| 467 Disable(); | 471 Disable(); |
| 468 action_taken_ = DONT_PROCEED_ACTION; | 472 action_taken_ = DONT_PROCEED_ACTION; |
| 469 | 473 |
| 470 // If this is a new navigation, we are returning to the original page, so we | 474 // If this is a new navigation, we are returning to the original page, so we |
| 471 // resume blocked requests for it. If it is not a new navigation, then it | 475 // resume blocked requests for it. If it is not a new navigation, then it |
| 472 // means the interstitial was shown as a result of a resource loading in the | 476 // means the interstitial was shown as a result of a resource loading in the |
| 473 // page and we won't return to the original page, so we cancel blocked | 477 // page and we won't return to the original page, so we cancel blocked |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 524 |
| 521 void InterstitialPage::Focus() { | 525 void InterstitialPage::Focus() { |
| 522 // Focus the native window. | 526 // Focus the native window. |
| 523 render_view_host_->view()->Focus(); | 527 render_view_host_->view()->Focus(); |
| 524 } | 528 } |
| 525 | 529 |
| 526 void InterstitialPage::FocusThroughTabTraversal(bool reverse) { | 530 void InterstitialPage::FocusThroughTabTraversal(bool reverse) { |
| 527 render_view_host_->SetInitialFocus(reverse); | 531 render_view_host_->SetInitialFocus(reverse); |
| 528 } | 532 } |
| 529 | 533 |
| 534 ViewType::Type InterstitialPage::GetRenderViewType() const { |
| 535 return ViewType::INTERSTITIAL_PAGE; |
| 536 } |
| 537 |
| 530 void InterstitialPage::Disable() { | 538 void InterstitialPage::Disable() { |
| 531 enabled_ = false; | 539 enabled_ = false; |
| 532 } | 540 } |
| 533 | 541 |
| 534 void InterstitialPage::TakeActionOnResourceDispatcher( | 542 void InterstitialPage::TakeActionOnResourceDispatcher( |
| 535 ResourceRequestAction action) { | 543 ResourceRequestAction action) { |
| 536 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)) << | 544 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)) << |
| 537 "TakeActionOnResourceDispatcher should be called on the main thread."; | 545 "TakeActionOnResourceDispatcher should be called on the main thread."; |
| 538 | 546 |
| 539 if (action == CANCEL || action == RESUME) { | 547 if (action == CANCEL || action == RESUME) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 | 723 |
| 716 void InterstitialPage::UpdateInspectorSetting(const std::string& key, | 724 void InterstitialPage::UpdateInspectorSetting(const std::string& key, |
| 717 const std::string& value) { | 725 const std::string& value) { |
| 718 RenderViewHostDelegateHelper::UpdateInspectorSetting( | 726 RenderViewHostDelegateHelper::UpdateInspectorSetting( |
| 719 tab_->profile(), key, value); | 727 tab_->profile(), key, value); |
| 720 } | 728 } |
| 721 | 729 |
| 722 void InterstitialPage::ClearInspectorSettings() { | 730 void InterstitialPage::ClearInspectorSettings() { |
| 723 RenderViewHostDelegateHelper::ClearInspectorSettings(tab_->profile()); | 731 RenderViewHostDelegateHelper::ClearInspectorSettings(tab_->profile()); |
| 724 } | 732 } |
| OLD | NEW |