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

Unified Diff: components/safe_browsing_db/v4_protocol_manager_util.h

Issue 2062013002: Fetch incremental updates. Store new state in V4Store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor: Fix DCHECK 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 92a1b84eb02dbc8fb36cb4348089b67a63ce5167..7b510de3dedf59396fa290aebdfe411106bfd1b5 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.
@@ -47,15 +52,36 @@ struct V4ProtocolConfig {
// threat_entry_type = EXECUTABLE,
// threat_type = MALWARE
struct UpdateListIdentifier {
+ public:
PlatformType platform_type;
ThreatEntryType threat_entry_type;
ThreatType threat_type;
+ UpdateListIdentifier(PlatformType, ThreatEntryType, ThreatType);
+ UpdateListIdentifier(const ListUpdateResponse&);
+
bool operator==(const UpdateListIdentifier& other) const;
bool operator!=(const UpdateListIdentifier& other) const;
size_t hash() const;
+
+ private:
+ UpdateListIdentifier();
};
+std::ostream& operator<<(std::ostream& os, const UpdateListIdentifier& id);
+
+// The set of interesting lists and ASCII filenames for their hash prefix
+// stores. The stores are created inside the user-data directory.
+// For instance, the UpdateListIdentifier could be for URL expressions for UwS
+// on Windows platform, and the corresponding file on disk could be named:
+// "uws_win_url.store"
+// TODO(vakh): Find the canonical place where these are defined and update the
+// comment to point to that place.
+typedef base::hash_map<UpdateListIdentifier, std::string> StoreFileNameMap;
+
+// Represents 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 +131,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

Powered by Google App Engine
This is Rietveld 408576698