Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: components/safe_browsing_db/v4_get_hash_protocol_manager.cc

Issue 2642823013: XS: s/malware_pattern_type/malware_threat_type (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/safe_browsing_db/v4_get_hash_protocol_manager.h" 5 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64url.h" 9 #include "base/base64url.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 GET_HASH_CHECK_RESULT_MAX 112 GET_HASH_CHECK_RESULT_MAX
113 }; 113 };
114 114
115 // Record a GetHash hit result. 115 // Record a GetHash hit result.
116 void RecordV4GetHashCheckResult(V4GetHashCheckResultType result_type) { 116 void RecordV4GetHashCheckResult(V4GetHashCheckResultType result_type) {
117 UMA_HISTOGRAM_ENUMERATION("SafeBrowsing.V4GetHash.Check.Result", result_type, 117 UMA_HISTOGRAM_ENUMERATION("SafeBrowsing.V4GetHash.Check.Result", result_type,
118 GET_HASH_CHECK_RESULT_MAX); 118 GET_HASH_CHECK_RESULT_MAX);
119 } 119 }
120 120
121 const char kPermission[] = "permission"; 121 const char kPermission[] = "permission";
122 const char kPhaPatternType[] = "pha_pattern_type"; 122 const char kPhaPatternType[] = "pha_pattern_type";
Nathan Parker 2017/01/24 00:01:32 Huh, why is this one pha_PATTERN_type then? Maybe
123 const char kMalwarePatternType[] = "malware_pattern_type"; 123 const char kMalwareThreatType[] = "malware_threat_type";
124 const char kSePatternType[] = "se_pattern_type"; 124 const char kSePatternType[] = "se_pattern_type";
125 const char kLanding[] = "LANDING"; 125 const char kLanding[] = "LANDING";
126 const char kDistribution[] = "DISTRIBUTION"; 126 const char kDistribution[] = "DISTRIBUTION";
127 const char kSocialEngineeringAds[] = "SOCIAL_ENGINEERING_ADS"; 127 const char kSocialEngineeringAds[] = "SOCIAL_ENGINEERING_ADS";
128 const char kSocialEngineeringLanding[] = "SOCIAL_ENGINEERING_LANDING"; 128 const char kSocialEngineeringLanding[] = "SOCIAL_ENGINEERING_LANDING";
129 const char kPhishing[] = "PHISHING"; 129 const char kPhishing[] = "PHISHING";
130 130
131 } // namespace 131 } // namespace
132 132
133 namespace safe_browsing { 133 namespace safe_browsing {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 // For API Abuse, store a list of the returned permissions. 580 // For API Abuse, store a list of the returned permissions.
581 for (const ThreatEntryMetadata::MetadataEntry& m : 581 for (const ThreatEntryMetadata::MetadataEntry& m :
582 match.threat_entry_metadata().entries()) { 582 match.threat_entry_metadata().entries()) {
583 if (m.key() != kPermission) { 583 if (m.key() != kPermission) {
584 RecordParseGetHashResult(UNEXPECTED_METADATA_VALUE_ERROR); 584 RecordParseGetHashResult(UNEXPECTED_METADATA_VALUE_ERROR);
585 return; 585 return;
586 } 586 }
587 metadata->api_permissions.insert(m.value()); 587 metadata->api_permissions.insert(m.value());
588 } 588 }
589 } else if (match.threat_type() == MALWARE_THREAT || 589 } else if (match.threat_type() == MALWARE_THREAT ||
590 match.threat_type() == POTENTIALLY_HARMFUL_APPLICATION) { 590 match.threat_type() == POTENTIALLY_HARMFUL_APPLICATION) {
Nathan Parker 2017/01/24 00:01:32 Is this even possible? I'm wondering if we can re
591 for (const ThreatEntryMetadata::MetadataEntry& m : 591 for (const ThreatEntryMetadata::MetadataEntry& m :
592 match.threat_entry_metadata().entries()) { 592 match.threat_entry_metadata().entries()) {
593 if (m.key() == kPhaPatternType || m.key() == kMalwarePatternType) { 593 if (m.key() == kPhaPatternType || m.key() == kMalwareThreatType) {
594 if (m.value() == kLanding) { 594 if (m.value() == kLanding) {
595 metadata->threat_pattern_type = ThreatPatternType::MALWARE_LANDING; 595 metadata->threat_pattern_type = ThreatPatternType::MALWARE_LANDING;
596 break; 596 break;
597 } else if (m.value() == kDistribution) { 597 } else if (m.value() == kDistribution) {
598 metadata->threat_pattern_type = 598 metadata->threat_pattern_type =
599 ThreatPatternType::MALWARE_DISTRIBUTION; 599 ThreatPatternType::MALWARE_DISTRIBUTION;
600 break; 600 break;
601 } else { 601 } else {
602 RecordParseGetHashResult(UNEXPECTED_METADATA_VALUE_ERROR); 602 RecordParseGetHashResult(UNEXPECTED_METADATA_VALUE_ERROR);
603 return; 603 return;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 std::ostream& operator<<(std::ostream& os, const FullHashInfo& fhi) { 753 std::ostream& operator<<(std::ostream& os, const FullHashInfo& fhi) {
754 os << "{full_hash: " << fhi.full_hash << "; list_id: " << fhi.list_id 754 os << "{full_hash: " << fhi.full_hash << "; list_id: " << fhi.list_id
755 << "; positive_expiry: " << fhi.positive_expiry 755 << "; positive_expiry: " << fhi.positive_expiry
756 << "; metadata.api_permissions.size(): " 756 << "; metadata.api_permissions.size(): "
757 << fhi.metadata.api_permissions.size() << "}"; 757 << fhi.metadata.api_permissions.size() << "}";
758 return os; 758 return os;
759 } 759 }
760 #endif 760 #endif
761 761
762 } // namespace safe_browsing 762 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698