[ozone] Added the --ozone-platform-hint flag.
To date, the only way to choose the Ozone platform is setting the
--ozone-platform command line switch. That is not really handy,
especially for desktop users who would like to use a non-default
platform daily, or for those who switches between X11 and Wayland
sessions.
This patch introduces the --ozone-platform-hint flag that suggests the
Ozone platform to use. A special "auto" value selects the Wayland
backend if the current session uses Wayland.
[1] https://chromium.googlesource.com/chromium/src/+/main/docs/configuration.md
Bug: 1246928
Change-Id: I602b27363cbdcc87b61b3335865502ea61b356d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3188974
Reviewed-by: Robert Kroeger <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Michael Spang <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Commit-Queue: Alexander Dunaev <[email protected]>
Cr-Commit-Position: refs/heads/main@{#932878}
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index c3e3596..c2e72c6 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -5335,6 +5335,18 @@
"platforms.";
#endif // defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_MAC)
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+const char kOzonePlatformHintChoiceDefault[] = "Default";
+const char kOzonePlatformHintChoiceAuto[] = "Auto";
+const char kOzonePlatformHintChoiceX11[] = "X11";
+const char kOzonePlatformHintChoiceWayland[] = "Wayland";
+
+const char kOzonePlatformHintName[] = "Preferred Ozone platform";
+const char kOzonePlatformHintDescription[] =
+ "Selects the preferred platform backend used on Linux. The default one is "
+ "\"X11\". \"Auto\" selects Wayland if possible, X11 otherwise. ";
+#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS)
+
// Feature flags --------------------------------------------------------------
#if defined(DCHECK_IS_CONFIGURABLE)