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

Unified Diff: components/safe_browsing_db/v4_protocol_manager_util.h

Issue 2057433002: Replace the old URL format for PVer4 requests with the new format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move #include to *.cc and use forward declaration in .h Created 4 years, 6 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.h
diff --git a/components/safe_browsing_db/v4_protocol_manager_util.h b/components/safe_browsing_db/v4_protocol_manager_util.h
index 9c051fb49ef2db974f2931841f5a7fd2b3e402ed..caa5f412480631500ef6a43d89767afa6673e2b9 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util.h
+++ b/components/safe_browsing_db/v4_protocol_manager_util.h
@@ -16,6 +16,10 @@
#include "net/url_request/url_request_status.h"
#include "url/gurl.h"
+namespace net {
+class HttpRequestHeaders;
+} // namespace net
+
namespace safe_browsing {
// Config passed to the constructor of a V4 protocol manager.
struct V4ProtocolConfig {
@@ -93,14 +97,16 @@ class V4ProtocolManagerUtil {
const net::URLRequestStatus& status,
int response_code);
- // Generates a Pver4 request URL.
+ // Generates a Pver4 request URL and sets the appropriate header values.
// |request_base64| is the serialized request protocol buffer encoded in
// base 64.
// |method_name| is the name of the method to call, as specified in the proto,
- // |config| is an instance of V4ProtocolConfig that stores the client config.
- static GURL GetRequestUrl(const std::string& request_base64,
- const std::string& method_name,
- const V4ProtocolConfig& config);
+ // |config| is an instance of V4ProtocolConfig that stores the client config,
+ // |headers| is populated with the appropriate header values.
+ static GURL GetRequestUrlAndUpdateHeaders(const std::string& request_base64,
+ const std::string& method_name,
+ const V4ProtocolConfig& config,
+ net::HttpRequestHeaders* headers);
// Worker function for calculating the backoff times.
// |multiplier| is doubled for each consecutive error after the
@@ -113,7 +119,7 @@ class V4ProtocolManagerUtil {
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4ProtocolManagerUtilTest,
TestBackOffLogic);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4ProtocolManagerUtilTest,
- TestGetRequestUrl);
+ TestGetRequestUrlAndUpdateHeaders);
// Composes a URL using |prefix|, |method| (e.g.: encodedFullHashes).
// |request_base64|, |client_id|, |version| and |key_param|. |prefix|
@@ -121,10 +127,11 @@ class V4ProtocolManagerUtil {
static std::string ComposeUrl(const std::string& prefix,
const std::string& method,
const std::string& request_base64,
- const std::string& client_id,
- const std::string& version,
const std::string& key_param);
+ // Sets the HTTP headers expected by a standard PVer4 request.
+ static void UpdateHeaders(net::HttpRequestHeaders* headers);
+
DISALLOW_COPY_AND_ASSIGN(V4ProtocolManagerUtil);
};

Powered by Google App Engine
This is Rietveld 408576698