Chromium Code Reviews| Index: components/safe_browsing_db/v4_protocol_manager_util.cc |
| diff --git a/components/safe_browsing_db/v4_protocol_manager_util.cc b/components/safe_browsing_db/v4_protocol_manager_util.cc |
| index c9f5349d3c5bdfa7a32f3ebf0f0a07714edb49bd..e5ee76e547f79b7339ffff8a26ad863eb068fd1e 100644 |
| --- a/components/safe_browsing_db/v4_protocol_manager_util.cc |
| +++ b/components/safe_browsing_db/v4_protocol_manager_util.cc |
| @@ -62,9 +62,9 @@ std::string Escape(const std::string& url) { |
| } // namespace |
| std::ostream& operator<<(std::ostream& os, const ListIdentifier& id) { |
| - os << "{hash: " << id.hash() << "; platform_type: " << id.platform_type |
| - << "; threat_entry_type: " << id.threat_entry_type |
| - << "; threat_type: " << id.threat_type << "}"; |
| + os << "{hash: " << id.hash() << "; platform_type: " << id.platform_type() |
| + << "; threat_entry_type: " << id.threat_entry_type() |
| + << "; threat_type: " << id.threat_type() << "}"; |
| return os; |
| } |
| @@ -86,16 +86,18 @@ return LINUX_PLATFORM; |
| } |
| const ListIdentifier GetChromeUrlApiId() { |
| - return ListIdentifier(CHROME_PLATFORM, URL, API_ABUSE); |
| + return ListIdentifier(CHROME_PLATFORM, URL, API_ABUSE, |
| + SB_THREAT_TYPE_API_ABUSE); |
| } |
| const ListIdentifier GetUrlMalwareId() { |
| - return ListIdentifier(GetCurrentPlatformType(), URL, MALWARE_THREAT); |
| + return ListIdentifier(GetCurrentPlatformType(), URL, MALWARE_THREAT, |
| + SB_THREAT_TYPE_URL_MALWARE); |
| } |
| const ListIdentifier GetUrlSocEngId() { |
| return ListIdentifier(GetCurrentPlatformType(), URL, |
| - SOCIAL_ENGINEERING_PUBLIC); |
| + SOCIAL_ENGINEERING_PUBLIC, SB_THREAT_TYPE_URL_PHISHING); |
| } |
| // The Safe Browsing V4 server URL prefix. |
| @@ -123,9 +125,9 @@ size_t StoreAndHashPrefix::hash() const { |
| } |
| bool ListIdentifier::operator==(const ListIdentifier& other) const { |
| - return platform_type == other.platform_type && |
| - threat_entry_type == other.threat_entry_type && |
| - threat_type == other.threat_type; |
| + return platform_type_ == other.platform_type_ && |
| + threat_entry_type_ == other.threat_entry_type_ && |
| + threat_type_ == other.threat_type_; |
|
Nathan Parker
2016/09/21 19:02:57
Why not compare SBThreatType as well? And in the
vakh (use Gerrit instead)
2016/09/22 00:10:36
This triad is sufficient to identify a list.
Anywa
|
| } |
| bool ListIdentifier::operator!=(const ListIdentifier& other) const { |
| @@ -133,9 +135,9 @@ bool ListIdentifier::operator!=(const ListIdentifier& other) const { |
| } |
| size_t ListIdentifier::hash() const { |
| - std::size_t first = std::hash<unsigned int>()(platform_type); |
| - std::size_t second = std::hash<unsigned int>()(threat_entry_type); |
| - std::size_t third = std::hash<unsigned int>()(threat_type); |
| + std::size_t first = std::hash<unsigned int>()(platform_type_); |
| + std::size_t second = std::hash<unsigned int>()(threat_entry_type_); |
| + std::size_t third = std::hash<unsigned int>()(threat_type_); |
| std::size_t interim = base::HashInts(first, second); |
| return base::HashInts(interim, third); |
| @@ -145,14 +147,23 @@ ListIdentifier::ListIdentifier() {} |
| ListIdentifier::ListIdentifier(PlatformType platform_type, |
| ThreatEntryType threat_entry_type, |
| - ThreatType threat_type) |
| - : platform_type(platform_type), |
| - threat_entry_type(threat_entry_type), |
| - threat_type(threat_type) { |
| + ThreatType threat_type, |
| + SBThreatType sb_threat_type) |
| + : platform_type_(platform_type), |
| + threat_entry_type_(threat_entry_type), |
| + threat_type_(threat_type), |
| + sb_threat_type_(sb_threat_type) { |
| DCHECK(PlatformType_IsValid(platform_type)); |
| DCHECK(ThreatEntryType_IsValid(threat_entry_type)); |
| DCHECK(ThreatType_IsValid(threat_type)); |
| } |
| +ListIdentifier::ListIdentifier(PlatformType platform_type, |
| + ThreatEntryType threat_entry_type, |
| + ThreatType threat_type) |
| + : ListIdentifier(platform_type, |
| + threat_entry_type, |
| + threat_type, |
| + SB_THREAT_TYPE_SAFE) {} |
| ListIdentifier::ListIdentifier(const ListUpdateResponse& response) |
| : ListIdentifier(response.platform_type(), |