| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 static bool FullHashToHashPrefix(const FullHash& full_hash, | 212 static bool FullHashToHashPrefix(const FullHash& full_hash, |
| 213 PrefixSize prefix_size, | 213 PrefixSize prefix_size, |
| 214 HashPrefix* hash_prefix); | 214 HashPrefix* hash_prefix); |
| 215 | 215 |
| 216 static bool FullHashToSmallestHashPrefix(const FullHash& full_hash, | 216 static bool FullHashToSmallestHashPrefix(const FullHash& full_hash, |
| 217 HashPrefix* hash_prefix); | 217 HashPrefix* hash_prefix); |
| 218 | 218 |
| 219 static bool FullHashMatchesHashPrefix(const FullHash& full_hash, | 219 static bool FullHashMatchesHashPrefix(const FullHash& full_hash, |
| 220 const HashPrefix& hash_prefix); | 220 const HashPrefix& hash_prefix); |
| 221 | 221 |
| 222 static void SetClientInfoFromConfig(ClientInfo* client_info, |
| 223 const V4ProtocolConfig& config); |
| 224 |
| 222 private: | 225 private: |
| 223 V4ProtocolManagerUtil(){}; | 226 V4ProtocolManagerUtil(){}; |
| 224 FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, TestBackOffLogic); | 227 FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, TestBackOffLogic); |
| 225 FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, | 228 FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, |
| 226 TestGetRequestUrlAndUpdateHeaders); | 229 TestGetRequestUrlAndUpdateHeaders); |
| 227 FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, UrlParsing); | 230 FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, UrlParsing); |
| 228 FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, CanonicalizeUrl); | 231 FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, CanonicalizeUrl); |
| 229 | 232 |
| 230 // Composes a URL using |prefix|, |method| (e.g.: encodedFullHashes). | 233 // Composes a URL using |prefix|, |method| (e.g.: encodedFullHashes). |
| 231 // |request_base64|, |client_id|, |version| and |key_param|. |prefix| | 234 // |request_base64|, |client_id|, |version| and |key_param|. |prefix| |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 282 |
| 280 template <> | 283 template <> |
| 281 struct hash<safe_browsing::UpdateListIdentifier> { | 284 struct hash<safe_browsing::UpdateListIdentifier> { |
| 282 std::size_t operator()(const safe_browsing::UpdateListIdentifier& id) const { | 285 std::size_t operator()(const safe_browsing::UpdateListIdentifier& id) const { |
| 283 return id.hash(); | 286 return id.hash(); |
| 284 } | 287 } |
| 285 }; | 288 }; |
| 286 } | 289 } |
| 287 | 290 |
| 288 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ | 291 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ |
| OLD | NEW |