Chromium Code Reviews| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 main_frame_url, resources); | 447 main_frame_url, resources); |
| 448 } | 448 } |
| 449 | 449 |
| 450 // static | 450 // static |
| 451 void SafeBrowsingBlockingPage::ShowBlockingPage( | 451 void SafeBrowsingBlockingPage::ShowBlockingPage( |
| 452 SafeBrowsingUIManager* ui_manager, | 452 SafeBrowsingUIManager* ui_manager, |
| 453 const UnsafeResource& unsafe_resource) { | 453 const UnsafeResource& unsafe_resource) { |
| 454 DVLOG(1) << __func__ << " " << unsafe_resource.url.spec(); | 454 DVLOG(1) << __func__ << " " << unsafe_resource.url.spec(); |
| 455 WebContents* web_contents = unsafe_resource.web_contents_getter.Run(); | 455 WebContents* web_contents = unsafe_resource.web_contents_getter.Run(); |
| 456 | 456 |
| 457 InterstitialPage* interstitial = | 457 if (!InterstitialPage::GetInterstitialPage(web_contents) || |
| 458 InterstitialPage::GetInterstitialPage(web_contents); | 458 !unsafe_resource.is_subresource) { |
| 459 if (interstitial && !unsafe_resource.is_subresource) { | 459 // There is no interstitial currently showing in that tab, or we are about |
| 460 // There is already an interstitial showing and we are about to display a | 460 // to display a new one for the main frame. If there is already an |
| 461 // new one for the main frame. Just hide the current one, it is now | 461 // interstitial, showing the new one will automatically hide the old one. |
|
Nathan Parker
2016/11/17 20:08:24
What causes the old one to get hidden? And do we
mattm
2016/11/17 21:22:09
https://cs.chromium.org/chromium/src/content/brows
| |
| 462 // irrelevent | |
| 463 interstitial->DontProceed(); | |
| 464 interstitial = NULL; | |
| 465 } | |
| 466 | |
| 467 if (!interstitial) { | |
| 468 // There are no interstitial currently showing in that tab, go ahead and | |
| 469 // show this interstitial. | |
| 470 content::NavigationEntry* entry = | 462 content::NavigationEntry* entry = |
| 471 unsafe_resource.GetNavigationEntryForResource(); | 463 unsafe_resource.GetNavigationEntryForResource(); |
| 472 SafeBrowsingBlockingPage* blocking_page = | 464 SafeBrowsingBlockingPage* blocking_page = |
| 473 CreateBlockingPage(ui_manager, web_contents, | 465 CreateBlockingPage(ui_manager, web_contents, |
| 474 entry ? entry->GetURL() : GURL(), unsafe_resource); | 466 entry ? entry->GetURL() : GURL(), unsafe_resource); |
| 475 blocking_page->Show(); | 467 blocking_page->Show(); |
| 476 return; | 468 return; |
| 477 } | 469 } |
| 478 | 470 |
| 479 // This is an interstitial for a page's resource, let's queue it. | 471 // This is an interstitial for a page's resource, let's queue it. |
|
Nathan Parker
2016/11/17 20:08:24
note: felt mentioned that we no longer queue inter
mattm
2016/11/17 21:22:09
That's doesn't seem to be entirely true. I think w
| |
| 480 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); | 472 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); |
| 481 (*unsafe_resource_map)[web_contents].push_back(unsafe_resource); | 473 (*unsafe_resource_map)[web_contents].push_back(unsafe_resource); |
| 482 } | 474 } |
| 483 | 475 |
| 484 // static | 476 // static |
| 485 bool SafeBrowsingBlockingPage::IsMainPageLoadBlocked( | 477 bool SafeBrowsingBlockingPage::IsMainPageLoadBlocked( |
| 486 const UnsafeResourceList& unsafe_resources) { | 478 const UnsafeResourceList& unsafe_resources) { |
| 487 // If there is more than one unsafe resource, the main page load must not be | 479 // If there is more than one unsafe resource, the main page load must not be |
| 488 // blocked. Otherwise, check if the one resource is. | 480 // blocked. Otherwise, check if the one resource is. |
| 489 return unsafe_resources.size() == 1 && | 481 return unsafe_resources.size() == 1 && |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 763 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, | 755 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, |
| 764 GetFormattedHostName())); | 756 GetFormattedHostName())); |
| 765 load_time_data->SetString( | 757 load_time_data->SetString( |
| 766 "finalParagraph", | 758 "finalParagraph", |
| 767 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); | 759 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); |
| 768 | 760 |
| 769 PopulateExtendedReportingOption(load_time_data); | 761 PopulateExtendedReportingOption(load_time_data); |
| 770 } | 762 } |
| 771 | 763 |
| 772 } // namespace safe_browsing | 764 } // namespace safe_browsing |
| OLD | NEW |