[go: nahoru, domu]

[Chromecast]Replace "device capability user agent string"

Replace it with "device type"

Merge-With: eureka-internal/635962, eureka-internal/635943
eureka-internal/635982
See eureka-internal/635962, eureka-internal/635943,
eureka-internal/635982
Bug: b/192098277

Change-Id: I1faeebf2648f3a338a817516001be225b7a48c2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3075903
Reviewed-by: Yuchen Liu <yucliu@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Commit-Queue: Guohui Deng <guohuideng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#909125}
diff --git a/chromecast/chromecast.gni b/chromecast/chromecast.gni
index 377080c..7695d3a 100644
--- a/chromecast/chromecast.gni
+++ b/chromecast/chromecast.gni
@@ -133,8 +133,8 @@
   # True to link in alternate build targets for the Cast Media Runtime.
   enable_cast_media_runtime = false
 
-  # Indicating whether the device has display, touch screen, etc.
-  device_capabilities = ""
+  # device specific string to append to User string.
+  device_user_agent_suffix = ""
 }
 
 declare_args() {
diff --git a/chromecast/common/BUILD.gn b/chromecast/common/BUILD.gn
index 9097932..3e107cf8 100644
--- a/chromecast/common/BUILD.gn
+++ b/chromecast/common/BUILD.gn
@@ -138,5 +138,5 @@
     deps += [ "//media/cdm:cdm_paths" ]  # Needed by cast_content_client.cc
   }
 
-  defines = [ "DEVICE_CAPABILITIES=\"${device_capabilities}\"" ]
+  defines = [ "DEVICE_USER_AGENT_SUFFIX=\"${device_user_agent_suffix}\"" ]
 }
diff --git a/chromecast/common/cast_content_client.cc b/chromecast/common/cast_content_client.cc
index 9edd377..8b693d9a 100644
--- a/chromecast/common/cast_content_client.cc
+++ b/chromecast/common/cast_content_client.cc
@@ -157,15 +157,14 @@
 #endif  // BUILDFLAG(BUNDLE_WIDEVINE_CDM) && defined(OS_LINUX)
 
 std::string GetControlKey() {
-  std::string control_key = base::StrCat({" CrKey/", kFrozenCrKeyValue});
-  std::string device_capabilities(DEVICE_CAPABILITIES);
-  if (!device_capabilities.empty()) {
-    device_capabilities = base::StrCat({" (", device_capabilities, ")"});
-    control_key = base::StrCat({control_key, device_capabilities});
-  }
+  std::string control_key = base::StrCat({"CrKey/", kFrozenCrKeyValue});
   return control_key;
 }
 
+std::string GetDeviceUserAgentSuffix() {
+  return std::string(DEVICE_USER_AGENT_SUFFIX);
+}
+
 }  // namespace
 
 std::string GetUserAgent() {
@@ -186,8 +185,9 @@
           .c_str()
 #endif
       );
-  return content::BuildUserAgentFromOSAndProduct(os_info, product) +
-         GetControlKey();
+  return base::StrCat(
+      {content::BuildUserAgentFromOSAndProduct(os_info, product), " ",
+       GetControlKey(), " ", GetDeviceUserAgentSuffix()});
 }
 
 CastContentClient::~CastContentClient() {