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