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

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

Issue 1543153002: Add a GetFullHashWithApis method to Protocol Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review Comments Created 5 years 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: 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 1d33c52e311de215bf346fd894c75648289630fb..63a151fa18fdbe6702c218b3f1c56d38797754fd 100644
--- a/chrome/browser/safe_browsing/protocol_manager.h
+++ b/chrome/browser/safe_browsing/protocol_manager.h
@@ -28,6 +28,7 @@
#include "chrome/browser/safe_browsing/protocol_manager_helper.h"
#include "chrome/browser/safe_browsing/protocol_parser.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
+#include "components/safe_browsing_db/safebrowsing.pb.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_status.h"
#include "url/gurl.h"
@@ -83,6 +84,19 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
bool is_download,
bool is_extended_reporting);
+ // Retrieve the full hash for a set of prefixes, and invoke the callback
+ // 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,
+ ThreatType threat_type,
+ FullHashCallback callback);
+
+ // Retrieve the full hash and API metadata for a set of prefixes, and invoke
+ // the callback argument when the results are retrieved. The callback may be
+ // invoked synchronously. Uses the V4 Safe Browsing protocol.
+ virtual void GetFullHashesWithApis(const std::vector<SBPrefix>& prefixes,
+ FullHashCallback callback);
+
// Forces the start of next update after |interval| time.
void ForceScheduleNextUpdate(base::TimeDelta interval);
@@ -185,6 +199,10 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestChunkStrings);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestGetHashUrl);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest,
+ TestGetV4HashUrl);
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest,
+ TestGetV4HashRequest);
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest,
TestGetHashBackOffTimes);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestNextChunkUrl);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestUpdateUrl);
@@ -220,6 +238,16 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
GURL GetHashUrl(bool is_extended_reporting) const;
// Generates URL for reporting safe browsing hits for UMA users.
+ // Generates GetHashWithApis Pver4 request URL for retrieving full hashes.
+ // |request_base64| is the serialized FindFullHashesRequest protocol buffer
+ // encoded in base 64.
+ GURL GetV4HashUrl(const std::string& request_base64) const;
+
+ // Fills a FindFullHashesRequest protocol buffer for an API_ABUSE request.
+ // Returns the serialized and base 64 encoded request as a string.
+ std::string GetV4HashRequest(const std::vector<SBPrefix>& prefixes,
+ ThreatType threat_type);
+
// Composes a ChunkUrl based on input string.
GURL NextChunkUrl(const std::string& input) const;
@@ -333,6 +361,7 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
std::deque<ChunkUrl> chunk_request_urls_;
HashRequests hash_requests_;
+ HashRequests v4_hash_requests_;
// True if the service has been given an add/sub chunk but it hasn't been
// added to the database yet.
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/protocol_manager.cc » ('j') | chrome/browser/safe_browsing/protocol_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698