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

Side by Side Diff: components/safe_browsing_db/v4_get_hash_protocol_manager.h

Issue 2687023007: Revert of Browser tests for using the new SafeBrowsing protocol (v4) (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 281
282 // Overrides the clock used to check the time. 282 // Overrides the clock used to check the time.
283 void SetClockForTests(std::unique_ptr<base::Clock> clock); 283 void SetClockForTests(std::unique_ptr<base::Clock> clock);
284 284
285 // Updates the state of the full hash cache upon receiving a valid response 285 // Updates the state of the full hash cache upon receiving a valid response
286 // from the server. 286 // from the server.
287 void UpdateCache(const std::vector<HashPrefix>& prefixes_requested, 287 void UpdateCache(const std::vector<HashPrefix>& prefixes_requested,
288 const std::vector<FullHashInfo>& full_hash_infos, 288 const std::vector<FullHashInfo>& full_hash_infos,
289 const base::Time& negative_cache_expire); 289 const base::Time& negative_cache_expire);
290 290
291 protected:
292 // A cache of full hash results.
293 FullHashCache full_hash_cache_;
294
295 private: 291 private:
296 // Map of GetHash requests to parameters which created it. 292 // Map of GetHash requests to parameters which created it.
297 using PendingHashRequests = 293 using PendingHashRequests =
298 base::hash_map<const net::URLFetcher*, 294 base::hash_map<const net::URLFetcher*,
299 std::unique_ptr<FullHashCallbackInfo>>; 295 std::unique_ptr<FullHashCallbackInfo>>;
300 296
301 // The factory that controls the creation of V4GetHashProtocolManager. 297 // The factory that controls the creation of V4GetHashProtocolManager.
302 // This is used by tests. 298 // This is used by tests.
303 static V4GetHashProtocolManagerFactory* factory_; 299 static V4GetHashProtocolManagerFactory* factory_;
304 300
(...skipping 21 matching lines...) Expand all
326 322
327 // The context we use to issue network requests. 323 // The context we use to issue network requests.
328 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 324 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
329 325
330 // ID for URLFetchers for testing. 326 // ID for URLFetchers for testing.
331 int url_fetcher_id_; 327 int url_fetcher_id_;
332 328
333 // The clock used to vend times. 329 // The clock used to vend times.
334 std::unique_ptr<base::Clock> clock_; 330 std::unique_ptr<base::Clock> clock_;
335 331
332 // A cache of full hash results.
333 FullHashCache full_hash_cache_;
334
336 // The following sets represent the combination of lists that we would always 335 // The following sets represent the combination of lists that we would always
337 // request from the server, irrespective of which list we found the hash 336 // request from the server, irrespective of which list we found the hash
338 // prefix match in. 337 // prefix match in.
339 std::vector<PlatformType> platform_types_; 338 std::vector<PlatformType> platform_types_;
340 std::vector<ThreatEntryType> threat_entry_types_; 339 std::vector<ThreatEntryType> threat_entry_types_;
341 std::vector<ThreatType> threat_types_; 340 std::vector<ThreatType> threat_types_;
342 341
343 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManager); 342 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManager);
344 }; 343 };
345 344
(...skipping 11 matching lines...) Expand all
357 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory); 356 DISALLOW_COPY_AND_ASSIGN(V4GetHashProtocolManagerFactory);
358 }; 357 };
359 358
360 #ifndef NDEBUG 359 #ifndef NDEBUG
361 std::ostream& operator<<(std::ostream& os, const FullHashInfo& id); 360 std::ostream& operator<<(std::ostream& os, const FullHashInfo& id);
362 #endif 361 #endif
363 362
364 } // namespace safe_browsing 363 } // namespace safe_browsing
365 364
366 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_ 365 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_GET_HASH_PROTOCOL_MANAGER_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_feature_list.cc ('k') | components/safe_browsing_db/v4_local_database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698