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