summaryrefslogtreecommitdiffstats
path: root/chromecast
diff options
context:
space:
mode:
authorgunsch <gunsch@chromium.org>2015-04-21 15:01:06 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-21 22:01:10 +0000
commit45d0df260fc8254c7743bcbcab92eec17b57fb92 (patch)
tree0d7ce123c3f7111943d7890ccec76a2bd7b065cc /chromecast
parentcdd5a3de49c48a2ddaab69ff23e8542dd8deabec (diff)
downloadchromium_src-45d0df260fc8254c7743bcbcab92eec17b57fb92.zip
chromium_src-45d0df260fc8254c7743bcbcab92eec17b57fb92.tar.gz
chromium_src-45d0df260fc8254c7743bcbcab92eec17b57fb92.tar.bz2
Chromecast: removes ATV product information from UA string.
R=lcwu@chromium.org,byungchu@chromium.org BUG=internal b/20398673 Review URL: https://codereview.chromium.org/1067593007 Cr-Commit-Position: refs/heads/master@{#326139}
Diffstat (limited to 'chromecast')
-rw-r--r--chromecast/common/cast_content_client.cc51
1 files changed, 50 insertions, 1 deletions
diff --git a/chromecast/common/cast_content_client.cc b/chromecast/common/cast_content_client.cc
index e93b7d2..4772fdd 100644
--- a/chromecast/common/cast_content_client.cc
+++ b/chromecast/common/cast_content_client.cc
@@ -4,6 +4,8 @@
#include "chromecast/common/cast_content_client.h"
+#include "base/strings/stringprintf.h"
+#include "base/sys_info.h"
#include "chromecast/common/version.h"
#include "content/public/common/user_agent.h"
#include "ui/base/l10n/l10n_util.h"
@@ -12,9 +14,56 @@
namespace chromecast {
namespace shell {
+namespace {
+
+#if defined(OS_ANDROID)
+std::string BuildAndroidOsInfo() {
+ int32 os_major_version = 0;
+ int32 os_minor_version = 0;
+ int32 os_bugfix_version = 0;
+ base::SysInfo::OperatingSystemVersionNumbers(&os_major_version,
+ &os_minor_version,
+ &os_bugfix_version);
+
+ std::string android_version_str;
+ base::StringAppendF(
+ &android_version_str, "%d.%d", os_major_version, os_minor_version);
+ if (os_bugfix_version != 0)
+ base::StringAppendF(&android_version_str, ".%d", os_bugfix_version);
+
+ std::string android_info_str;
+ // Append the build ID.
+ std::string android_build_id = base::SysInfo::GetAndroidBuildID();
+ if (android_build_id.size() > 0)
+ android_info_str += "; Build/" + android_build_id;
+
+ std::string os_info;
+ base::StringAppendF(
+ &os_info,
+ "Android %s%s",
+ android_version_str.c_str(),
+ android_info_str.c_str());
+ return os_info;
+}
+#endif
+
+} // namespace
+
std::string GetUserAgent() {
std::string product = "Chrome/" PRODUCT_VERSION;
- return content::BuildUserAgentFromProduct(product) +
+ std::string os_info;
+ base::StringAppendF(
+ &os_info,
+ "%s%s",
+#if defined(OS_ANDROID)
+ "Linux; ",
+ BuildAndroidOsInfo().c_str()
+#else
+ "X11; ",
+ content::BuildOSCpuInfo().c_str()
+#endif
+ );
+ return content::BuildUserAgentFromOSAndProduct(os_info, product) +
" CrKey/" CAST_BUILD_REVISION;
}