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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 std::string GetServicePack() { | 88 std::string GetServicePack() { |
89 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
90 return base::win::OSInfo::GetInstance()->service_pack_str(); | 90 return base::win::OSInfo::GetInstance()->service_pack_str(); |
91 #else | 91 #else |
92 return std::string(); | 92 return std::string(); |
93 #endif | 93 #endif |
94 } | 94 } |
95 | 95 |
96 } // namespace | 96 } // namespace |
97 | 97 |
| 98 // Builds a protocol message. The protocol versions so far are: |
| 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. |
98 std::string BuildProtocolRequest( | 101 std::string BuildProtocolRequest( |
99 const std::string& prod_id, | 102 const std::string& prod_id, |
100 const std::string& browser_version, | 103 const std::string& browser_version, |
101 const std::string& channel, | 104 const std::string& channel, |
102 const std::string& lang, | 105 const std::string& lang, |
103 const std::string& os_long_name, | 106 const std::string& os_long_name, |
104 const std::string& download_preference, | 107 const std::string& download_preference, |
105 const std::string& request_body, | 108 const std::string& request_body, |
106 const std::string& additional_attributes, | 109 const std::string& additional_attributes, |
107 const std::unique_ptr<UpdaterState::Attributes>& updater_state_attributes) { | 110 const std::unique_ptr<UpdaterState::Attributes>& updater_state_attributes) { |
108 std::string request( | 111 std::string request( |
109 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | 112 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
110 "<request protocol=\"3.0\" "); | 113 "<request protocol=\"3.1\" "); |
111 | 114 |
112 if (!additional_attributes.empty()) | 115 if (!additional_attributes.empty()) |
113 base::StringAppendF(&request, "%s ", additional_attributes.c_str()); | 116 base::StringAppendF(&request, "%s ", additional_attributes.c_str()); |
114 | 117 |
115 // Chrome version and platform information. | 118 // Chrome version and platform information. |
116 base::StringAppendF( | 119 base::StringAppendF( |
117 &request, | 120 &request, |
118 "version=\"%s-%s\" prodversion=\"%s\" " | 121 "version=\"%s-%s\" prodversion=\"%s\" " |
119 "requestid=\"{%s}\" lang=\"%s\" updaterchannel=\"%s\" prodchannel=\"%s\" " | 122 "requestid=\"{%s}\" lang=\"%s\" updaterchannel=\"%s\" prodchannel=\"%s\" " |
120 "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... |
341 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), | 344 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), |
342 urls->end()); | 345 urls->end()); |
343 } | 346 } |
344 | 347 |
345 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { | 348 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { |
346 return CrxInstaller::Result(callback.Run() ? InstallError::NONE | 349 return CrxInstaller::Result(callback.Run() ? InstallError::NONE |
347 : InstallError::GENERIC_ERROR); | 350 : InstallError::GENERIC_ERROR); |
348 } | 351 } |
349 | 352 |
350 } // namespace update_client | 353 } // namespace update_client |
OLD | NEW |