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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #if defined(OS_WIN) | 130 #if defined(OS_WIN) |
131 const bool is_wow64(base::win::OSInfo::GetInstance()->wow64_status() == | 131 const bool is_wow64(base::win::OSInfo::GetInstance()->wow64_status() == |
132 base::win::OSInfo::WOW64_ENABLED); | 132 base::win::OSInfo::WOW64_ENABLED); |
133 if (is_wow64) | 133 if (is_wow64) |
134 base::StringAppendF(&request, " wow64=\"1\""); | 134 base::StringAppendF(&request, " wow64=\"1\""); |
135 #endif | 135 #endif |
136 if (!download_preference.empty()) | 136 if (!download_preference.empty()) |
137 base::StringAppendF(&request, " dlpref=\"%s\"", | 137 base::StringAppendF(&request, " dlpref=\"%s\"", |
138 download_preference.c_str()); | 138 download_preference.c_str()); |
139 if (updater_state_attributes && | 139 if (updater_state_attributes && |
140 updater_state_attributes->count(UpdaterState::kDomainJoined)) { | 140 updater_state_attributes->count(UpdaterState::kIsEnterpriseManaged)) { |
141 base::StringAppendF( | 141 base::StringAppendF( |
142 &request, " %s=\"%s\"", // domainjoined | 142 &request, " %s=\"%s\"", // domainjoined |
143 UpdaterState::kDomainJoined, | 143 UpdaterState::kIsEnterpriseManaged, |
144 (*updater_state_attributes)[UpdaterState::kDomainJoined].c_str()); | 144 (*updater_state_attributes)[UpdaterState::kIsEnterpriseManaged] |
| 145 .c_str()); |
145 } | 146 } |
146 base::StringAppendF(&request, ">"); | 147 base::StringAppendF(&request, ">"); |
147 | 148 |
148 // HW platform information. | 149 // HW platform information. |
149 base::StringAppendF(&request, "<hw physmemory=\"%d\"/>", | 150 base::StringAppendF(&request, "<hw physmemory=\"%d\"/>", |
150 GetPhysicalMemoryGB()); // "physmem" in GB. | 151 GetPhysicalMemoryGB()); // "physmem" in GB. |
151 | 152 |
152 // OS version and platform information. | 153 // OS version and platform information. |
153 const std::string os_version = GetOSVersion(); | 154 const std::string os_version = GetOSVersion(); |
154 const std::string os_sp = GetServicePack(); | 155 const std::string os_sp = GetServicePack(); |
155 base::StringAppendF( | 156 base::StringAppendF( |
156 &request, "<os platform=\"%s\" arch=\"%s\"", | 157 &request, "<os platform=\"%s\" arch=\"%s\"", |
157 os_long_name.c_str(), // "platform" | 158 os_long_name.c_str(), // "platform" |
158 base::SysInfo().OperatingSystemArchitecture().c_str()); // "arch" | 159 base::SysInfo().OperatingSystemArchitecture().c_str()); // "arch" |
159 if (!os_version.empty()) | 160 if (!os_version.empty()) |
160 base::StringAppendF(&request, " version=\"%s\"", os_version.c_str()); | 161 base::StringAppendF(&request, " version=\"%s\"", os_version.c_str()); |
161 if (!os_sp.empty()) | 162 if (!os_sp.empty()) |
162 base::StringAppendF(&request, " sp=\"%s\"", os_sp.c_str()); | 163 base::StringAppendF(&request, " sp=\"%s\"", os_sp.c_str()); |
163 base::StringAppendF(&request, "/>"); | 164 base::StringAppendF(&request, "/>"); |
164 | 165 |
165 #if defined(GOOGLE_CHROME_BUILD) | 166 #if defined(GOOGLE_CHROME_BUILD) |
166 // Updater state. | 167 // Updater state. |
167 if (updater_state_attributes) { | 168 if (updater_state_attributes) { |
168 base::StringAppendF(&request, "<updater"); | 169 base::StringAppendF(&request, "<updater"); |
169 for (const auto& attr : *updater_state_attributes) { | 170 for (const auto& attr : *updater_state_attributes) { |
170 if (attr.first != UpdaterState::kDomainJoined) { | 171 if (attr.first != UpdaterState::kIsEnterpriseManaged) { |
171 base::StringAppendF(&request, " %s=\"%s\"", attr.first.c_str(), | 172 base::StringAppendF(&request, " %s=\"%s\"", attr.first.c_str(), |
172 attr.second.c_str()); | 173 attr.second.c_str()); |
173 } | 174 } |
174 } | 175 } |
175 base::StringAppendF(&request, "/>"); | 176 base::StringAppendF(&request, "/>"); |
176 } | 177 } |
177 #endif // GOOGLE_CHROME_BUILD | 178 #endif // GOOGLE_CHROME_BUILD |
178 | 179 |
179 // The actual payload of the request. | 180 // The actual payload of the request. |
180 base::StringAppendF(&request, "%s</request>", request_body.c_str()); | 181 base::StringAppendF(&request, "%s</request>", request_body.c_str()); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), | 340 [](const GURL& url) { return !url.SchemeIsCryptographic(); }), |
340 urls->end()); | 341 urls->end()); |
341 } | 342 } |
342 | 343 |
343 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { | 344 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback) { |
344 return CrxInstaller::Result(callback.Run() ? InstallError::NONE | 345 return CrxInstaller::Result(callback.Run() ? InstallError::NONE |
345 : InstallError::GENERIC_ERROR); | 346 : InstallError::GENERIC_ERROR); |
346 } | 347 } |
347 | 348 |
348 } // namespace update_client | 349 } // namespace update_client |
OLD | NEW |