Chromium Code Reviews| Index: components/safe_browsing_db/v4_update_protocol_manager.h |
| diff --git a/components/safe_browsing_db/v4_update_protocol_manager.h b/components/safe_browsing_db/v4_update_protocol_manager.h |
| index 4b2031779d1e3f2b3cd1f72158d5ef8adda66f2e..babb8ec549067f4279141f370146d3014cc3afa7 100644 |
| --- a/components/safe_browsing_db/v4_update_protocol_manager.h |
| +++ b/components/safe_browsing_db/v4_update_protocol_manager.h |
| @@ -37,9 +37,6 @@ namespace safe_browsing { |
| class V4UpdateProtocolManagerFactory; |
| -typedef FetchThreatListUpdatesRequest::ListUpdateRequest ListUpdateRequest; |
| -typedef FetchThreatListUpdatesResponse::ListUpdateResponse ListUpdateResponse; |
| - |
| // V4UpdateCallback is invoked when a scheduled update completes. |
| // Parameters: |
| // - The vector of update response protobufs received from the server for |
| @@ -62,8 +59,6 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate, |
| static std::unique_ptr<V4UpdateProtocolManager> Create( |
| net::URLRequestContextGetter* request_context_getter, |
| const V4ProtocolConfig& config, |
| - const base::hash_map<UpdateListIdentifier, std::string>& |
| - current_list_states, |
| V4UpdateCallback callback); |
| // net::URLFetcherDelegate interface. |
| @@ -72,17 +67,17 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate, |
| // Schedule the next update without backoff. |
| void ScheduleNextUpdate(); |
| + // Tell the update manager where to get the latest state of the stores. |
| + void SetStoreStateMap(const StoreStateMap* store_state_map); |
| + |
| protected: |
| // Constructs a V4UpdateProtocolManager that issues network requests using |
| - // |request_context_getter|. |
| - // Schedules an update to get the hash prefixes for the lists in |
| - // |current_list_states|, and invoke |callback| when the results |
| - // are retrieved. The callback may be invoked synchronously. |
| + // |request_context_getter|. It schedules updates to get the hash prefixes for |
| + // SafeBrowsing lists, and invoke |callback| when the results are retrieved. |
| + // The callback may be invoked synchronously. |
| V4UpdateProtocolManager( |
| net::URLRequestContextGetter* request_context_getter, |
| const V4ProtocolConfig& config, |
| - const base::hash_map<UpdateListIdentifier, std::string>& |
| - current_list_states, |
| V4UpdateCallback callback); |
| private: |
| @@ -105,9 +100,8 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate, |
| // Fills a FetchThreatListUpdatesRequest protocol buffer for a request. |
| // Returns the serialized and base 64 encoded request as a string. |
| - std::string GetBase64SerializedUpdateRequestProto( |
| - const base::hash_map<UpdateListIdentifier, std::string>& |
| - current_list_states); |
| + static std::string GetBase64SerializedUpdateRequestProto( |
| + const StoreStateMap* store_state_map); |
| // Parses the base64 encoded response received from the server as a |
| // FetchThreatListUpdatesResponse protobuf and returns each of the |
| @@ -145,10 +139,8 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate, |
| static V4UpdateProtocolManagerFactory* factory_; |
| // The last known state of the lists. |
| - // At init, this is read from the disk or is empty for no prior state. |
| - // Each successful update from the server contains a new state for each |
| - // requested list. |
| - base::hash_map<UpdateListIdentifier, std::string> current_list_states_; |
| + // Updated after every successful update of the database. |
| + const StoreStateMap* store_state_map_; |
|
Scott Hess - ex-Googler
2016/06/17 22:53:43
Having the instance retain a pointer to a map owne
vakh (use Gerrit instead)
2016/06/21 00:29:36
Done.
|
| // The number of HTTP response errors since the the last successful HTTP |
| // response, used for request backoff timing. |
| @@ -194,8 +186,6 @@ class V4UpdateProtocolManagerFactory { |
| virtual std::unique_ptr<V4UpdateProtocolManager> CreateProtocolManager( |
| net::URLRequestContextGetter* request_context_getter, |
| const V4ProtocolConfig& config, |
| - const base::hash_map<UpdateListIdentifier, std::string>& |
| - current_list_states, |
| V4UpdateCallback callback) = 0; |
| private: |