Commit 3d77d782 authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

lacros: Temporarily revert back to Linux user-agent.

The transition to Lacros is intended to be transparent to websites. As
such, Lacros needs to set the ChromeOS user-agent. However, in some
contexts (e.g. chrome://settings) Lacros must behave like the Linux
browser. The problem is that webUI makes the assumption that user-agent
uniquely identifies platform, and that there is only one browser per
platform. Thus, setting the ChromeOS user-agent triggers ChromeOS
settings behavior, which uses ChromeOS-only private extension APIs,
which crashes the renderer.

The appropriate long-term fix to this is to correctly plumb additional
information into WebUI so that it can distinguish between Linux,
ChromeOS and Lacros browsers. This is currently not possible without
refactoring a substantial number of tests. This CL is a stopgap measure
to allow chrome://settings to be usable in Lacros.

Bug: 1096590, 1111985
Change-Id: Iabb8691e37ba6db4baba680e3d624248e8647321
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2367473Reviewed-by: default avatarDarin Fisher <darin@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800292}
parent 76b01ae8
...@@ -123,8 +123,8 @@ std::string GetLowEntropyCpuArchitecture() { ...@@ -123,8 +123,8 @@ std::string GetLowEntropyCpuArchitecture() {
std::string GetOSVersion(IncludeAndroidBuildNumber include_android_build_number, std::string GetOSVersion(IncludeAndroidBuildNumber include_android_build_number,
IncludeAndroidModel include_android_model) { IncludeAndroidModel include_android_model) {
std::string os_version; std::string os_version;
#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_CHROMEOS) || \ #if defined(OS_WIN) || defined(OS_MAC) || \
BUILDFLAG(IS_LACROS) (defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS))
int32_t os_major_version = 0; int32_t os_major_version = 0;
int32_t os_minor_version = 0; int32_t os_minor_version = 0;
int32_t os_bugfix_version = 0; int32_t os_bugfix_version = 0;
...@@ -144,7 +144,7 @@ std::string GetOSVersion(IncludeAndroidBuildNumber include_android_build_number, ...@@ -144,7 +144,7 @@ std::string GetOSVersion(IncludeAndroidBuildNumber include_android_build_number,
#elif defined(OS_MAC) #elif defined(OS_MAC)
"%d_%d_%d", os_major_version, os_minor_version, "%d_%d_%d", os_major_version, os_minor_version,
os_bugfix_version os_bugfix_version
#elif defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS) #elif defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS)
"%d.%d.%d", os_major_version, os_minor_version, "%d.%d.%d", os_major_version, os_minor_version,
os_bugfix_version os_bugfix_version
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
...@@ -185,7 +185,7 @@ std::string BuildOSCpuInfoFromOSVersionAndCpuType(const std::string& os_version, ...@@ -185,7 +185,7 @@ std::string BuildOSCpuInfoFromOSVersionAndCpuType(const std::string& os_version,
base::StringAppendF(&os_cpu, base::StringAppendF(&os_cpu,
#if defined(OS_MAC) #if defined(OS_MAC)
"%s Mac OS X %s", cpu_type.c_str(), os_version.c_str() "%s Mac OS X %s", cpu_type.c_str(), os_version.c_str()
#elif defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS) #elif defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS)
"CrOS " "CrOS "
"%s %s", "%s %s",
cpu_type.c_str(), // e.g. i686 cpu_type.c_str(), // e.g. i686
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment