Commit 1d126b4a authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

browser: Fix caption buttons after drag from an overview grid to another

The present CL follows up after [1] which implements functionality where
you can drag an overview window from one display and drop into overview
on another display. The problem is that after you do so with a browser
window and then end overview, the caption buttons (Minimize, Maximize,
and Close) on that browser window may not work. I observe the problem on
a test device (nautilus) but not in the emulator.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2008237

Bug: 961170
Change-Id: I15f6bcec8116cbe853737682735865a77827d196
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2013866
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734699}
parent 2eceed3f
......@@ -600,19 +600,13 @@ void BrowserNonClientFrameViewAsh::OnProfileAvatarChanged(
// BrowserNonClientFrameViewAsh, private:
bool BrowserNonClientFrameViewAsh::ShouldShowCaptionButtons() const {
// In tablet mode, to prevent accidental taps of the window controls, and to
// give more horizontal space for tabs and the new tab button especially in
// splitscreen view, we hide the window controls. We only do this when the
// Home Launcher feature is enabled, since it gives the user the ability to
// minimize all windows when pressing the Launcher button on the shelf.
const bool hide_caption_buttons_in_tablet_mode =
!UsePackagedAppHeaderStyle(browser_view()->browser());
if (hide_caption_buttons_in_tablet_mode &&
ash::TabletMode::Get()->InTabletMode()) {
return false;
}
return ShouldShowCaptionButtonsWhenNotInOverview() && !IsInOverviewMode();
}
return !IsInOverviewMode();
bool BrowserNonClientFrameViewAsh::ShouldShowCaptionButtonsWhenNotInOverview()
const {
return UsePackagedAppHeaderStyle(browser_view()->browser()) ||
!ash::TabletMode::Get()->InTabletMode();
}
int BrowserNonClientFrameViewAsh::GetToolbarLeftInset() const {
......@@ -632,7 +626,7 @@ int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const {
int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const {
int inset = 0;
if (ShouldShowCaptionButtons())
if (ShouldShowCaptionButtonsWhenNotInOverview())
inset += caption_button_container_->GetPreferredSize().width();
if (web_app_frame_toolbar())
inset += web_app_frame_toolbar()->GetPreferredSize().width();
......
......@@ -152,10 +152,19 @@ class BrowserNonClientFrameViewAsh
friend class WebAppNonClientFrameViewAshTest;
// Returns whether the caption buttons should be visible. They are hidden, for
// example, in overview mode and tablet mode.
// Returns true if |ShouldShowCaptionButtonsWhenNotInOverview| returns true
// and this browser window is not showing in overview.
bool ShouldShowCaptionButtons() const;
// In tablet mode, to prevent accidental taps of the window controls, and to
// give more horizontal space for tabs and the new tab button (especially in
// split view), we hide the window controls even when this browser window is
// not showing in overview. We only do this when the Home Launcher feature is
// enabled, because it gives the user the ability to minimize all windows when
// pressing the Launcher button on the shelf. So, this function returns true
// if the Home Launcher feature is disabled or we are in clamshell mode.
bool ShouldShowCaptionButtonsWhenNotInOverview() const;
// Distance between the edge of the NonClientFrameView and the web app frame
// toolbar.
int GetToolbarLeftInset() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment