Chromium Code Reviews| 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 92a1b84eb02dbc8fb36cb4348089b67a63ce5167..7edd483de5e2cf860bd5cec77f065b7044b062aa 100644 |
| --- a/components/safe_browsing_db/v4_protocol_manager_util.h |
| +++ b/components/safe_browsing_db/v4_protocol_manager_util.h |
| @@ -8,6 +8,7 @@ |
| // A class that implements the stateless methods used by the GetHashUpdate and |
| // GetFullHash stubby calls made by Chrome using the SafeBrowsing V4 protocol. |
| +#include <ostream> |
| #include <string> |
| #include "base/gtest_prod_util.h" |
| @@ -21,6 +22,10 @@ class HttpRequestHeaders; |
| } // namespace net |
| namespace safe_browsing { |
| + |
| +typedef FetchThreatListUpdatesRequest::ListUpdateRequest ListUpdateRequest; |
| +typedef FetchThreatListUpdatesResponse::ListUpdateResponse ListUpdateResponse; |
| + |
| // Config passed to the constructor of a V4 protocol manager. |
| struct V4ProtocolConfig { |
| // The safe browsing client name sent in each request. |
| @@ -51,11 +56,30 @@ struct UpdateListIdentifier { |
| ThreatEntryType threat_entry_type; |
| ThreatType threat_type; |
| + UpdateListIdentifier(); |
| + UpdateListIdentifier(PlatformType, ThreatEntryType, ThreatType); |
| + UpdateListIdentifier(const ListUpdateResponse&); |
| + |
| bool operator==(const UpdateListIdentifier& other) const; |
| bool operator!=(const UpdateListIdentifier& other) const; |
| size_t hash() const; |
| }; |
| +std::ostream& operator<<(std::ostream& os, const UpdateListIdentifier& id); |
| + |
| +// This defines a hash_map that is used to create the backing files for the |
| +// stores that contain the hash-prefixes. The map key identifies the list that |
| +// we're interested in and the value represents the ASCII file-name that'll be |
| +// created on-disk to store the hash-prefixes for that list. This file is |
| +// created inside the user's profile directory. |
|
Nathan Parker
2016/06/15 21:24:19
s/profile/data
The'll be one set of files shared
vakh (use Gerrit instead)
2016/06/16 01:07:35
Done.
|
| +// For instance, the UpdateListIdentifier could be for URL expressions for UwS |
|
Nathan Parker
2016/06/15 21:24:19
How about just referencing the place that defines
vakh (use Gerrit instead)
2016/06/16 01:07:35
There's no such place right now. The only place wh
|
| +// on Windows platform, and the corresponding file on disk could be named: |
| +// "uws_win_url.store" |
| +typedef base::hash_map<UpdateListIdentifier, std::string> StoreFileNameMap; |
| + |
| +// Used to represent the state of each store. |
| +typedef base::hash_map<UpdateListIdentifier, std::string> StoreStateMap; |
| + |
| // Enumerate failures for histogramming purposes. DO NOT CHANGE THE |
| // ORDERING OF THESE VALUES. |
| enum V4OperationResult { |
| @@ -105,10 +129,10 @@ class V4ProtocolManagerUtil { |
| // |gurl| is set to the value of the PVer4 request URL, |
| // |headers| is populated with the appropriate header values. |
| static void GetRequestUrlAndHeaders(const std::string& request_base64, |
| - const std::string& method_name, |
| - const V4ProtocolConfig& config, |
| - GURL* gurl, |
| - net::HttpRequestHeaders* headers); |
| + const std::string& method_name, |
| + const V4ProtocolConfig& config, |
| + GURL* gurl, |
| + net::HttpRequestHeaders* headers); |
| // Worker function for calculating the backoff times. |
| // |multiplier| is doubled for each consecutive error after the |