| 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 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 DCHECK(crx_file::id_util::IdIsValid(id)); | 64 DCHECK(crx_file::id_util::IdIsValid(id)); |
| 65 | 65 |
| 66 return id; | 66 return id; |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace | 69 } // namespace |
| 70 | 70 |
| 71 std::string BuildProtocolRequest(const std::string& browser_version, | 71 std::string BuildProtocolRequest(const std::string& prod_id, |
| 72 const std::string& browser_version, |
| 72 const std::string& channel, | 73 const std::string& channel, |
| 73 const std::string& lang, | 74 const std::string& lang, |
| 74 const std::string& os_long_name, | 75 const std::string& os_long_name, |
| 75 const std::string& download_preference, | 76 const std::string& download_preference, |
| 76 const std::string& request_body, | 77 const std::string& request_body, |
| 77 const std::string& additional_attributes) { | 78 const std::string& additional_attributes) { |
| 78 const std::string prod_id( | |
| 79 UpdateQueryParams::GetProdIdString(UpdateQueryParams::CHROME)); | |
| 80 | |
| 81 std::string request( | 79 std::string request( |
| 82 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | 80 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 83 "<request protocol=\"3.0\" "); | 81 "<request protocol=\"3.0\" "); |
| 84 | 82 |
| 85 if (!additional_attributes.empty()) | 83 if (!additional_attributes.empty()) |
| 86 base::StringAppendF(&request, "%s ", additional_attributes.c_str()); | 84 base::StringAppendF(&request, "%s ", additional_attributes.c_str()); |
| 87 | 85 |
| 88 // Chrome version and platform information. | 86 // Chrome version and platform information. |
| 89 base::StringAppendF( | 87 base::StringAppendF( |
| 90 &request, | 88 &request, |
| 91 "version=\"%s-%s\" prodversion=\"%s\" " | 89 "version=\"%s-%s\" prodversion=\"%s\" " |
| 92 "requestid=\"{%s}\" lang=\"%s\" updaterchannel=\"%s\" prodchannel=\"%s\" " | 90 "requestid=\"{%s}\" lang=\"%s\" updaterchannel=\"%s\" prodchannel=\"%s\" " |
| 93 "os=\"%s\" arch=\"%s\" nacl_arch=\"%s\"", | 91 "os=\"%s\" arch=\"%s\" nacl_arch=\"%s\"", |
| 94 prod_id.c_str(), | 92 prod_id.c_str(), // "version" is prefixed by prod_id. |
| 95 browser_version.c_str(), // "version" | 93 browser_version.c_str(), |
| 96 browser_version.c_str(), // "prodversion" | 94 browser_version.c_str(), // "prodversion" |
| 97 base::GenerateGUID().c_str(), // "requestid" | 95 base::GenerateGUID().c_str(), // "requestid" |
| 98 lang.c_str(), // "lang", | 96 lang.c_str(), // "lang", |
| 99 channel.c_str(), // "updaterchannel" | 97 channel.c_str(), // "updaterchannel" |
| 100 channel.c_str(), // "prodchannel" | 98 channel.c_str(), // "prodchannel" |
| 101 UpdateQueryParams::GetOS(), // "os" | 99 UpdateQueryParams::GetOS(), // "os" |
| 102 UpdateQueryParams::GetArch(), // "arch" | 100 UpdateQueryParams::GetArch(), // "arch" |
| 103 UpdateQueryParams::GetNaclArch()); // "nacl_arch" | 101 UpdateQueryParams::GetNaclArch()); // "nacl_arch" |
| 104 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
| 105 const bool is_wow64(base::win::OSInfo::GetInstance()->wow64_status() == | 103 const bool is_wow64(base::win::OSInfo::GetInstance()->wow64_status() == |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 277 |
| 280 void RemoveUnsecureUrls(std::vector<GURL>* urls) { | 278 void RemoveUnsecureUrls(std::vector<GURL>* urls) { |
| 281 DCHECK(urls); | 279 DCHECK(urls); |
| 282 urls->erase(std::remove_if( | 280 urls->erase(std::remove_if( |
| 283 urls->begin(), urls->end(), | 281 urls->begin(), urls->end(), |
| 284 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), | 282 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), |
| 285 urls->end()); | 283 urls->end()); |
| 286 } | 284 } |
| 287 | 285 |
| 288 } // namespace update_client | 286 } // namespace update_client |
| OLD | NEW |