refactor: replace USE_X11 with OS_LINUX for sharing code with Ozone (#25522)

This commit is contained in:
Valentin Hăloiu 2020-09-21 02:11:59 +02:00 committed by GitHub
parent 137fc65e2f
commit efd003d277
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 18 deletions

View file

@ -15,7 +15,7 @@
#include "shell/browser/window_list.h" #include "shell/browser/window_list.h"
#include "shell/common/application_info.h" #include "shell/common/application_info.h"
#if defined(USE_X11) #if defined(OS_LINUX)
#include "shell/browser/linux/unity_service.h" #include "shell/browser/linux/unity_service.h"
#include "ui/gtk/gtk_util.h" #include "ui/gtk/gtk_util.h"
#endif #endif

View file

@ -130,7 +130,7 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate,
#if defined(TOOLKIT_VIEWS) && !defined(OS_MAC) #if defined(TOOLKIT_VIEWS) && !defined(OS_MAC)
gfx::ImageSkia GetDevToolsWindowIcon() override; gfx::ImageSkia GetDevToolsWindowIcon() override;
#endif #endif
#if defined(USE_X11) #if defined(OS_LINUX)
void GetDevToolsWindowWMClass(std::string* name, void GetDevToolsWindowWMClass(std::string* name,
std::string* class_name) override; std::string* class_name) override;
#endif #endif

View file

@ -11,7 +11,7 @@
#include "shell/browser/web_contents_preferences.h" #include "shell/browser/web_contents_preferences.h"
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"
#if defined(USE_X11) #if defined(OS_LINUX)
#include "shell/browser/browser.h" #include "shell/browser/browser.h"
#endif #endif
@ -49,7 +49,7 @@ gfx::ImageSkia CommonWebContentsDelegate::GetDevToolsWindowIcon() {
->GetWindowAppIcon(); ->GetWindowAppIcon();
} }
#if defined(USE_X11) #if defined(OS_LINUX)
void CommonWebContentsDelegate::GetDevToolsWindowWMClass( void CommonWebContentsDelegate::GetDevToolsWindowWMClass(
std::string* name, std::string* name,
std::string* class_name) { std::string* class_name) {

View file

@ -229,7 +229,7 @@ void UpdateDarkThemeSetting() {
} // namespace } // namespace
#if defined(USE_X11) #if defined(OS_LINUX)
class DarkThemeObserver : public ui::NativeThemeObserver { class DarkThemeObserver : public ui::NativeThemeObserver {
public: public:
DarkThemeObserver() = default; DarkThemeObserver() = default;
@ -350,7 +350,7 @@ int ElectronBrowserMainParts::PreCreateThreads() {
#if defined(USE_AURA) #if defined(USE_AURA)
display::Screen* screen = views::CreateDesktopScreen(); display::Screen* screen = views::CreateDesktopScreen();
display::Screen::SetScreenInstance(screen); display::Screen::SetScreenInstance(screen);
#if defined(USE_X11) #if defined(OS_LINUX)
views::LinuxUI::instance()->UpdateDeviceScaleFactor(); views::LinuxUI::instance()->UpdateDeviceScaleFactor();
#endif #endif
#endif #endif

View file

@ -29,7 +29,7 @@ class WMState;
} }
#endif #endif
#if defined(USE_X11) #if defined(OS_LINUX)
namespace ui { namespace ui {
class GtkUiDelegate; class GtkUiDelegate;
} }
@ -59,7 +59,7 @@ class ViewsDelegate;
class ViewsDelegateMac; class ViewsDelegateMac;
#endif #endif
#if defined(USE_X11) #if defined(OS_LINUX)
class DarkThemeObserver; class DarkThemeObserver;
#endif #endif

View file

@ -192,7 +192,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
params.parent = parent->GetNativeWindow(); params.parent = parent->GetNativeWindow();
params.native_widget = new ElectronDesktopNativeWidgetAura(this); params.native_widget = new ElectronDesktopNativeWidgetAura(this);
#elif defined(USE_X11) #elif defined(OS_LINUX)
std::string name = Browser::Get()->GetName(); std::string name = Browser::Get()->GetName();
// Set WM_WINDOW_ROLE. // Set WM_WINDOW_ROLE.
params.wm_role_name = "browser-window"; params.wm_role_name = "browser-window";
@ -482,7 +482,7 @@ void NativeWindowViews::SetEnabledInternal(bool enable) {
#endif #endif
} }
#if defined(USE_X11) #if defined(OS_LINUX)
void NativeWindowViews::Maximize() { void NativeWindowViews::Maximize() {
if (IsVisible()) if (IsVisible())
widget()->Maximize(); widget()->Maximize();
@ -798,7 +798,7 @@ bool NativeWindowViews::IsClosable() {
return false; return false;
} }
return !(info.fState & MFS_DISABLED); return !(info.fState & MFS_DISABLED);
#elif defined(USE_X11) #elif defined(OS_LINUX)
return true; return true;
#endif #endif
} }
@ -1138,7 +1138,7 @@ void NativeWindowViews::SetProgressBar(double progress,
NativeWindow::ProgressState state) { NativeWindow::ProgressState state) {
#if defined(OS_WIN) #if defined(OS_WIN)
taskbar_host_.SetProgressBar(GetAcceleratedWidget(), progress, state); taskbar_host_.SetProgressBar(GetAcceleratedWidget(), progress, state);
#elif defined(USE_X11) #elif defined(OS_LINUX)
if (unity::IsRunning()) { if (unity::IsRunning()) {
unity::SetProgressFraction(progress); unity::SetProgressFraction(progress);
} }
@ -1194,7 +1194,7 @@ content::DesktopMediaID NativeWindowViews::GetDesktopMediaID() const {
#if defined(OS_WIN) #if defined(OS_WIN)
window_handle = window_handle =
reinterpret_cast<content::DesktopMediaID::Id>(accelerated_widget); reinterpret_cast<content::DesktopMediaID::Id>(accelerated_widget);
#elif defined(USE_X11) #elif defined(OS_LINUX)
window_handle = static_cast<uint32_t>(accelerated_widget); window_handle = static_cast<uint32_t>(accelerated_widget);
#endif #endif
aura::WindowTreeHost* const host = aura::WindowTreeHost* const host =
@ -1297,7 +1297,7 @@ void NativeWindowViews::SetIcon(HICON window_icon, HICON app_icon) {
SendMessage(hwnd, WM_SETICON, ICON_BIG, SendMessage(hwnd, WM_SETICON, ICON_BIG,
reinterpret_cast<LPARAM>(app_icon_.get())); reinterpret_cast<LPARAM>(app_icon_.get()));
} }
#elif defined(USE_X11) #elif defined(OS_LINUX)
void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) { void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) {
auto* tree_host = views::DesktopWindowTreeHostLinux::GetHostForWidget( auto* tree_host = views::DesktopWindowTreeHostLinux::GetHostForWidget(
GetAcceleratedWidget()); GetAcceleratedWidget());
@ -1382,7 +1382,7 @@ bool NativeWindowViews::CanMaximize() const {
bool NativeWindowViews::CanMinimize() const { bool NativeWindowViews::CanMinimize() const {
#if defined(OS_WIN) #if defined(OS_WIN)
return minimizable_; return minimizable_;
#elif defined(USE_X11) #elif defined(OS_LINUX)
return true; return true;
#endif #endif
} }

View file

@ -154,7 +154,7 @@ class NativeWindowViews : public NativeWindow,
LPARAM l_param, LPARAM l_param,
LRESULT* result); LRESULT* result);
void SetIcon(HICON small_icon, HICON app_icon); void SetIcon(HICON small_icon, HICON app_icon);
#elif defined(USE_X11) #elif defined(OS_LINUX)
void SetIcon(const gfx::ImageSkia& icon); void SetIcon(const gfx::ImageSkia& icon);
#endif #endif

View file

@ -23,7 +23,7 @@ class InspectableWebContentsViewDelegate {
// Returns the icon of devtools window. // Returns the icon of devtools window.
virtual gfx::ImageSkia GetDevToolsWindowIcon(); virtual gfx::ImageSkia GetDevToolsWindowIcon();
#if defined(USE_X11) #if defined(OS_LINUX)
// Called when creating devtools window. // Called when creating devtools window.
virtual void GetDevToolsWindowWMClass(std::string* name, virtual void GetDevToolsWindowWMClass(std::string* name,
std::string* class_name) {} std::string* class_name) {}

View file

@ -186,7 +186,7 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked, bool activate) {
params.delegate = devtools_window_delegate_; params.delegate = devtools_window_delegate_;
params.bounds = inspectable_web_contents()->GetDevToolsBounds(); params.bounds = inspectable_web_contents()->GetDevToolsBounds();
#if defined(USE_X11) #if defined(OS_LINUX)
params.wm_role_name = "devtools"; params.wm_role_name = "devtools";
if (GetDelegate()) if (GetDelegate())
GetDelegate()->GetDevToolsWindowWMClass(&params.wm_class_name, GetDelegate()->GetDevToolsWindowWMClass(&params.wm_class_name,