OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 code. | 5 // Utilities for the SafeBrowsing code. |
6 | 6 |
7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
9 | 9 |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 enum SBThreatType { | 126 enum SBThreatType { |
127 // No threat at all. | 127 // No threat at all. |
128 SB_THREAT_TYPE_SAFE, | 128 SB_THREAT_TYPE_SAFE, |
129 | 129 |
130 // The URL is being used for phishing. | 130 // The URL is being used for phishing. |
131 SB_THREAT_TYPE_URL_PHISHING, | 131 SB_THREAT_TYPE_URL_PHISHING, |
132 | 132 |
133 // The URL hosts malware. | 133 // The URL hosts malware. |
134 SB_THREAT_TYPE_URL_MALWARE, | 134 SB_THREAT_TYPE_URL_MALWARE, |
135 | 135 |
136 // The URL hosts harmful programs. | 136 // The URL hosts unwanted programs. |
137 SB_THREAT_TYPE_URL_HARMFUL, | 137 SB_THREAT_TYPE_URL_UNWANTED, |
138 | 138 |
139 // The download URL is malware. | 139 // The download URL is malware. |
140 SB_THREAT_TYPE_BINARY_MALWARE_URL, | 140 SB_THREAT_TYPE_BINARY_MALWARE_URL, |
141 | 141 |
142 // Url detected by the client-side phishing model. Note that unlike the | 142 // Url detected by the client-side phishing model. Note that unlike the |
143 // above values, this does not correspond to a downloaded list. | 143 // above values, this does not correspond to a downloaded list. |
144 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL, | 144 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL, |
145 | 145 |
146 // The Chrome extension or app (given by its ID) is malware. | 146 // The Chrome extension or app (given by its ID) is malware. |
147 SB_THREAT_TYPE_EXTENSION, | 147 SB_THREAT_TYPE_EXTENSION, |
(...skipping 15 matching lines...) Expand all Loading... |
163 // SafeBrowsing client-side detection whitelist list name. | 163 // SafeBrowsing client-side detection whitelist list name. |
164 extern const char kCsdWhiteList[]; | 164 extern const char kCsdWhiteList[]; |
165 // SafeBrowsing download whitelist list name. | 165 // SafeBrowsing download whitelist list name. |
166 extern const char kDownloadWhiteList[]; | 166 extern const char kDownloadWhiteList[]; |
167 // SafeBrowsing extension list name. | 167 // SafeBrowsing extension list name. |
168 extern const char kExtensionBlacklist[]; | 168 extern const char kExtensionBlacklist[]; |
169 // SafeBrowsing side-effect free whitelist name. | 169 // SafeBrowsing side-effect free whitelist name. |
170 extern const char kSideEffectFreeWhitelist[]; | 170 extern const char kSideEffectFreeWhitelist[]; |
171 // SafeBrowsing csd malware IP blacklist name. | 171 // SafeBrowsing csd malware IP blacklist name. |
172 extern const char kIPBlacklist[]; | 172 extern const char kIPBlacklist[]; |
| 173 // SafeBrowsing unwanted URL list. |
| 174 extern const char kUnwantedUrlList[]; |
173 | 175 |
174 // This array must contain all Safe Browsing lists. | 176 // This array must contain all Safe Browsing lists. |
175 extern const char* kAllLists[8]; | 177 extern const char* kAllLists[9]; |
176 | 178 |
177 enum ListType { | 179 enum ListType { |
178 INVALID = -1, | 180 INVALID = -1, |
179 MALWARE = 0, | 181 MALWARE = 0, |
180 PHISH = 1, | 182 PHISH = 1, |
181 BINURL = 2, | 183 BINURL = 2, |
182 // Obsolete BINHASH = 3, | 184 // Obsolete BINHASH = 3, |
183 CSDWHITELIST = 4, | 185 CSDWHITELIST = 4, |
184 // SafeBrowsing lists are stored in pairs. Keep ListType 5 | 186 // SafeBrowsing lists are stored in pairs. Keep ListType 5 |
185 // available for a potential second list that we would store in the | 187 // available for a potential second list that we would store in the |
186 // csd-whitelist store file. | 188 // csd-whitelist store file. |
187 DOWNLOADWHITELIST = 6, | 189 DOWNLOADWHITELIST = 6, |
188 // See above comment. Leave 7 available. | 190 // See above comment. Leave 7 available. |
189 EXTENSIONBLACKLIST = 8, | 191 EXTENSIONBLACKLIST = 8, |
190 // See above comment. Leave 9 available. | 192 // See above comment. Leave 9 available. |
191 SIDEEFFECTFREEWHITELIST = 10, | 193 SIDEEFFECTFREEWHITELIST = 10, |
192 // See above comment. Leave 11 available. | 194 // See above comment. Leave 11 available. |
193 IPBLACKLIST = 12, | 195 IPBLACKLIST = 12, |
194 // See above comment. Leave 13 available. | 196 // See above comment. Leave 13 available. |
| 197 UNWANTEDURL = 14, |
| 198 // See above comment. Leave 15 available. |
195 }; | 199 }; |
196 | 200 |
197 // Maps a list name to ListType. | 201 // Maps a list name to ListType. |
198 ListType GetListId(const base::StringPiece& name); | 202 ListType GetListId(const base::StringPiece& name); |
199 | 203 |
200 // Maps a ListId to list name. Return false if fails. | 204 // Maps a ListId to list name. Return false if fails. |
201 bool GetListName(ListType list_id, std::string* list); | 205 bool GetListName(ListType list_id, std::string* list); |
202 | 206 |
203 // Canonicalizes url as per Google Safe Browsing Specification. | 207 // Canonicalizes url as per Google Safe Browsing Specification. |
204 // See section 6.1 in | 208 // See section 6.1 in |
(...skipping 15 matching lines...) Expand all Loading... |
220 GURL GeneratePhishingReportUrl(const std::string& report_page, | 224 GURL GeneratePhishingReportUrl(const std::string& report_page, |
221 const std::string& url_to_report, | 225 const std::string& url_to_report, |
222 bool is_client_side_detection); | 226 bool is_client_side_detection); |
223 | 227 |
224 SBFullHash StringToSBFullHash(const std::string& hash_in); | 228 SBFullHash StringToSBFullHash(const std::string& hash_in); |
225 std::string SBFullHashToString(const SBFullHash& hash_out); | 229 std::string SBFullHashToString(const SBFullHash& hash_out); |
226 | 230 |
227 } // namespace safe_browsing_util | 231 } // namespace safe_browsing_util |
228 | 232 |
229 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 233 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
OLD | NEW |