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