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