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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 } | 535 } |
| 536 | 536 |
| 537 std::string SafeBrowsingBlockingPage::GetMetricPrefix() const { | 537 std::string SafeBrowsingBlockingPage::GetMetricPrefix() const { |
| 538 bool primary_subresource = unsafe_resources_[0].is_subresource; | 538 bool primary_subresource = unsafe_resources_[0].is_subresource; |
| 539 switch (interstitial_reason_) { | 539 switch (interstitial_reason_) { |
| 540 case SB_REASON_MALWARE: | 540 case SB_REASON_MALWARE: |
| 541 return primary_subresource ? "malware_subresource" : "malware"; | 541 return primary_subresource ? "malware_subresource" : "malware"; |
| 542 case SB_REASON_HARMFUL: | 542 case SB_REASON_HARMFUL: |
| 543 return primary_subresource ? "harmful_subresource" : "harmful"; | 543 return primary_subresource ? "harmful_subresource" : "harmful"; |
| 544 case SB_REASON_PHISHING: | 544 case SB_REASON_PHISHING: |
| 545 return primary_subresource ? "phishing_subresource" : "phishing"; | 545 ThreatPatternType threat_pattern_type = |
| 546 unsafe_resources_[0].threat_metadata.threat_pattern_type; | |
| 547 if (threat_pattern_type == ThreatPatternType::PHISHING || | |
| 548 threat_pattern_type == ThreatPatternType::NONE) | |
| 549 return primary_subresource ? "phishing_subresource" : "phishing"; | |
| 550 else if (threat_pattern_type == ThreatPatternType::SOCIAL_ENGINEERING_ADS) | |
| 551 return primary_subresource ? "social_engineering_ads_subresource" | |
| 552 : "social_engineering_ads"; | |
| 553 else if (threat_pattern_type == | |
| 554 ThreatPatternType::SOCIAL_ENGINEERING_LANDING) | |
| 555 return primary_subresource ? "social_engineering_landing_subresource" | |
| 556 : "social_engineering_landing"; | |
| 546 } | 557 } |
| 547 NOTREACHED(); | 558 NOTREACHED(); |
| 548 return std::string(); | 559 return std::string(); |
|
Nathan Parker
2016/05/17 19:23:58
Maybe this should return "unknown_interstitial_typ
Jialiu Lin
2016/05/17 20:32:24
Changed from std::string() to "unkown_metric_prefi
| |
| 549 } | 560 } |
| 550 | 561 |
| 551 // We populate a parallel set of metrics to differentiate some threat sources. | 562 // We populate a parallel set of metrics to differentiate some threat sources. |
| 552 std::string SafeBrowsingBlockingPage::GetExtraMetricsSuffix() const { | 563 std::string SafeBrowsingBlockingPage::GetExtraMetricsSuffix() const { |
| 553 switch (unsafe_resources_[0].threat_source) { | 564 switch (unsafe_resources_[0].threat_source) { |
| 554 case safe_browsing::ThreatSource::DATA_SAVER: | 565 case safe_browsing::ThreatSource::DATA_SAVER: |
| 555 return "from_data_saver"; | 566 return "from_data_saver"; |
| 556 case safe_browsing::ThreatSource::REMOTE: | 567 case safe_browsing::ThreatSource::REMOTE: |
| 557 case safe_browsing::ThreatSource::LOCAL_PVER3: | 568 case safe_browsing::ThreatSource::LOCAL_PVER3: |
| 558 // REMOTE and LOCAL_PVER3 can be distinguished in the logs | 569 // REMOTE and LOCAL_PVER3 can be distinguished in the logs |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 } else { | 752 } else { |
| 742 load_time_data->SetString( | 753 load_time_data->SetString( |
| 743 "finalParagraph", | 754 "finalParagraph", |
| 744 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); | 755 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); |
| 745 } | 756 } |
| 746 | 757 |
| 747 PopulateExtendedReportingOption(load_time_data); | 758 PopulateExtendedReportingOption(load_time_data); |
| 748 } | 759 } |
| 749 | 760 |
| 750 } // namespace safe_browsing | 761 } // namespace safe_browsing |
| OLD | NEW |