| 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/update_client/utils.h" | 5 #include "components/update_client/utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 return id; | 58 return id; |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 std::string BuildProtocolRequest(const std::string& browser_version, | 63 std::string BuildProtocolRequest(const std::string& browser_version, |
| 64 const std::string& channel, | 64 const std::string& channel, |
| 65 const std::string& lang, | 65 const std::string& lang, |
| 66 const std::string& os_long_name, | 66 const std::string& os_long_name, |
| 67 const std::string& download_preference, |
| 67 const std::string& request_body, | 68 const std::string& request_body, |
| 68 const std::string& additional_attributes) { | 69 const std::string& additional_attributes) { |
| 69 const std::string prod_id( | 70 const std::string prod_id( |
| 70 UpdateQueryParams::GetProdIdString(UpdateQueryParams::CHROME)); | 71 UpdateQueryParams::GetProdIdString(UpdateQueryParams::CHROME)); |
| 71 | 72 |
| 72 std::string request( | 73 std::string request( |
| 73 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | 74 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 74 "<request protocol=\"3.0\" "); | 75 "<request protocol=\"3.0\" "); |
| 75 | 76 |
| 76 if (!additional_attributes.empty()) | 77 if (!additional_attributes.empty()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 91 channel.c_str(), // "prodchannel" | 92 channel.c_str(), // "prodchannel" |
| 92 UpdateQueryParams::GetOS(), // "os" | 93 UpdateQueryParams::GetOS(), // "os" |
| 93 UpdateQueryParams::GetArch(), // "arch" | 94 UpdateQueryParams::GetArch(), // "arch" |
| 94 UpdateQueryParams::GetNaclArch()); // "nacl_arch" | 95 UpdateQueryParams::GetNaclArch()); // "nacl_arch" |
| 95 #if defined(OS_WIN) | 96 #if defined(OS_WIN) |
| 96 const bool is_wow64(base::win::OSInfo::GetInstance()->wow64_status() == | 97 const bool is_wow64(base::win::OSInfo::GetInstance()->wow64_status() == |
| 97 base::win::OSInfo::WOW64_ENABLED); | 98 base::win::OSInfo::WOW64_ENABLED); |
| 98 if (is_wow64) | 99 if (is_wow64) |
| 99 base::StringAppendF(&request, " wow64=\"1\""); | 100 base::StringAppendF(&request, " wow64=\"1\""); |
| 100 #endif | 101 #endif |
| 102 if (!download_preference.empty()) |
| 103 base::StringAppendF(&request, " dlpref=\"%s\"", |
| 104 download_preference.c_str()); |
| 101 base::StringAppendF(&request, ">"); | 105 base::StringAppendF(&request, ">"); |
| 102 | 106 |
| 103 // HW platform information. | 107 // HW platform information. |
| 104 base::StringAppendF(&request, "<hw physmemory=\"%d\"/>", | 108 base::StringAppendF(&request, "<hw physmemory=\"%d\"/>", |
| 105 GetPhysicalMemoryGB()); // "physmem" in GB. | 109 GetPhysicalMemoryGB()); // "physmem" in GB. |
| 106 | 110 |
| 107 // OS version and platform information. | 111 // OS version and platform information. |
| 108 base::StringAppendF( | 112 base::StringAppendF( |
| 109 &request, "<os platform=\"%s\" version=\"%s\" arch=\"%s\"/>", | 113 &request, "<os platform=\"%s\" version=\"%s\" arch=\"%s\"/>", |
| 110 os_long_name.c_str(), // "platform" | 114 os_long_name.c_str(), // "platform" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 192 } |
| 189 | 193 |
| 190 std::string GetCrxComponentID(const CrxComponent& component) { | 194 std::string GetCrxComponentID(const CrxComponent& component) { |
| 191 const size_t kCrxIdSize = 16; | 195 const size_t kCrxIdSize = 16; |
| 192 CHECK_GE(component.pk_hash.size(), kCrxIdSize); | 196 CHECK_GE(component.pk_hash.size(), kCrxIdSize); |
| 193 return HexStringToID(base::ToLowerASCII( | 197 return HexStringToID(base::ToLowerASCII( |
| 194 base::HexEncode(&component.pk_hash[0], kCrxIdSize))); | 198 base::HexEncode(&component.pk_hash[0], kCrxIdSize))); |
| 195 } | 199 } |
| 196 | 200 |
| 197 } // namespace update_client | 201 } // namespace update_client |
| OLD | NEW |