| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/component_updater/component_updater_utils.h" | 5 #include "components/component_updater/component_updater_utils.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 7 #include <cmath> | 8 #include <cmath> |
| 8 | 9 |
| 9 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 11 #include "base/guid.h" | 12 #include "base/guid.h" |
| 12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 16 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 17 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
| 18 #include "components/component_updater/component_updater_configurator.h" | 19 #include "components/component_updater/component_updater_configurator.h" |
| 19 #include "components/component_updater/crx_update_item.h" | 20 #include "components/component_updater/crx_update_item.h" |
| 20 #include "components/crx_file/id_util.h" | 21 #include "components/crx_file/id_util.h" |
| 21 #include "components/omaha_query_params/omaha_query_params.h" | 22 #include "components/omaha_query_params/omaha_query_params.h" |
| 22 #include "net/base/load_flags.h" | 23 #include "net/base/load_flags.h" |
| 23 #include "net/url_request/url_fetcher.h" | 24 #include "net/url_request/url_fetcher.h" |
| 24 #include "net/url_request/url_request_context_getter.h" | 25 #include "net/url_request/url_request_context_getter.h" |
| 25 #include "net/url_request/url_request_status.h" | 26 #include "net/url_request/url_request_status.h" |
| 26 | 27 |
| 27 using omaha_query_params::OmahaQueryParams; | 28 using omaha_query_params::OmahaQueryParams; |
| 28 | 29 |
| 29 namespace component_updater { | 30 namespace component_updater { |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 // Returns the amount of physical memory in GB, rounded to the nearest GB. | 34 // Returns the amount of physical memory in GB, rounded to the nearest GB. |
| 34 int GetPhysicalMemoryGB() { | 35 int GetPhysicalMemoryGB() { |
| 35 const double kOneGB = 1024 * 1024 * 1024; | 36 const double kOneGB = 1024 * 1024 * 1024; |
| 36 const int64 phys_mem = base::SysInfo::AmountOfPhysicalMemory(); | 37 const int64_t phys_mem = base::SysInfo::AmountOfPhysicalMemory(); |
| 37 return static_cast<int>(std::floor(0.5 + phys_mem / kOneGB)); | 38 return static_cast<int>(std::floor(0.5 + phys_mem / kOneGB)); |
| 38 } | 39 } |
| 39 | 40 |
| 40 } // namespace | 41 } // namespace |
| 41 | 42 |
| 42 std::string BuildProtocolRequest(const std::string& browser_version, | 43 std::string BuildProtocolRequest(const std::string& browser_version, |
| 43 const std::string& channel, | 44 const std::string& channel, |
| 44 const std::string& lang, | 45 const std::string& lang, |
| 45 const std::string& os_long_name, | 46 const std::string& os_long_name, |
| 46 const std::string& request_body, | 47 const std::string& request_body, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 187 |
| 187 return id; | 188 return id; |
| 188 } | 189 } |
| 189 | 190 |
| 190 std::string GetCrxComponentID(const CrxComponent& component) { | 191 std::string GetCrxComponentID(const CrxComponent& component) { |
| 191 return HexStringToID(base::StringToLowerASCII( | 192 return HexStringToID(base::StringToLowerASCII( |
| 192 base::HexEncode(&component.pk_hash[0], component.pk_hash.size() / 2))); | 193 base::HexEncode(&component.pk_hash[0], component.pk_hash.size() / 2))); |
| 193 } | 194 } |
| 194 | 195 |
| 195 } // namespace component_updater | 196 } // namespace component_updater |
| OLD | NEW |