Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_util.cc

Issue 172393005: [safe browsing] Remove stale BINHASH code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update histogram info in comment. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/google/google_util.h" 10 #include "chrome/browser/google/google_util.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return false; 162 return false;
163 } 163 }
164 } // namespace 164 } // namespace
165 165
166 namespace safe_browsing_util { 166 namespace safe_browsing_util {
167 167
168 // Listnames that browser can process. 168 // Listnames that browser can process.
169 const char kMalwareList[] = "goog-malware-shavar"; 169 const char kMalwareList[] = "goog-malware-shavar";
170 const char kPhishingList[] = "goog-phish-shavar"; 170 const char kPhishingList[] = "goog-phish-shavar";
171 const char kBinUrlList[] = "goog-badbinurl-shavar"; 171 const char kBinUrlList[] = "goog-badbinurl-shavar";
172 // We don't use the bad binary digest list anymore. Use a fake listname to be
173 // sure we don't request it accidentally.
174 const char kBinHashList[] = "goog-badbin-digestvar-disabled";
175 const char kCsdWhiteList[] = "goog-csdwhite-sha256"; 172 const char kCsdWhiteList[] = "goog-csdwhite-sha256";
176 const char kDownloadWhiteList[] = "goog-downloadwhite-digest256"; 173 const char kDownloadWhiteList[] = "goog-downloadwhite-digest256";
177 const char kExtensionBlacklist[] = "goog-badcrxids-digestvar"; 174 const char kExtensionBlacklist[] = "goog-badcrxids-digestvar";
178 const char kSideEffectFreeWhitelist[] = "goog-sideeffectfree-shavar"; 175 const char kSideEffectFreeWhitelist[] = "goog-sideeffectfree-shavar";
179 const char kIPBlacklist[] = "goog-badip-digest256"; 176 const char kIPBlacklist[] = "goog-badip-digest256";
180 177
181 const char* kAllLists[10] = { 178 const char* kAllLists[8] = {
182 kMalwareList, 179 kMalwareList,
183 kPhishingList, 180 kPhishingList,
184 kBinUrlList, 181 kBinUrlList,
185 kBinHashList,
186 kCsdWhiteList, 182 kCsdWhiteList,
187 kDownloadWhiteList, 183 kDownloadWhiteList,
188 kDownloadWhiteList,
189 kExtensionBlacklist, 184 kExtensionBlacklist,
190 kSideEffectFreeWhitelist, 185 kSideEffectFreeWhitelist,
191 kIPBlacklist, 186 kIPBlacklist,
192 }; 187 };
193 188
194 ListType GetListId(const std::string& name) { 189 ListType GetListId(const std::string& name) {
195 ListType id; 190 ListType id;
196 if (name == safe_browsing_util::kMalwareList) { 191 if (name == safe_browsing_util::kMalwareList) {
197 id = MALWARE; 192 id = MALWARE;
198 } else if (name == safe_browsing_util::kPhishingList) { 193 } else if (name == safe_browsing_util::kPhishingList) {
199 id = PHISH; 194 id = PHISH;
200 } else if (name == safe_browsing_util::kBinUrlList) { 195 } else if (name == safe_browsing_util::kBinUrlList) {
201 id = BINURL; 196 id = BINURL;
202 } else if (name == safe_browsing_util::kBinHashList) {
203 id = BINHASH;
204 } else if (name == safe_browsing_util::kCsdWhiteList) { 197 } else if (name == safe_browsing_util::kCsdWhiteList) {
205 id = CSDWHITELIST; 198 id = CSDWHITELIST;
206 } else if (name == safe_browsing_util::kDownloadWhiteList) { 199 } else if (name == safe_browsing_util::kDownloadWhiteList) {
207 id = DOWNLOADWHITELIST; 200 id = DOWNLOADWHITELIST;
208 } else if (name == safe_browsing_util::kExtensionBlacklist) { 201 } else if (name == safe_browsing_util::kExtensionBlacklist) {
209 id = EXTENSIONBLACKLIST; 202 id = EXTENSIONBLACKLIST;
210 } else if (name == safe_browsing_util::kSideEffectFreeWhitelist) { 203 } else if (name == safe_browsing_util::kSideEffectFreeWhitelist) {
211 id = SIDEEFFECTFREEWHITELIST; 204 id = SIDEEFFECTFREEWHITELIST;
212 } else if (name == safe_browsing_util::kIPBlacklist) { 205 } else if (name == safe_browsing_util::kIPBlacklist) {
213 id = IPBLACKLIST; 206 id = IPBLACKLIST;
214 } else { 207 } else {
215 id = INVALID; 208 id = INVALID;
216 } 209 }
217 return id; 210 return id;
218 } 211 }
219 212
220 bool GetListName(ListType list_id, std::string* list) { 213 bool GetListName(ListType list_id, std::string* list) {
221 switch (list_id) { 214 switch (list_id) {
222 case MALWARE: 215 case MALWARE:
223 *list = safe_browsing_util::kMalwareList; 216 *list = safe_browsing_util::kMalwareList;
224 break; 217 break;
225 case PHISH: 218 case PHISH:
226 *list = safe_browsing_util::kPhishingList; 219 *list = safe_browsing_util::kPhishingList;
227 break; 220 break;
228 case BINURL: 221 case BINURL:
229 *list = safe_browsing_util::kBinUrlList; 222 *list = safe_browsing_util::kBinUrlList;
230 break; 223 break;
231 case BINHASH:
232 *list = safe_browsing_util::kBinHashList;
233 break;
234 case CSDWHITELIST: 224 case CSDWHITELIST:
235 *list = safe_browsing_util::kCsdWhiteList; 225 *list = safe_browsing_util::kCsdWhiteList;
236 break; 226 break;
237 case DOWNLOADWHITELIST: 227 case DOWNLOADWHITELIST:
238 *list = safe_browsing_util::kDownloadWhiteList; 228 *list = safe_browsing_util::kDownloadWhiteList;
239 break; 229 break;
240 case EXTENSIONBLACKLIST: 230 case EXTENSIONBLACKLIST:
241 *list = safe_browsing_util::kExtensionBlacklist; 231 *list = safe_browsing_util::kExtensionBlacklist;
242 break; 232 break;
243 case SIDEEFFECTFREEWHITELIST: 233 case SIDEEFFECTFREEWHITELIST:
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 } 494 }
505 495
506 bool IsMalwareList(const std::string& list_name) { 496 bool IsMalwareList(const std::string& list_name) {
507 return list_name.compare(kMalwareList) == 0; 497 return list_name.compare(kMalwareList) == 0;
508 } 498 }
509 499
510 bool IsBadbinurlList(const std::string& list_name) { 500 bool IsBadbinurlList(const std::string& list_name) {
511 return list_name.compare(kBinUrlList) == 0; 501 return list_name.compare(kBinUrlList) == 0;
512 } 502 }
513 503
514 bool IsBadbinhashList(const std::string& list_name) {
515 return list_name.compare(kBinHashList) == 0;
516 }
517
518 bool IsExtensionList(const std::string& list_name) { 504 bool IsExtensionList(const std::string& list_name) {
519 return list_name.compare(kExtensionBlacklist) == 0; 505 return list_name.compare(kExtensionBlacklist) == 0;
520 } 506 }
521 507
522 GURL GeneratePhishingReportUrl(const std::string& report_page, 508 GURL GeneratePhishingReportUrl(const std::string& report_page,
523 const std::string& url_to_report, 509 const std::string& url_to_report,
524 bool is_client_side_detection) { 510 bool is_client_side_detection) {
525 const std::string current_esc = net::EscapeQueryParamValue(url_to_report, 511 const std::string current_esc = net::EscapeQueryParamValue(url_to_report,
526 true); 512 true);
527 513
(...skipping 18 matching lines...) Expand all
546 memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length); 532 memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length);
547 return hash_out; 533 return hash_out;
548 } 534 }
549 535
550 std::string SBFullHashToString(const SBFullHash& hash) { 536 std::string SBFullHashToString(const SBFullHash& hash) {
551 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash)); 537 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash));
552 return std::string(hash.full_hash, sizeof(hash.full_hash)); 538 return std::string(hash.full_hash, sizeof(hash.full_hash));
553 } 539 }
554 540
555 } // namespace safe_browsing_util 541 } // namespace safe_browsing_util
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_util.h ('k') | chrome/browser/safe_browsing/safe_browsing_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698