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

Unified Diff: components/safe_browsing_db/v4_protocol_manager_util.cc

Issue 2495783003: Implement support for checking bad IPs aka MatchMalwareIP (Closed)
Patch Set: shess@ review and trying to fix Windows build error Created 4 years, 1 month 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 5d2511551bff93aca15624094772c25f7ff5dcdc..4656d44270e2e30405541cca6b3ad7be416be523 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util.cc
+++ b/components/safe_browsing_db/v4_protocol_manager_util.cc
@@ -11,6 +11,7 @@
#include "base/strings/stringprintf.h"
#include "crypto/sha2.h"
#include "net/base/escape.h"
+#include "net/base/ip_address.h"
#include "net/http/http_request_headers.h"
#include "url/url_util.h"
@@ -85,6 +86,10 @@ return LINUX_PLATFORM;
#endif
}
+const ListIdentifier GetAnyIpMalwareId() {
+ return ListIdentifier(ANY_PLATFORM, IP_RANGE, MALWARE_THREAT);
+}
+
const ListIdentifier GetChromeUrlApiId() {
return ListIdentifier(CHROME_PLATFORM, URL, API_ABUSE);
}
@@ -528,4 +533,16 @@ void V4ProtocolManagerUtil::SetClientInfoFromConfig(
client_info->set_client_version(config.version);
}
+// static
+bool V4ProtocolManagerUtil::GetIPV6AddressFromString(
+ const std::string& ip_address,
+ net::IPAddress* address) {
+ DCHECK(address);
+ if (!address->AssignFromIPLiteral(ip_address))
+ return false;
+ if (address->IsIPv4())
+ *address = net::ConvertIPv4ToIPv4MappedIPv6(*address);
+ return address->IsIPv6();
+}
+
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698