| 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_PROTOCOL_MANAGER_UTIL_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ | 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ |
| 7 | 7 |
| 8 // A class that implements the stateless methods used by the GetHashUpdate and | 8 // A class that implements the stateless methods used by the GetHashUpdate and |
| 9 // GetFullHash stubby calls made by Chrome using the SafeBrowsing V4 protocol. | 9 // GetFullHash stubby calls made by Chrome using the SafeBrowsing V4 protocol. |
| 10 | 10 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // error code against, |status| represents the status of the HTTP request, and | 266 // error code against, |status| represents the status of the HTTP request, and |
| 267 // |response code| represents the HTTP response code received from the server. | 267 // |response code| represents the HTTP response code received from the server. |
| 268 static void RecordHttpResponseOrErrorCode(const char* metric_name, | 268 static void RecordHttpResponseOrErrorCode(const char* metric_name, |
| 269 const net::URLRequestStatus& status, | 269 const net::URLRequestStatus& status, |
| 270 int response_code); | 270 int response_code); |
| 271 | 271 |
| 272 // Generate the set of FullHashes to check for |url|. | 272 // Generate the set of FullHashes to check for |url|. |
| 273 static void UrlToFullHashes(const GURL& url, | 273 static void UrlToFullHashes(const GURL& url, |
| 274 std::vector<FullHash>* full_hashes); | 274 std::vector<FullHash>* full_hashes); |
| 275 | 275 |
| 276 static void GenerateHostAndPathVariants(const GURL& url, |
| 277 std::vector<std::string>* hosts, |
| 278 std::vector<std::string>* paths); |
| 279 |
| 276 static bool FullHashToHashPrefix(const FullHash& full_hash, | 280 static bool FullHashToHashPrefix(const FullHash& full_hash, |
| 277 PrefixSize prefix_size, | 281 PrefixSize prefix_size, |
| 278 HashPrefix* hash_prefix); | 282 HashPrefix* hash_prefix); |
| 279 | 283 |
| 280 static bool FullHashToSmallestHashPrefix(const FullHash& full_hash, | 284 static bool FullHashToSmallestHashPrefix(const FullHash& full_hash, |
| 281 HashPrefix* hash_prefix); | 285 HashPrefix* hash_prefix); |
| 282 | 286 |
| 283 static bool FullHashMatchesHashPrefix(const FullHash& full_hash, | 287 static bool FullHashMatchesHashPrefix(const FullHash& full_hash, |
| 284 const HashPrefix& hash_prefix); | 288 const HashPrefix& hash_prefix); |
| 285 | 289 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 362 |
| 359 template <> | 363 template <> |
| 360 struct hash<safe_browsing::ListIdentifier> { | 364 struct hash<safe_browsing::ListIdentifier> { |
| 361 std::size_t operator()(const safe_browsing::ListIdentifier& id) const { | 365 std::size_t operator()(const safe_browsing::ListIdentifier& id) const { |
| 362 return id.hash(); | 366 return id.hash(); |
| 363 } | 367 } |
| 364 }; | 368 }; |
| 365 } | 369 } |
| 366 | 370 |
| 367 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ | 371 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ |
| OLD | NEW |