| 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 } | 518 } |
| 519 | 519 |
| 520 // This is an interstitial for a page's resource, let's queue it. | 520 // This is an interstitial for a page's resource, let's queue it. |
| 521 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); | 521 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); |
| 522 (*unsafe_resource_map)[web_contents].push_back(unsafe_resource); | 522 (*unsafe_resource_map)[web_contents].push_back(unsafe_resource); |
| 523 } | 523 } |
| 524 | 524 |
| 525 // static | 525 // static |
| 526 bool SafeBrowsingBlockingPage::IsMainPageLoadBlocked( | 526 bool SafeBrowsingBlockingPage::IsMainPageLoadBlocked( |
| 527 const UnsafeResourceList& unsafe_resources) { | 527 const UnsafeResourceList& unsafe_resources) { |
| 528 // Client-side phishing detection interstitials never block the main frame | 528 // If there is more than one unsafe resource, the main page load must not be |
| 529 // load, since they happen after the page is finished loading. | 529 // blocked. Otherwise, check if the one resource is. |
| 530 if (unsafe_resources[0].threat_type == | 530 return unsafe_resources.size() == 1 && |
| 531 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) { | 531 unsafe_resources[0].IsMainPageLoadBlocked(); |
| 532 return false; | |
| 533 } | |
| 534 | |
| 535 // Otherwise, check the threat type. | |
| 536 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; | |
| 537 } | 532 } |
| 538 | 533 |
| 539 std::string SafeBrowsingBlockingPage::GetMetricPrefix() const { | 534 std::string SafeBrowsingBlockingPage::GetMetricPrefix() const { |
| 540 bool primary_subresource = unsafe_resources_[0].is_subresource; | 535 bool primary_subresource = unsafe_resources_[0].is_subresource; |
| 541 switch (interstitial_reason_) { | 536 switch (interstitial_reason_) { |
| 542 case SB_REASON_MALWARE: | 537 case SB_REASON_MALWARE: |
| 543 return primary_subresource ? "malware_subresource" : "malware"; | 538 return primary_subresource ? "malware_subresource" : "malware"; |
| 544 case SB_REASON_HARMFUL: | 539 case SB_REASON_HARMFUL: |
| 545 return primary_subresource ? "harmful_subresource" : "harmful"; | 540 return primary_subresource ? "harmful_subresource" : "harmful"; |
| 546 case SB_REASON_PHISHING: | 541 case SB_REASON_PHISHING: |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 } else { | 723 } else { |
| 729 load_time_data->SetString( | 724 load_time_data->SetString( |
| 730 "finalParagraph", | 725 "finalParagraph", |
| 731 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); | 726 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); |
| 732 } | 727 } |
| 733 | 728 |
| 734 PopulateExtendedReportingOption(load_time_data); | 729 PopulateExtendedReportingOption(load_time_data); |
| 735 } | 730 } |
| 736 | 731 |
| 737 } // namespace safe_browsing | 732 } // namespace safe_browsing |
| OLD | NEW |