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

Unified Diff: components/safe_browsing_db/v4_protocol_manager_util.cc

Issue 2353413002: Store list information in ListInfo (was: StoreIdAndFIleName) (Closed)
Patch Set: s/StoreIdAndFileName/ListInfo. Move SBThreatType into ListInfo. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
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_;
}
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(),

Powered by Google App Engine
This is Rietveld 408576698