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 <stdint.h> |
| 11 |
10 #include <cstring> | 12 #include <cstring> |
11 #include <string> | 13 #include <string> |
12 #include <vector> | 14 #include <vector> |
13 | 15 |
14 #include "base/basictypes.h" | |
15 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 | 18 |
18 class GURL; | 19 class GURL; |
19 | 20 |
20 namespace safe_browsing { | 21 namespace safe_browsing { |
21 | 22 |
22 // Different types of threats that SafeBrowsing protects against. | 23 // Different types of threats that SafeBrowsing protects against. |
23 enum SBThreatType { | 24 enum SBThreatType { |
24 // No threat at all. | 25 // No threat at all. |
(...skipping 18 matching lines...) Expand all Loading... |
43 // The Chrome extension or app (given by its ID) is malware. | 44 // The Chrome extension or app (given by its ID) is malware. |
44 SB_THREAT_TYPE_EXTENSION, | 45 SB_THREAT_TYPE_EXTENSION, |
45 | 46 |
46 // Url detected by the client-side malware IP list. This IP list is part | 47 // Url detected by the client-side malware IP list. This IP list is part |
47 // of the client side detection model. | 48 // of the client side detection model. |
48 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL, | 49 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL, |
49 }; | 50 }; |
50 | 51 |
51 | 52 |
52 // A truncated hash's type. | 53 // A truncated hash's type. |
53 typedef uint32 SBPrefix; | 54 typedef uint32_t SBPrefix; |
54 | 55 |
55 // A full hash. | 56 // A full hash. |
56 union SBFullHash { | 57 union SBFullHash { |
57 char full_hash[32]; | 58 char full_hash[32]; |
58 SBPrefix prefix; | 59 SBPrefix prefix; |
59 }; | 60 }; |
60 | 61 |
61 // Used when we get a gethash response. | 62 // Used when we get a gethash response. |
62 struct SBFullHashResult { | 63 struct SBFullHashResult { |
63 SBFullHash hash; | 64 SBFullHash hash; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 165 |
165 // Given a URL, returns all the paths we need to check. | 166 // Given a URL, returns all the paths we need to check. |
166 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); | 167 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); |
167 | 168 |
168 // Given a URL, returns all the patterns we need to check. | 169 // Given a URL, returns all the patterns we need to check. |
169 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); | 170 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); |
170 | 171 |
171 } // namespace safe_browsing | 172 } // namespace safe_browsing |
172 | 173 |
173 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ | 174 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ |
OLD | NEW |