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

Unified Diff: chrome/browser/safe_browsing/protocol_manager.h

Issue 1556613002: Adds SB V4 response handler to Protocol Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@osb-pm-1
Patch Set: Rebase Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/protocol_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/protocol_manager.h
diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h
index 70e6bcba5510ab5d7c9013607cd824e6ae2c6259..fe354284b81f6e4f91571023dcbbb046a537457c 100644
--- a/chrome/browser/safe_browsing/protocol_manager.h
+++ b/chrome/browser/safe_browsing/protocol_manager.h
@@ -91,6 +91,7 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
// argument when the results are retrieved. The callback may be invoked
// synchronously. Uses the V4 Safe Browsing protocol.
virtual void GetV4FullHashes(const std::vector<SBPrefix>& prefixes,
+ const std::vector<PlatformType>& platforms,
ThreatType threat_type,
FullHashCallback callback);
@@ -206,6 +207,14 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest,
TestGetV4HashRequest);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest,
+ TestParseV4HashResponse);
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest,
+ TestParseV4HashResponseWrongThreatEntryType);
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest,
+ TestParseV4HashResponseSocialEngineeringThreatType);
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest,
+ TestParseV4HashResponseNonPermissionMetadata);
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest,
TestGetHashBackOffTimes);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestNextChunkUrl);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestUpdateUrl);
@@ -246,11 +255,21 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
// encoded in base 64.
GURL GetV4HashUrl(const std::string& request_base64) const;
- // Fills a FindFullHashesRequest protocol buffer for an API_ABUSE request.
+ // Fills a FindFullHashesRequest protocol buffer for a V4 request.
// Returns the serialized and base 64 encoded request as a string.
std::string GetV4HashRequest(const std::vector<SBPrefix>& prefixes,
+ const std::vector<PlatformType>& platforms,
ThreatType threat_type);
+ // Parses a FindFullHashesResponse protocol buffer and fills the results in
+ // |full_hashes| and |negative_cache_duration|. |data| is a serialized
+ // FindFullHashes protocol buffer. |negative_cache_duration| is the duration
+ // to cache the response for entities that did not match the threat list.
+ // Returns true if parsing is successful, false otherwise.
+ bool ParseV4HashResponse(const std::string& data_base64,
+ std::vector<SBFullHashResult>* full_hashes,
+ base::TimeDelta* negative_cache_duration);
+
// Composes a ChunkUrl based on input string.
GURL NextChunkUrl(const std::string& input) const;
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/protocol_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698