OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 // Utilities for the SafeBrowsing DB code. | 5 // Utilities for the SafeBrowsing DB code. |
6 | 6 |
7 #ifndef COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ | 7 #ifndef COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ |
8 #define COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ | 8 #define COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ |
9 | 9 |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 char full_hash[32]; | 57 char full_hash[32]; |
58 SBPrefix prefix; | 58 SBPrefix prefix; |
59 }; | 59 }; |
60 | 60 |
61 // Used when we get a gethash response. | 61 // Used when we get a gethash response. |
62 struct SBFullHashResult { | 62 struct SBFullHashResult { |
63 SBFullHash hash; | 63 SBFullHash hash; |
64 // TODO(shess): Refactor to allow ListType here. | 64 // TODO(shess): Refactor to allow ListType here. |
65 int list_id; | 65 int list_id; |
66 std::string metadata; | 66 std::string metadata; |
| 67 // Used only for V4 results. The cache lifetime for this result. The response |
| 68 // must not be cached for more than this duration to avoid false positives. |
| 69 base::TimeDelta cache_duration; |
67 }; | 70 }; |
68 | 71 |
69 // Caches individual response from GETHASH request. | 72 // Caches individual response from GETHASH request. |
70 struct SBCachedFullHashResult { | 73 struct SBCachedFullHashResult { |
71 SBCachedFullHashResult(); | 74 SBCachedFullHashResult(); |
72 explicit SBCachedFullHashResult(const base::Time& in_expire_after); | 75 explicit SBCachedFullHashResult(const base::Time& in_expire_after); |
73 ~SBCachedFullHashResult(); | 76 ~SBCachedFullHashResult(); |
74 | 77 |
75 base::Time expire_after; | 78 base::Time expire_after; |
76 std::vector<SBFullHashResult> full_hashes; | 79 std::vector<SBFullHashResult> full_hashes; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 167 |
165 // Given a URL, returns all the paths we need to check. | 168 // Given a URL, returns all the paths we need to check. |
166 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); | 169 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); |
167 | 170 |
168 // Given a URL, returns all the patterns we need to check. | 171 // Given a URL, returns all the patterns we need to check. |
169 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); | 172 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); |
170 | 173 |
171 } // namespace safe_browsing | 174 } // namespace safe_browsing |
172 | 175 |
173 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ | 176 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ |
OLD | NEW |