From 46f3b94a3c62720a75028aa86a6726aa19fc99e3 Mon Sep 17 00:00:00 2001 From: Marek Rusinowski Date: Tue, 22 Mar 2022 21:21:23 +0100 Subject: [PATCH] refactor: extract CreateGlobalMenuBar into separate function --- shell/browser/native_window_views.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 61e09e409ede9..ea1b0641ca864 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -127,6 +127,16 @@ gfx::Rect DIPToScreenRect(HWND hwnd, const gfx::Rect& pixel_bounds) { #endif +#if defined(USE_OZONE) + +bool CreateGlobalMenuBar() { + return ui::OzonePlatform::GetInstance() + ->GetPlatformProperties() + .supports_global_application_menus; +} + +#endif + class NativeWindowClientView : public views::ClientView { public: NativeWindowClientView(views::Widget* widget, @@ -1187,10 +1197,7 @@ void NativeWindowViews::SetMenu(ElectronMenuModel* menu_model) { } // Use global application menu bar when possible. - if (ui::OzonePlatform::GetInstance() - ->GetPlatformProperties() - .supports_global_application_menus && - ShouldUseGlobalMenuBar()) { + if (CreateGlobalMenuBar() && ShouldUseGlobalMenuBar()) { if (!global_menu_bar_) global_menu_bar_ = std::make_unique(this); if (global_menu_bar_->IsServerStarted()) {