Skip to content

Commit

Permalink
refactor: extract CreateGlobalMenuBar into separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
p2004a committed Mar 22, 2022
1 parent f5ef77c commit 46f3b94
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions shell/browser/native_window_views.cc
Expand Up @@ -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,
Expand Down Expand Up @@ -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<GlobalMenuBarX11>(this);
if (global_menu_bar_->IsServerStarted()) {
Expand Down

0 comments on commit 46f3b94

Please sign in to comment.