Rework LinuxUi ownership and creation
- LinuxUi instances are now owned by linux_ui_factory.cc. This is
in preparation for having multiple LinuxUis (GTK+QT) that are
switchable at runtime.
- LinuxUi instances are per ui::SystemTheme now. This is required
because different profiles may have different theme preferences.
For now, a separate accessor is added:
GetLinuxUi(SystemTheme system_theme). In a future CL, this will
be made safer by separating out the LinuxUi interface into
LinuxUi and LinuxUiTheme.
R=sky
Bug: 1317782
Change-Id: I324300dbfa8e0649b37b1024db310dfd3ac5018c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3854614
Reviewed-by: Nasko Oskov <[email protected]>
Commit-Queue: Nasko Oskov <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Auto-Submit: Thomas Anderson <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1041102}
diff --git a/ui/linux/linux_ui_factory.h b/ui/linux/linux_ui_factory.h
index 72f665e..bc9b81da 100644
--- a/ui/linux/linux_ui_factory.h
+++ b/ui/linux/linux_ui_factory.h
@@ -5,15 +5,23 @@
#ifndef UI_LINUX_LINUX_UI_FACTORY_H_
#define UI_LINUX_LINUX_UI_FACTORY_H_
-#include <memory>
+#include "base/component_export.h"
namespace ui {
class LinuxUi;
+enum class SystemTheme : int;
-// Returns a new LinuxUI based on a Linux toolkit. May return nullptr if the
-// preferred toolkits are unavailable.
-std::unique_ptr<LinuxUi> CreateLinuxUi();
+// Returns a LinuxUi for the default toolkit. May create a LinuxUi instance if
+// one does not exist. May return nullptr if no toolkits are available.
+COMPONENT_EXPORT(LINUX_UI_FACTORY)
+LinuxUi* GetDefaultLinuxUi();
+
+COMPONENT_EXPORT(LINUX_UI_FACTORY)
+LinuxUi* GetLinuxUi(SystemTheme system_theme);
+
+COMPONENT_EXPORT(LINUX_UI_FACTORY)
+SystemTheme GetDefaultSystemTheme();
} // namespace ui