| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 | 162 |
| 163 // Utility functions ----------------------------------------------------------- | 163 // Utility functions ----------------------------------------------------------- |
| 164 | 164 |
| 165 namespace safe_browsing_util { | 165 namespace safe_browsing_util { |
| 166 | 166 |
| 167 // Listnames that browser can process. | 167 // Listnames that browser can process. |
| 168 const char kMalwareList[] = "goog-malware-shavar"; | 168 const char kMalwareList[] = "goog-malware-shavar"; |
| 169 const char kPhishingList[] = "goog-phish-shavar"; | 169 const char kPhishingList[] = "goog-phish-shavar"; |
| 170 const char kBinUrlList[] = "goog-badbinurl-shavar"; | 170 const char kBinUrlList[] = "goog-badbinurl-shavar"; |
| 171 const char kBinHashList[] = "goog-badbin-digestvar"; | 171 // We don't use the bad binary digest list anymore. Use a fake listname to be |
| 172 // sure we don't request it accidentally. |
| 173 const char kBinHashList[] = "goog-badbin-digestvar-disabled"; |
| 172 const char kCsdWhiteList[] = "goog-csdwhite-sha256"; | 174 const char kCsdWhiteList[] = "goog-csdwhite-sha256"; |
| 173 const char kDownloadWhiteList[] = "goog-downloadwhite-digest256"; | 175 const char kDownloadWhiteList[] = "goog-downloadwhite-digest256"; |
| 174 | 176 |
| 175 int GetListId(const std::string& name) { | 177 int GetListId(const std::string& name) { |
| 176 int id; | 178 int id; |
| 177 if (name == safe_browsing_util::kMalwareList) { | 179 if (name == safe_browsing_util::kMalwareList) { |
| 178 id = MALWARE; | 180 id = MALWARE; |
| 179 } else if (name == safe_browsing_util::kPhishingList) { | 181 } else if (name == safe_browsing_util::kPhishingList) { |
| 180 id = PHISH; | 182 id = PHISH; |
| 181 } else if (name == safe_browsing_util::kBinUrlList) { | 183 } else if (name == safe_browsing_util::kBinUrlList) { |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out) { | 543 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out) { |
| 542 DCHECK_EQ(crypto::kSHA256Length, hash_in.size()); | 544 DCHECK_EQ(crypto::kSHA256Length, hash_in.size()); |
| 543 memcpy(hash_out->full_hash, hash_in.data(), crypto::kSHA256Length); | 545 memcpy(hash_out->full_hash, hash_in.data(), crypto::kSHA256Length); |
| 544 } | 546 } |
| 545 | 547 |
| 546 std::string SBFullHashToString(const SBFullHash& hash) { | 548 std::string SBFullHashToString(const SBFullHash& hash) { |
| 547 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash)); | 549 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash)); |
| 548 return std::string(hash.full_hash, sizeof(hash.full_hash)); | 550 return std::string(hash.full_hash, sizeof(hash.full_hash)); |
| 549 } | 551 } |
| 550 } // namespace safe_browsing_util | 552 } // namespace safe_browsing_util |
| OLD | NEW |