| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Implementation of the SafeBrowsingBlockingPage class. | 5 // Implementation of the SafeBrowsingBlockingPage class. |
| 6 | 6 |
| 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 main_frame_url, resources); | 451 main_frame_url, resources); |
| 452 } | 452 } |
| 453 | 453 |
| 454 // static | 454 // static |
| 455 void SafeBrowsingBlockingPage::ShowBlockingPage( | 455 void SafeBrowsingBlockingPage::ShowBlockingPage( |
| 456 SafeBrowsingUIManager* ui_manager, | 456 SafeBrowsingUIManager* ui_manager, |
| 457 const UnsafeResource& unsafe_resource) { | 457 const UnsafeResource& unsafe_resource) { |
| 458 DVLOG(1) << __func__ << " " << unsafe_resource.url.spec(); | 458 DVLOG(1) << __func__ << " " << unsafe_resource.url.spec(); |
| 459 WebContents* web_contents = unsafe_resource.web_contents_getter.Run(); | 459 WebContents* web_contents = unsafe_resource.web_contents_getter.Run(); |
| 460 | 460 |
| 461 InterstitialPage* interstitial = | 461 if (!InterstitialPage::GetInterstitialPage(web_contents) || |
| 462 InterstitialPage::GetInterstitialPage(web_contents); | 462 !unsafe_resource.is_subresource) { |
| 463 if (interstitial && !unsafe_resource.is_subresource) { | 463 // There is no interstitial currently showing in that tab, or we are about |
| 464 // There is already an interstitial showing and we are about to display a | 464 // to display a new one for the main frame. If there is already an |
| 465 // new one for the main frame. Just hide the current one, it is now | 465 // interstitial, showing the new one will automatically hide the old one. |
| 466 // irrelevent | |
| 467 interstitial->DontProceed(); | |
| 468 interstitial = NULL; | |
| 469 } | |
| 470 | |
| 471 if (!interstitial) { | |
| 472 // There are no interstitial currently showing in that tab, go ahead and | |
| 473 // show this interstitial. | |
| 474 content::NavigationEntry* entry = | 466 content::NavigationEntry* entry = |
| 475 unsafe_resource.GetNavigationEntryForResource(); | 467 unsafe_resource.GetNavigationEntryForResource(); |
| 476 SafeBrowsingBlockingPage* blocking_page = | 468 SafeBrowsingBlockingPage* blocking_page = |
| 477 CreateBlockingPage(ui_manager, web_contents, | 469 CreateBlockingPage(ui_manager, web_contents, |
| 478 entry ? entry->GetURL() : GURL(), unsafe_resource); | 470 entry ? entry->GetURL() : GURL(), unsafe_resource); |
| 479 blocking_page->Show(); | 471 blocking_page->Show(); |
| 480 return; | 472 return; |
| 481 } | 473 } |
| 482 | 474 |
| 483 // This is an interstitial for a page's resource, let's queue it. | 475 // This is an interstitial for a page's resource, let's queue it. |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, | 759 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, |
| 768 GetFormattedHostName())); | 760 GetFormattedHostName())); |
| 769 load_time_data->SetString( | 761 load_time_data->SetString( |
| 770 "finalParagraph", | 762 "finalParagraph", |
| 771 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); | 763 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); |
| 772 | 764 |
| 773 PopulateExtendedReportingOption(load_time_data); | 765 PopulateExtendedReportingOption(load_time_data); |
| 774 } | 766 } |
| 775 | 767 |
| 776 } // namespace safe_browsing | 768 } // namespace safe_browsing |
| OLD | NEW |