| 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 14 matching lines...) Expand all Loading... |
| 25 #include "base/sys_info.h" | 25 #include "base/sys_info.h" |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #include "components/crx_file/id_util.h" | 27 #include "components/crx_file/id_util.h" |
| 28 #include "components/data_use_measurement/core/data_use_user_data.h" | 28 #include "components/data_use_measurement/core/data_use_user_data.h" |
| 29 #include "components/update_client/component.h" | 29 #include "components/update_client/component.h" |
| 30 #include "components/update_client/configurator.h" | 30 #include "components/update_client/configurator.h" |
| 31 #include "components/update_client/crx_update_item.h" | 31 #include "components/update_client/crx_update_item.h" |
| 32 #include "components/update_client/update_client.h" | 32 #include "components/update_client/update_client.h" |
| 33 #include "components/update_client/update_client_errors.h" | 33 #include "components/update_client/update_client_errors.h" |
| 34 #include "components/update_client/update_query_params.h" | 34 #include "components/update_client/update_query_params.h" |
| 35 #include "components/update_client/update_response.h" |
| 35 #include "components/update_client/updater_state.h" | 36 #include "components/update_client/updater_state.h" |
| 36 #include "crypto/secure_hash.h" | 37 #include "crypto/secure_hash.h" |
| 37 #include "crypto/sha2.h" | 38 #include "crypto/sha2.h" |
| 38 #include "net/base/load_flags.h" | 39 #include "net/base/load_flags.h" |
| 39 #include "net/url_request/url_fetcher.h" | 40 #include "net/url_request/url_fetcher.h" |
| 40 #include "net/url_request/url_request_context_getter.h" | 41 #include "net/url_request/url_request_context_getter.h" |
| 41 #include "net/url_request/url_request_status.h" | 42 #include "net/url_request/url_request_status.h" |
| 42 #include "url/gurl.h" | 43 #include "url/gurl.h" |
| 43 | 44 |
| 44 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 std::string GetServicePack() { | 89 std::string GetServicePack() { |
| 89 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
| 90 return base::win::OSInfo::GetInstance()->service_pack_str(); | 91 return base::win::OSInfo::GetInstance()->service_pack_str(); |
| 91 #else | 92 #else |
| 92 return std::string(); | 93 return std::string(); |
| 93 #endif | 94 #endif |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace | 97 } // namespace |
| 97 | 98 |
| 98 // Builds a protocol message. The protocol versions so far are: | 99 // Builds a protocol message. |
| 99 // * Version 3.1: it changes how the run actions are serialized. | |
| 100 // * Version 3.0: it is the version implemented by the desktop updaters. | |
| 101 std::string BuildProtocolRequest( | 100 std::string BuildProtocolRequest( |
| 102 const std::string& prod_id, | 101 const std::string& prod_id, |
| 103 const std::string& browser_version, | 102 const std::string& browser_version, |
| 104 const std::string& channel, | 103 const std::string& channel, |
| 105 const std::string& lang, | 104 const std::string& lang, |
| 106 const std::string& os_long_name, | 105 const std::string& os_long_name, |
| 107 const std::string& download_preference, | 106 const std::string& download_preference, |
| 108 const std::string& request_body, | 107 const std::string& request_body, |
| 109 const std::string& additional_attributes, | 108 const std::string& additional_attributes, |
| 110 const std::unique_ptr<UpdaterState::Attributes>& updater_state_attributes) { | 109 const std::unique_ptr<UpdaterState::Attributes>& updater_state_attributes) { |
| 111 std::string request( | 110 std::string request = base::StringPrintf( |
| 112 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | 111 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 113 "<request protocol=\"3.1\" "); | 112 "<request protocol=\"%s\" ", |
| 113 kProtocolVersion); |
| 114 | 114 |
| 115 if (!additional_attributes.empty()) | 115 if (!additional_attributes.empty()) |
| 116 base::StringAppendF(&request, "%s ", additional_attributes.c_str()); | 116 base::StringAppendF(&request, "%s ", additional_attributes.c_str()); |
| 117 | 117 |
| 118 // Chrome version and platform information. | 118 // Chrome version and platform information. |
| 119 base::StringAppendF( | 119 base::StringAppendF( |
| 120 &request, | 120 &request, |
| 121 "version=\"%s-%s\" prodversion=\"%s\" " | 121 "version=\"%s-%s\" prodversion=\"%s\" " |
| 122 "requestid=\"{%s}\" lang=\"%s\" updaterchannel=\"%s\" prodchannel=\"%s\" " | 122 "requestid=\"{%s}\" lang=\"%s\" updaterchannel=\"%s\" prodchannel=\"%s\" " |
| 123 "os=\"%s\" arch=\"%s\" nacl_arch=\"%s\"", | 123 "os=\"%s\" arch=\"%s\" nacl_arch=\"%s\"", |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), | 344 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), |
| 345 urls->end()); | 345 urls->end()); |
| 346 } | 346 } |
| 347 | 347 |
| 348 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { | 348 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { |
| 349 return CrxInstaller::Result(callback.Run() ? InstallError::NONE | 349 return CrxInstaller::Result(callback.Run() ? InstallError::NONE |
| 350 : InstallError::GENERIC_ERROR); | 350 : InstallError::GENERIC_ERROR); |
| 351 } | 351 } |
| 352 | 352 |
| 353 } // namespace update_client | 353 } // namespace update_client |
| OLD | NEW |