Commit 4a0a39d0 authored by Nikolai Artemiev's avatar Nikolai Artemiev Committed by Chromium LUCI CQ

Add --form-factor override flag to Chrome

Allows the --form-factor flag to be used to override the form factor
value from the LSB release info.

BUG=b:173179861
TEST=CQ

Change-Id: Ic4dd3eb52dd562d35debac3fea168f686d728e5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2631393
Commit-Queue: Nikolai Artemiev <nartemiev@google.com>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Auto-Submit: Nikolai Artemiev <nartemiev@google.com>
Cr-Commit-Position: refs/heads/master@{#845539}
parent 6fb4902b
...@@ -208,6 +208,7 @@ void DeriveCommandLine(const GURL& start_url, ...@@ -208,6 +208,7 @@ void DeriveCommandLine(const GURL& start_url,
chromeos::switches::kEnableArc, chromeos::switches::kEnableArc,
chromeos::switches::kEnterpriseDisableArc, chromeos::switches::kEnterpriseDisableArc,
chromeos::switches::kEnterpriseEnableForcedReEnrollment, chromeos::switches::kEnterpriseEnableForcedReEnrollment,
chromeos::switches::kFormFactor,
chromeos::switches::kHasChromeOSKeyboard, chromeos::switches::kHasChromeOSKeyboard,
chromeos::switches::kLoginProfile, chromeos::switches::kLoginProfile,
chromeos::switches::kNaturalScrollDefault, chromeos::switches::kNaturalScrollDefault,
......
...@@ -344,6 +344,11 @@ const char kFakeArcRecommendedAppsForTesting[] = ...@@ -344,6 +344,11 @@ const char kFakeArcRecommendedAppsForTesting[] =
// "keyboard-bottom-left", keyboard-bottom-right", "keyboard-top-right". // "keyboard-bottom-left", keyboard-bottom-right", "keyboard-top-right".
const char kFingerprintSensorLocation[] = "fingerprint-sensor-location"; const char kFingerprintSensorLocation[] = "fingerprint-sensor-location";
// Specifies the device's form factor. If provided, this flag overrides the
// value from the LSB release info. Possible values are: "CHROMEBASE",
// "CHROMEBIT", "CHROMEBOOK", "REFERENCE", "CHROMEBOX"
const char kFormFactor[] = "form-factor";
// Passed to Chrome the first time that it's run after the system boots. // Passed to Chrome the first time that it's run after the system boots.
// Not passed on restart after sign out. // Not passed on restart after sign out.
const char kFirstExecAfterBoot[] = "first-exec-after-boot"; const char kFirstExecAfterBoot[] = "first-exec-after-boot";
......
...@@ -151,6 +151,8 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) ...@@ -151,6 +151,8 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const char kForceLoginManagerInTests[]; extern const char kForceLoginManagerInTests[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const char kForceSystemCompositorMode[]; extern const char kForceSystemCompositorMode[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const char kFormFactor[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGuestSession[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGuestSession[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGuestWallpaperLarge[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGuestWallpaperLarge[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGuestWallpaperSmall[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGuestWallpaperSmall[];
......
...@@ -6,9 +6,11 @@ ...@@ -6,9 +6,11 @@
#include <string> #include <string>
#include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/system/sys_info.h" #include "base/system/sys_info.h"
#include "chromeos/constants/chromeos_switches.h"
namespace chromeos { namespace chromeos {
...@@ -18,20 +20,24 @@ const char kDeviceTypeKey[] = "DEVICETYPE"; ...@@ -18,20 +20,24 @@ const char kDeviceTypeKey[] = "DEVICETYPE";
DeviceType GetDeviceType() { DeviceType GetDeviceType() {
std::string value; std::string value;
if (base::SysInfo::GetLsbReleaseValue(kDeviceTypeKey, &value)) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (value == "CHROMEBASE") if (command_line->HasSwitch(switches::kFormFactor)) {
return DeviceType::kChromebase; value = command_line->GetSwitchValueASCII(switches::kFormFactor);
if (value == "CHROMEBIT") } else if (!base::SysInfo::GetLsbReleaseValue(kDeviceTypeKey, &value)) {
return DeviceType::kChromebit; return DeviceType::kUnknown;
// Most devices are Chromebooks, so we will also consider reference boards
// as chromebooks.
if (value == "CHROMEBOOK" || value == "REFERENCE")
return DeviceType::kChromebook;
if (value == "CHROMEBOX")
return DeviceType::kChromebox;
LOG(ERROR) << "Unknown device type \"" << value << "\"";
} }
if (value == "CHROMEBASE")
return DeviceType::kChromebase;
if (value == "CHROMEBIT")
return DeviceType::kChromebit;
// Most devices are Chromebooks, so we will also consider reference boards
// as chromebooks.
if (value == "CHROMEBOOK" || value == "REFERENCE")
return DeviceType::kChromebook;
if (value == "CHROMEBOX")
return DeviceType::kChromebox;
LOG(ERROR) << "Unknown device type \"" << value << "\"";
return DeviceType::kUnknown; return DeviceType::kUnknown;
} }
......
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