Commit 383ba7fc authored by Eliot Courtney's avatar Eliot Courtney Committed by Commit Bot

Do not show the auto-hide shelf if there is a single PIP window.

Bug: 942991
Test: unit test
Change-Id: Id1956d3fe239c0740770274a95ba9119f6fe2bc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1529500Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642375}
parent 15329dc3
......@@ -1122,7 +1122,10 @@ bool ShelfLayoutManager::HasVisibleWindow() const {
return true;
}
}
return false;
auto* pip_container = Shell::GetContainer(root, kShellWindowId_PipContainer);
// The PIP window is not activatable and is not in the MRU list, but count
// it as a visible window for shelf auto-hide purposes. See crbug.com/942991.
return !pip_container->children().empty();
}
ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
......
......@@ -2763,6 +2763,28 @@ TEST_F(ShelfLayoutManagerTest, A11yAlertOnWorkspaceState) {
client.last_a11y_alert());
}
// Verifies the auto-hide shelf is hidden if there is only a single PIP window.
TEST_F(ShelfLayoutManagerTest, AutoHideShelfHiddenForSinglePipWindow) {
Shelf* shelf = GetPrimaryShelf();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
// Create a PIP window.
aura::Window* window = CreateTestWindow();
window->SetBounds(gfx::Rect(0, 0, 100, 100));
// Set always on top so it is put in the PIP container.
window->SetProperty(aura::client::kAlwaysOnTopKey, true);
window->Show();
const wm::WMEvent pip_event(wm::WM_EVENT_PIP);
wm::GetWindowState(window)->OnWMEvent(&pip_event);
Shell::Get()->UpdateShelfVisibility();
// Expect the shelf to be hidden.
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
}
class ShelfLayoutManagerKeyboardTest : public AshTestBase {
public:
ShelfLayoutManagerKeyboardTest() = default;
......
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