Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: components/update_client/utils.cc

Issue 2365523004: Component updater: report the Windows OS and Service Pack separately. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/win/windows_version.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/utils.cc
diff --git a/components/update_client/utils.cc b/components/update_client/utils.cc
index 2eaed3bdf473698859e231c44e1dba44b07bd7f3..39ab431a7b5e4488512913777b2385f97f17a940 100644
--- a/components/update_client/utils.cc
+++ b/components/update_client/utils.cc
@@ -66,6 +66,26 @@ std::string HexStringToID(const std::string& hexstr) {
return id;
}
+std::string GetOSVersion() {
+#if defined(OS_WIN)
+ int32_t major = 0;
+ int32_t minor = 0;
+ int32_t bugfix = 0;
+ base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
+ return base::StringPrintf("%d.%d.%d", major, minor, bugfix);
+#else
+ return base::SysInfo().OperatingSystemVersion();
+#endif
+}
+
+std::string GetServicePack() {
+#if defined(OS_WIN)
+ return base::win::OSInfo::GetInstance()->service_pack_str();
+#else
+ return std::string();
+#endif
+}
+
} // namespace
std::string BuildProtocolRequest(const std::string& prod_id,
@@ -115,11 +135,18 @@ std::string BuildProtocolRequest(const std::string& prod_id,
GetPhysicalMemoryGB()); // "physmem" in GB.
// OS version and platform information.
+ const std::string os_version = GetOSVersion();
+ const std::string os_sp = GetServicePack();
+
base::StringAppendF(
- &request, "<os platform=\"%s\" version=\"%s\" arch=\"%s\"/>",
+ &request, "<os platform=\"%s\" arch=\"%s\"",
os_long_name.c_str(), // "platform"
- base::SysInfo().OperatingSystemVersion().c_str(), // "version"
base::SysInfo().OperatingSystemArchitecture().c_str()); // "arch"
+ if (!os_version.empty())
+ base::StringAppendF(&request, " version=\"%s\"", os_version.c_str());
+ if (!os_sp.empty())
+ base::StringAppendF(&request, " sp=\"%s\"", os_sp.c_str());
+ base::StringAppendF(&request, "/>");
// The actual payload of the request.
base::StringAppendF(&request, "%s</request>", request_body.c_str());
« no previous file with comments | « base/win/windows_version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698