From 4541c432af76ff914f1d044a1bc91906fcd6e642 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Wed, 14 Sep 2022 10:50:20 +0900 Subject: [PATCH] fix: allow maximizing when window enters tablet mode with WCO (#35663) * fix: Backport CL 3753528 for WCO * Update comment * Update shell/browser/ui/views/win_caption_button_container.cc Co-authored-by: Robo Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com> Co-authored-by: Robo --- shell/browser/ui/views/win_caption_button_container.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shell/browser/ui/views/win_caption_button_container.cc b/shell/browser/ui/views/win_caption_button_container.cc index 92c0fca690cbd..99a7fc4bc057b 100644 --- a/shell/browser/ui/views/win_caption_button_container.cc +++ b/shell/browser/ui/views/win_caption_button_container.cc @@ -159,10 +159,11 @@ void WinCaptionButtonContainer::UpdateButtons() { const bool is_touch = ui::TouchUiController::Get()->touch_ui(); restore_button_->SetEnabled(!is_touch); - // The maximize button should only be enabled if the window is - // maximizable *and* touch mode is disabled. + // In touch mode, windows cannot be taken out of fullscreen or tiled mode, so + // the maximize/restore button should be disabled, unless the window is not + // maximized. const bool maximizable = frame_view_->window()->IsMaximizable(); - maximize_button_->SetEnabled(!is_touch && maximizable); + maximize_button_->SetEnabled(!(is_touch && is_maximized) && maximizable); const bool closable = frame_view_->window()->IsClosable(); close_button_->SetEnabled(closable);