diff --git a/shell/browser/ui/views/win_caption_button_container.cc b/shell/browser/ui/views/win_caption_button_container.cc index 92c0fca690cbd..831069b9b4e40 100644 --- a/shell/browser/ui/views/win_caption_button_container.cc +++ b/shell/browser/ui/views/win_caption_button_container.cc @@ -148,11 +148,12 @@ void WinCaptionButtonContainer::OnWidgetBoundsChanged( void WinCaptionButtonContainer::UpdateButtons() { const bool is_maximized = frame_view_->frame()->IsMaximized(); - restore_button_->SetVisible(is_maximized); - maximize_button_->SetVisible(!is_maximized); + const bool maximizable = frame_view_->window()->IsMaximizable(); + restore_button_->SetVisible(is_maximized && maximizable); + maximize_button_->SetVisible(!is_maximized && maximizable); const bool minimizable = frame_view_->window()->IsMinimizable(); - minimize_button_->SetEnabled(minimizable); + minimize_button_->SetVisible(minimizable); // In touch mode, windows cannot be taken out of fullscreen or tiled mode, so // the maximize/restore button should be disabled. @@ -161,20 +162,11 @@ void WinCaptionButtonContainer::UpdateButtons() { // The maximize button should only be enabled if the window is // maximizable *and* touch mode is disabled. - const bool maximizable = frame_view_->window()->IsMaximizable(); - maximize_button_->SetEnabled(!is_touch && maximizable); + maximize_button_->SetEnabled(!is_touch || !is_maximized); const bool closable = frame_view_->window()->IsClosable(); close_button_->SetEnabled(closable); - // If all three of closable, maximizable, and minimizable are disabled, - // Windows natively only shows the disabled closable button. Copy that - // behavior here. - if (!maximizable && !closable && !minimizable) { - minimize_button_->SetVisible(false); - maximize_button_->SetVisible(false); - } - InvalidateLayout(); } } // namespace electron