| 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 #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/browser_process.h" |
| 10 #include "chrome/browser/google/google_util.h" | 11 #include "chrome/browser/google/google_util.h" |
| 11 #include "crypto/sha2.h" | 12 #include "crypto/sha2.h" |
| 12 #include "net/base/escape.h" | 13 #include "net/base/escape.h" |
| 13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 14 #include "url/url_util.h" | 15 #include "url/url_util.h" |
| 15 | 16 |
| 16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 17 #include "chrome/installer/util/browser_distribution.h" | 18 #include "chrome/installer/util/browser_distribution.h" |
| 18 #endif | 19 #endif |
| 19 | 20 |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 std::string client_name(dist->GetSafeBrowsingName()); | 512 std::string client_name(dist->GetSafeBrowsingName()); |
| 512 #else | 513 #else |
| 513 std::string client_name("googlechrome"); | 514 std::string client_name("googlechrome"); |
| 514 #endif | 515 #endif |
| 515 if (is_client_side_detection) | 516 if (is_client_side_detection) |
| 516 client_name.append("_csd"); | 517 client_name.append("_csd"); |
| 517 | 518 |
| 518 GURL report_url(report_page + base::StringPrintf(kReportParams, | 519 GURL report_url(report_page + base::StringPrintf(kReportParams, |
| 519 client_name.c_str(), | 520 client_name.c_str(), |
| 520 current_esc.c_str())); | 521 current_esc.c_str())); |
| 521 return google_util::AppendGoogleLocaleParam(report_url); | 522 return google_util::AppendGoogleLocaleParam( |
| 523 report_url, g_browser_process->GetApplicationLocale()); |
| 522 } | 524 } |
| 523 | 525 |
| 524 SBFullHash StringToSBFullHash(const std::string& hash_in) { | 526 SBFullHash StringToSBFullHash(const std::string& hash_in) { |
| 525 DCHECK_EQ(crypto::kSHA256Length, hash_in.size()); | 527 DCHECK_EQ(crypto::kSHA256Length, hash_in.size()); |
| 526 SBFullHash hash_out; | 528 SBFullHash hash_out; |
| 527 memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length); | 529 memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length); |
| 528 return hash_out; | 530 return hash_out; |
| 529 } | 531 } |
| 530 | 532 |
| 531 std::string SBFullHashToString(const SBFullHash& hash) { | 533 std::string SBFullHashToString(const SBFullHash& hash) { |
| 532 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash)); | 534 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash)); |
| 533 return std::string(hash.full_hash, sizeof(hash.full_hash)); | 535 return std::string(hash.full_hash, sizeof(hash.full_hash)); |
| 534 } | 536 } |
| 535 | 537 |
| 536 } // namespace safe_browsing_util | 538 } // namespace safe_browsing_util |
| OLD | NEW |