| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ | 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ |
| 7 | 7 |
| 8 // A class that implements Chrome's interface with the SafeBrowsing V4 protocol. | 8 // A class that implements Chrome's interface with the SafeBrowsing V4 protocol. |
| 9 // | 9 // |
| 10 // The V4GetHashProtocolManager handles formatting and making requests of, and | 10 // The V4GetHashProtocolManager handles formatting and making requests of, and |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 class GURL; | 31 class GURL; |
| 32 | 32 |
| 33 namespace net { | 33 namespace net { |
| 34 class URLFetcher; | 34 class URLFetcher; |
| 35 class URLRequestContextGetter; | 35 class URLRequestContextGetter; |
| 36 } // namespace net | 36 } // namespace net |
| 37 | 37 |
| 38 namespace safe_browsing { | 38 namespace safe_browsing { |
| 39 | 39 |
| 40 // The matching hash prefixes and corresponding stores, for each full hash |
| 41 // generated for a given URL. |
| 42 typedef base::hash_map<FullHash, StoreAndHashPrefixes> |
| 43 FullHashToStoreAndHashPrefixesMap; |
| 44 |
| 45 // ---------------------------------------------------------------- |
| 46 |
| 47 // All information about a particular full hash i.e. negative TTL, store for |
| 48 // which it is valid, and metadata associated with that store. |
| 49 struct FullHashInfo { |
| 50 public: |
| 51 FullHash full_hash; |
| 52 |
| 53 // The list for which this full hash is applicable. |
| 54 UpdateListIdentifier list_id; |
| 55 |
| 56 // The expiration time of the full hash for a particular store. |
| 57 base::Time positive_ttl; |
| 58 |
| 59 // Any metadata for this full hash for a particular store. |
| 60 ThreatMetadata metadata; |
| 61 |
| 62 explicit FullHashInfo(const FullHash& full_hash, |
| 63 const UpdateListIdentifier& list_id, |
| 64 const base::Time& positive_ttl); |
| 65 explicit FullHashInfo(const FullHashInfo& other); |
| 66 ~FullHashInfo(); |
| 67 |
| 68 bool operator==(const FullHashInfo& other) const; |
| 69 bool operator!=(const FullHashInfo& other) const; |
| 70 |
| 71 private: |
| 72 FullHashInfo(); |
| 73 }; |
| 74 |
| 75 // Caches individual response from GETHASH response. |
| 76 struct CachedHashPrefixInfo { |
| 77 // The negative ttl for the hash prefix that leads to this |
| 78 // CachedHashPrefixInfo. The client should not send any more requests for that |
| 79 // hash prefix until this time. |
| 80 base::Time negative_ttl; |
| 81 |
| 82 // The list of all full hashes (and related info) that start with a |
| 83 // particular hash prefix and are known to be unsafe. |
| 84 std::vector<FullHashInfo> full_hash_infos; |
| 85 |
| 86 CachedHashPrefixInfo(); |
| 87 CachedHashPrefixInfo(const CachedHashPrefixInfo& other); |
| 88 ~CachedHashPrefixInfo(); |
| 89 }; |
| 90 |
| 91 // Cached full hashes received from the server for the corresponding hash |
| 92 // prefixes. |
| 93 typedef base::hash_map<HashPrefix, CachedHashPrefixInfo> FullHashCache; |
| 94 |
| 95 // Used to keep track of the prefixes and the corresponding stores in the |
| 96 // request sent to the server. |
| 97 typedef base::hash_map<HashPrefix, std::vector<UpdateListIdentifier>> |
| 98 PrefixToSetOfStoresMap; |
| 99 |
| 100 // FullHashCallback is invoked when GetFullHashes completes. |
| 101 // Parameters: |
| 102 // - The vector of full hash results. If empty, indicates that there |
| 103 // were no matches, and that the resource is safe. |
| 104 typedef base::Callback<void(const std::vector<FullHashInfo>&)> FullHashCallback; |
| 105 |
| 106 // Information needed to update the cache and call the callback to post the |
| 107 // results. |
| 108 struct FullHashCallbackInfo { |
| 109 FullHashCallbackInfo(); |
| 110 explicit FullHashCallbackInfo( |
| 111 const std::vector<FullHashInfo>& cached_full_hash_infos, |
| 112 const std::vector<HashPrefix>& prefixes_requested, |
| 113 std::unique_ptr<net::URLFetcher> fetcher, |
| 114 const FullHashToStoreAndHashPrefixesMap& |
| 115 full_hash_to_store_and_hash_prefixes, |
| 116 FullHashCallback callback); |
| 117 ~FullHashCallbackInfo(); |
| 118 |
| 119 // The FullHashInfo objects retrieved from cache. These are merged with the |
| 120 // results received from the server before invoking the callback. |
| 121 std::vector<FullHashInfo> cached_full_hash_infos; |
| 122 |
| 123 // The callback method to call after collecting the full hashes for given |
| 124 // hash prefixes. |
| 125 FullHashCallback callback; |
| 126 |
| 127 // The fetcher that will return the response from the server. |
| 128 std::unique_ptr<net::URLFetcher> fetcher; |
| 129 |
| 130 // The generated full hashes and the corresponding prefixes and the stores in |
| 131 // which to look for a full hash match. |
| 132 FullHashToStoreAndHashPrefixesMap full_hash_to_store_and_hash_prefixes; |
| 133 |
| 134 // The prefixes that were requested from the server. |
| 135 std::vector<HashPrefix> prefixes_requested; |
| 136 }; |
| 137 |
| 138 // ---------------------------------------------------------------- |
| 139 |
| 40 class V4GetHashProtocolManagerFactory; | 140 class V4GetHashProtocolManagerFactory; |
| 41 | 141 |
| 42 class V4GetHashProtocolManager : public net::URLFetcherDelegate, | 142 class V4GetHashProtocolManager : public net::URLFetcherDelegate, |
| 43 public base::NonThreadSafe { | 143 public base::NonThreadSafe { |
| 44 public: | 144 public: |
| 45 // FullHashCallback is invoked when GetFullHashes completes. | 145 // Invoked when GetFullHashesWithApis completes. |
| 46 // Parameters: | 146 // Parameters: |
| 47 // - The vector of full hash results. If empty, indicates that there | 147 // - The API threat metadata for the given URL. |
| 48 // were no matches, and that the resource is safe. | 148 typedef base::Callback<void(const ThreatMetadata& md)> |
| 49 // - The negative cache expire time of the result. This value may be | 149 ThreatMetadataForApiCallback; |
| 50 // uninitialized, and the results should not be cached in this case. | |
| 51 typedef base::Callback<void(const std::vector<SBFullHashResult>&, | |
| 52 const base::Time&)> | |
| 53 FullHashCallback; | |
| 54 | 150 |
| 55 ~V4GetHashProtocolManager() override; | 151 ~V4GetHashProtocolManager() override; |
| 56 | 152 |
| 153 // Create an instance of the safe browsing v4 protocol manager. |
| 154 static std::unique_ptr<V4GetHashProtocolManager> Create( |
| 155 net::URLRequestContextGetter* request_context_getter, |
| 156 const base::hash_set<UpdateListIdentifier>& stores_to_request, |
| 157 const V4ProtocolConfig& config); |
| 158 |
| 57 // Makes the passed |factory| the factory used to instantiate | 159 // Makes the passed |factory| the factory used to instantiate |
| 58 // a V4GetHashProtocolManager. Useful for tests. | 160 // a V4GetHashProtocolManager. Useful for tests. |
| 59 static void RegisterFactory( | 161 static void RegisterFactory( |
| 60 std::unique_ptr<V4GetHashProtocolManagerFactory> factory); | 162 std::unique_ptr<V4GetHashProtocolManagerFactory> factory); |
| 61 | 163 |
| 62 // Create an instance of the safe browsing v4 protocol manager. | 164 // Empties the cache. |
| 63 static V4GetHashProtocolManager* Create( | 165 void ClearCache(); |
| 64 net::URLRequestContextGetter* request_context_getter, | |
| 65 const V4ProtocolConfig& config); | |
| 66 | |
| 67 // net::URLFetcherDelegate interface. | |
| 68 void OnURLFetchComplete(const net::URLFetcher* source) override; | |
| 69 | 166 |
| 70 // Retrieve the full hash for a set of prefixes, and invoke the callback | 167 // Retrieve the full hash for a set of prefixes, and invoke the callback |
| 71 // argument when the results are retrieved. The callback may be invoked | 168 // argument when the results are retrieved. The callback may be invoked |
| 72 // synchronously. | 169 // synchronously. |
| 73 virtual void GetFullHashes(const std::vector<SBPrefix>& prefixes, | 170 virtual void GetFullHashes(const FullHashToStoreAndHashPrefixesMap& |
| 74 const std::vector<PlatformType>& platforms, | 171 full_hash_to_matching_hash_prefixes, |
| 75 ThreatType threat_type, | |
| 76 FullHashCallback callback); | 172 FullHashCallback callback); |
| 77 | 173 |
| 78 // Retrieve the full hash and API metadata for a set of prefixes, and invoke | 174 // Retrieve the full hash and API metadata for a URL, and invoke the callback |
| 79 // the callback argument when the results are retrieved. The callback may be | 175 // argument when the results are retrieved. The callback may be invoked |
| 80 // invoked synchronously. | 176 // synchronously. |
| 81 virtual void GetFullHashesWithApis(const std::vector<SBPrefix>& prefixes, | 177 virtual void GetFullHashesWithApis(const GURL& url, |
| 82 FullHashCallback callback); | 178 ThreatMetadataForApiCallback api_callback); |
| 83 | 179 |
| 84 // Overrides the clock used to check the time. | 180 // net::URLFetcherDelegate interface. |
| 85 void SetClockForTests(std::unique_ptr<base::Clock> clock); | 181 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 86 | 182 |
| 87 protected: | 183 protected: |
| 88 // Constructs a V4GetHashProtocolManager that issues | 184 // Constructs a V4GetHashProtocolManager that issues |
| 89 // network requests using |request_context_getter|. | 185 // network requests using |request_context_getter|. |
| 90 V4GetHashProtocolManager(net::URLRequestContextGetter* request_context_getter, | 186 V4GetHashProtocolManager( |
| 91 const V4ProtocolConfig& config); | 187 net::URLRequestContextGetter* request_context_getter, |
| 188 const base::hash_set<UpdateListIdentifier>& stores_to_request, |
| 189 const V4ProtocolConfig& config); |
| 92 | 190 |
| 93 private: | 191 private: |
| 94 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, | 192 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, TestGetHashRequest); |
| 95 TestGetHashRequest); | 193 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, TestParseHashResponse); |
| 96 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, | 194 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, |
| 97 TestParseHashResponse); | |
| 98 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, | |
| 99 TestParseHashResponseWrongThreatEntryType); | 195 TestParseHashResponseWrongThreatEntryType); |
| 100 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, | 196 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, |
| 101 TestParseHashThreatPatternType); | 197 TestParseHashThreatPatternType); |
| 102 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, | 198 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, |
| 103 TestParseHashResponseNonPermissionMetadata); | 199 TestParseHashResponseNonPermissionMetadata); |
| 104 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, | 200 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, |
| 105 TestParseHashResponseInconsistentThreatTypes); | 201 TestParseHashResponseInconsistentThreatTypes); |
| 106 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, | 202 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, |
| 107 TestGetHashErrorHandlingOK); | 203 TestGetHashErrorHandlingOK); |
| 108 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, | 204 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, |
| 205 TestResultsNotCachedForNegativeCacheDuration); |
| 206 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, |
| 109 TestGetHashErrorHandlingNetwork); | 207 TestGetHashErrorHandlingNetwork); |
| 110 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4GetHashProtocolManagerTest, | 208 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, |
| 111 TestGetHashErrorHandlingResponseCode); | 209 TestGetHashErrorHandlingResponseCode); |
| 210 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, GetCachedResults); |
| 211 FRIEND_TEST_ALL_PREFIXES(V4GetHashProtocolManagerTest, TestUpdatesAreMerged); |
| 212 friend class V4GetHashProtocolManagerTest; |
| 112 friend class V4GetHashProtocolManagerFactoryImpl; | 213 friend class V4GetHashProtocolManagerFactoryImpl; |
| 113 | 214 |
| 215 FullHashCache* full_hash_cache_for_tests() { return &full_hash_cache_; } |
| 216 |
| 217 // Looks up the cached results for full hashes in |
| 218 // |full_hash_to_store_and_hash_prefixes|. Fills |prefixes_to_request| with |
| 219 // the prefixes that need to be requested. Fills |cached_full_hash_infos| |
| 220 // with the cached results. |
| 221 // Note: It is valid for both |prefixes_to_request| and |
| 222 // |cached_full_hash_infos| to be empty after this function finishes. |
| 223 void GetFullHashCachedResults( |
| 224 const FullHashToStoreAndHashPrefixesMap& |
| 225 full_hash_to_store_and_hash_prefixes, |
| 226 const base::Time& now, |
| 227 std::vector<HashPrefix>* prefixes_to_request, |
| 228 std::vector<FullHashInfo>* cached_full_hash_infos) const; |
| 229 |
| 230 // Fills a FindFullHashesRequest protocol buffer for a request. |
| 231 // Returns the serialized and base 64 encoded request as a string. |
| 232 std::string GetHashRequest( |
| 233 const std::vector<HashPrefix>& prefixes_to_request); |
| 234 |
| 114 void GetHashUrlAndHeaders(const std::string& request_base64, | 235 void GetHashUrlAndHeaders(const std::string& request_base64, |
| 115 GURL* gurl, | 236 GURL* gurl, |
| 116 net::HttpRequestHeaders* headers) const; | 237 net::HttpRequestHeaders* headers) const; |
| 117 | 238 |
| 118 // Fills a FindFullHashesRequest protocol buffer for a request. | |
| 119 // Returns the serialized and base 64 encoded request as a string. | |
| 120 std::string GetHashRequest(const std::vector<SBPrefix>& prefixes, | |
| 121 const std::vector<PlatformType>& platforms, | |
| 122 ThreatType threat_type); | |
| 123 | |
| 124 // Parses a FindFullHashesResponse protocol buffer and fills the results in | |
| 125 // |full_hashes| and |negative_cache_expire|. |data| is a serialized | |
| 126 // FindFullHashes protocol buffer. |negative_cache_expire| is the cache expiry | |
| 127 // time of the response for entities that did not match the threat list. | |
| 128 // Returns true if parsing is successful, false otherwise. | |
| 129 bool ParseHashResponse(const std::string& data_base64, | |
| 130 std::vector<SBFullHashResult>* full_hashes, | |
| 131 base::Time* negative_cache_expire); | |
| 132 | |
| 133 // Resets the gethash error counter and multiplier. | |
| 134 void ResetGetHashErrors(); | |
| 135 | |
| 136 // Updates internal state for each GetHash response error, assuming that | 239 // Updates internal state for each GetHash response error, assuming that |
| 137 // the current time is |now|. | 240 // the current time is |now|. |
| 138 void HandleGetHashError(const base::Time& now); | 241 void HandleGetHashError(const base::Time& now); |
| 139 | 242 |
| 243 // Merges the results from the cache and the results from the server. The |
| 244 // response from the server may include information for full hashes from |
| 245 // stores other than those required by this client so it filters out those |
| 246 // results that the client did not ask for. |
| 247 void MergeResults(const FullHashToStoreAndHashPrefixesMap& |
| 248 full_hash_to_store_and_hash_prefixes, |
| 249 const std::vector<FullHashInfo>& full_hash_infos, |
| 250 std::vector<FullHashInfo>* merged_full_hash_infos); |
| 251 |
| 252 // Calls |api_callback| with a an object of ThreatMetadata that contains |
| 253 // permission api metadata for full hashes in those |full_hash_infos| that |
| 254 // have a full hash in |full_hashes|. |
| 255 void OnFullHashForApi(ThreatMetadataForApiCallback api_callback, |
| 256 const base::hash_set<FullHash>& full_hashes, |
| 257 const std::vector<FullHashInfo>& full_hash_infos); |
| 258 |
| 259 // Parses a FindFullHashesResponse protocol buffer and fills the results in |
| 260 // |full_hash_infos| and |negative_cache_expire|. |data| is a serialized |
| 261 // FindFullHashes protocol buffer. |negative_cache_expire| is the cache |
| 262 // expiry time of the hash prefixes that were requested. Returns true if |
| 263 // parsing is successful; false otherwise. |
| 264 bool ParseHashResponse(const std::string& data, |
| 265 std::vector<FullHashInfo>* full_hash_infos, |
| 266 base::Time* negative_cache_expire); |
| 267 |
| 268 // Parses the store specific |metadata| information from the |match|. |
| 269 bool ParseMetadata(const ThreatMatch& match, ThreatMetadata* metadata); |
| 270 |
| 271 // Resets the gethash error counter and multiplier. |
| 272 void ResetGetHashErrors(); |
| 273 |
| 274 // Overrides the clock used to check the time. |
| 275 void SetClockForTests(std::unique_ptr<base::Clock> clock); |
| 276 |
| 277 // Updates the state of the full hash cache upon receiving a valid response |
| 278 // from the server. |
| 279 void UpdateCache(const std::vector<HashPrefix>& prefixes_requested, |
| 280 const std::vector<FullHashInfo>& full_hash_infos, |
| 281 const base::Time& negative_cache_expire); |
| 282 |
| 140 private: | 283 private: |
| 141 // Map of GetHash requests to parameters which created it. | 284 // Map of GetHash requests to parameters which created it. |
| 142 using HashRequests = base::hash_map< | 285 using PendingHashRequests = |
| 143 const net::URLFetcher*, | 286 base::hash_map<const net::URLFetcher*, |
| 144 std::pair<std::unique_ptr<net::URLFetcher>, FullHashCallback>>; | 287 std::unique_ptr<FullHashCallbackInfo>>; |
| 145 | 288 |
| 146 // The factory that controls the creation of V4GetHashProtocolManager. | 289 // The factory that controls the creation of V4GetHashProtocolManager. |
| 147 // This is used by tests. | 290 // This is used by tests. |
| 148 static V4GetHashProtocolManagerFactory* factory_; | 291 static V4GetHashProtocolManagerFactory* factory_; |
| 149 | 292 |
| 150 // Current active request (in case we need to cancel) for updates or chunks | 293 // Current active request (in case we need to cancel) for updates or chunks |
| 151 // from the SafeBrowsing service. We can only have one of these outstanding | 294 // from the SafeBrowsing service. We can only have one of these outstanding |
| 152 // at any given time unlike GetHash requests, which are tracked separately. | 295 // at any given time unlike GetHash requests, which are tracked separately. |
| 153 std::unique_ptr<net::URLFetcher> request_; | 296 std::unique_ptr<net::URLFetcher> request_; |
| 154 | 297 |
| 155 // The number of HTTP response errors since the the last successful HTTP | 298 // The number of HTTP response errors since the the last successful HTTP |
| 156 // response, used for request backoff timing. | 299 // response, used for request backoff timing. |
| 157 size_t gethash_error_count_; | 300 size_t gethash_error_count_; |
| 158 | 301 |
| 159 // Multiplier for the backoff error after the second. | 302 // Multiplier for the backoff error after the second. |
| 160 size_t gethash_back_off_mult_; | 303 size_t gethash_back_off_mult_; |
| 161 | 304 |
| 162 HashRequests hash_requests_; | 305 PendingHashRequests pending_hash_requests_; |
| 163 | 306 |
| 164 // For v4, the next gethash time is set to the backoff time is the last | 307 // For v4, the next gethash time is set to the backoff time is the last |
| 165 // response was an error, or the minimum wait time if the last response was | 308 // response was an error, or the minimum wait time if the last response was |
| 166 // successful. | 309 // successful. |
| 167 base::Time next_gethash_time_; | 310 base::Time next_gethash_time_; |
| 168 | 311 |
| 169 // The config of the client making Pver4 requests. | 312 // The config of the client making Pver4 requests. |
| 170 const V4ProtocolConfig config_; | 313 const V4ProtocolConfig config_; |
| 171 | 314 |
| 172 // The context we use to issue network requests. | 315 // The context we use to issue network requests. |
| 173 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 316 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 174 | 317 |
| 175 // ID for URLFetchers for testing. | 318 // ID for URLFetchers for testing. |
| 176 int url_fetcher_id_; | 319 int url_fetcher_id_; |
| 177 | 320 |
| 178 // The clock used to vend times. | 321 // The clock used to vend times. |
| 179 std::unique_ptr<base::Clock> clock_; | 322 std::unique_ptr<base::Clock> clock_; |
| 180 | 323 |
| 324 // A cache of full hash results. |
| 325 FullHashCache full_hash_cache_; |
| 326 |
| 327 // The following sets represent the combination of lists that we would always |
| 328 // request from the server, irrespective of which list we found the hash |
| 329 // prefix match in. |
| 330 base::hash_set<PlatformType> platform_types_; |
| 331 base::hash_set<ThreatEntryType> threat_entry_types_; |
| 332 base::hash_set<ThreatType> threat_types_; |
| 333 |
| 181 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManager); | 334 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManager); |
| 182 }; | 335 }; |
| 183 | 336 |
| 184 // Interface of a factory to create V4GetHashProtocolManager. Useful for tests. | 337 // Interface of a factory to create V4GetHashProtocolManager. Useful for tests. |
| 185 class V4GetHashProtocolManagerFactory { | 338 class V4GetHashProtocolManagerFactory { |
| 186 public: | 339 public: |
| 187 V4GetHashProtocolManagerFactory() {} | 340 V4GetHashProtocolManagerFactory() {} |
| 188 virtual ~V4GetHashProtocolManagerFactory() {} | 341 virtual ~V4GetHashProtocolManagerFactory() {} |
| 189 virtual V4GetHashProtocolManager* CreateProtocolManager( | 342 virtual std::unique_ptr<V4GetHashProtocolManager> CreateProtocolManager( |
| 190 net::URLRequestContextGetter* request_context_getter, | 343 net::URLRequestContextGetter* request_context_getter, |
| 344 const base::hash_set<UpdateListIdentifier>& stores_to_request, |
| 191 const V4ProtocolConfig& config) = 0; | 345 const V4ProtocolConfig& config) = 0; |
| 192 | 346 |
| 193 private: | 347 private: |
| 194 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory); | 348 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory); |
| 195 }; | 349 }; |
| 196 | 350 |
| 351 #ifndef NDEBUG |
| 352 std::ostream& operator<<(std::ostream& os, const FullHashInfo& id); |
| 353 #endif |
| 354 |
| 197 } // namespace safe_browsing | 355 } // namespace safe_browsing |
| 198 | 356 |
| 199 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ | 357 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ |
| OLD | NEW |