| 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> | 10 #include <stdint.h> |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // SafeBrowsing client-side detection whitelist list name. | 125 // SafeBrowsing client-side detection whitelist list name. |
| 126 extern const char kCsdWhiteList[]; | 126 extern const char kCsdWhiteList[]; |
| 127 // SafeBrowsing download whitelist list name. | 127 // SafeBrowsing download whitelist list name. |
| 128 extern const char kDownloadWhiteList[]; | 128 extern const char kDownloadWhiteList[]; |
| 129 // SafeBrowsing extension list name. | 129 // SafeBrowsing extension list name. |
| 130 extern const char kExtensionBlacklist[]; | 130 extern const char kExtensionBlacklist[]; |
| 131 // SafeBrowsing csd malware IP blacklist name. | 131 // SafeBrowsing csd malware IP blacklist name. |
| 132 extern const char kIPBlacklist[]; | 132 extern const char kIPBlacklist[]; |
| 133 // SafeBrowsing unwanted URL list. | 133 // SafeBrowsing unwanted URL list. |
| 134 extern const char kUnwantedUrlList[]; | 134 extern const char kUnwantedUrlList[]; |
| 135 // SafeBrowsing off-domain inclusion whitelist list name. | |
| 136 extern const char kInclusionWhitelist[]; | |
| 137 // SafeBrowsing module whitelist list name. | 135 // SafeBrowsing module whitelist list name. |
| 138 extern const char kModuleWhitelist[]; | 136 extern const char kModuleWhitelist[]; |
| 139 // Blacklisted resource URLs list name. | 137 // Blacklisted resource URLs list name. |
| 140 extern const char kResourceBlacklist[]; | 138 extern const char kResourceBlacklist[]; |
| 141 /// This array must contain all Safe Browsing lists. | 139 /// This array must contain all Safe Browsing lists. |
| 142 extern const char* kAllLists[11]; | 140 extern const char* kAllLists[10]; |
| 143 | 141 |
| 144 enum ListType { | 142 enum ListType { |
| 145 INVALID = -1, | 143 INVALID = -1, |
| 146 MALWARE = 0, | 144 MALWARE = 0, |
| 147 PHISH = 1, | 145 PHISH = 1, |
| 148 BINURL = 2, | 146 BINURL = 2, |
| 149 // Obsolete BINHASH = 3, | 147 // Obsolete BINHASH = 3, |
| 150 CSDWHITELIST = 4, | 148 CSDWHITELIST = 4, |
| 151 // SafeBrowsing lists are stored in pairs. Keep ListType 5 | 149 // SafeBrowsing lists are stored in pairs. Keep ListType 5 |
| 152 // available for a potential second list that we would store in the | 150 // available for a potential second list that we would store in the |
| 153 // csd-whitelist store file. | 151 // csd-whitelist store file. |
| 154 DOWNLOADWHITELIST = 6, | 152 DOWNLOADWHITELIST = 6, |
| 155 // See above comment. Leave 7 available. | 153 // See above comment. Leave 7 available. |
| 156 EXTENSIONBLACKLIST = 8, | 154 EXTENSIONBLACKLIST = 8, |
| 157 // See above comment. Leave 9 available. | 155 // See above comment. Leave 9 available. |
| 158 // Obsolete SIDEEFFECTFREEWHITELIST = 10, | 156 // Obsolete SIDEEFFECTFREEWHITELIST = 10, |
| 159 // See above comment. Leave 11 available. | 157 // See above comment. Leave 11 available. |
| 160 IPBLACKLIST = 12, | 158 IPBLACKLIST = 12, |
| 161 // See above comment. Leave 13 available. | 159 // See above comment. Leave 13 available. |
| 162 UNWANTEDURL = 14, | 160 UNWANTEDURL = 14, |
| 163 // See above comment. Leave 15 available. | 161 // See above comment. Leave 15 available. |
| 164 INCLUSIONWHITELIST = 16, | 162 // Obsolete INCLUSIONWHITELIST = 16, |
| 165 // See above comment. Leave 17 available. | 163 // See above comment. Leave 17 available. |
| 166 MODULEWHITELIST = 18, | 164 MODULEWHITELIST = 18, |
| 167 // See above comment. Leave 19 available. | 165 // See above comment. Leave 19 available. |
| 168 RESOURCEBLACKLIST = 20, | 166 RESOURCEBLACKLIST = 20, |
| 169 // See above comment. Leave 21 available. | 167 // See above comment. Leave 21 available. |
| 170 }; | 168 }; |
| 171 | 169 |
| 172 inline bool SBFullHashEqual(const SBFullHash& a, const SBFullHash& b) { | 170 inline bool SBFullHashEqual(const SBFullHash& a, const SBFullHash& b) { |
| 173 return !memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash)); | 171 return !memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash)); |
| 174 } | 172 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 209 |
| 212 // Given a URL, returns all the paths we need to check. | 210 // Given a URL, returns all the paths we need to check. |
| 213 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); | 211 void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths); |
| 214 | 212 |
| 215 // Given a URL, returns all the patterns we need to check. | 213 // Given a URL, returns all the patterns we need to check. |
| 216 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); | 214 void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls); |
| 217 | 215 |
| 218 } // namespace safe_browsing | 216 } // namespace safe_browsing |
| 219 | 217 |
| 220 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ | 218 #endif // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_ |
| OLD | NEW |