Commit 8677e6fb authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

shelf: Show shelf in overview even when auto hide is on.

Test: ash_unittests ShelfLayoutManagerTest.VisibleInOverview
Bug: 881153
Change-Id: I2b5b8122831b5c71bc4ee4fcf4360d7626e11f0b
Reviewed-on: https://chromium-review.googlesource.com/1211741
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589422}
parent 9f87a1ee
......@@ -272,6 +272,9 @@ void ShelfLayoutManager::UpdateVisibilityState() {
SetState(SHELF_VISIBLE);
} else if (Shell::Get()->screen_pinning_controller()->IsPinned()) {
SetState(SHELF_HIDDEN);
} else if (Shell::Get()->window_selector_controller() &&
Shell::Get()->window_selector_controller()->IsSelecting()) {
SetState(SHELF_VISIBLE);
} else {
// TODO(zelidrag): Verify shelf drag animation still shows on the device
// when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN.
......@@ -497,6 +500,16 @@ void ShelfLayoutManager::OnAppListVisibilityChanged(bool shown,
MaybeUpdateShelfBackground(AnimationChangeType::IMMEDIATE);
}
void ShelfLayoutManager::OnOverviewModeStarting() {
UpdateVisibilityState();
MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE);
}
void ShelfLayoutManager::OnOverviewModeEnded() {
UpdateVisibilityState();
MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE);
}
void ShelfLayoutManager::OnSplitViewModeStarted() {
MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE);
}
......@@ -559,6 +572,11 @@ ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const {
return SHELF_BACKGROUND_OVERLAP;
}
if (Shell::Get()->window_selector_controller() &&
Shell::Get()->window_selector_controller()->IsSelecting()) {
return SHELF_BACKGROUND_OVERLAP;
}
// If split view mode is active, make the shelf fully opapue.
if (Shell::Get()->IsSplitViewModeActive())
return SHELF_BACKGROUND_SPLIT_VIEW;
......
......@@ -155,6 +155,8 @@ class ASH_EXPORT ShelfLayoutManager
void OnPinnedStateChanged(aura::Window* pinned_window) override;
void OnAppListVisibilityChanged(bool shown,
aura::Window* root_window) override;
void OnOverviewModeStarting() override;
void OnOverviewModeEnded() override;
void OnSplitViewModeStarted() override;
void OnSplitViewModeEnded() override;
......
......@@ -35,6 +35,7 @@
#include "ash/wallpaper/wallpaper_controller.h"
#include "ash/window_factory.h"
#include "ash/wm/lock_state_controller.h"
#include "ash/wm/overview/window_selector_controller.h"
#include "ash/wm/splitview/split_view_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_state.h"
......@@ -1006,6 +1007,36 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) {
EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
}
// Tests that the shelf should be visible when in overview mode.
TEST_F(ShelfLayoutManagerTest, VisibleInOverview) {
std::unique_ptr<aura::Window> window(CreateTestWindow());
window->Show();
Shelf* shelf = GetPrimaryShelf();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
// LayoutShelf() forces the animation to completion, at which point the
// shelf should go off the screen.
GetShelfLayoutManager()->LayoutShelf();
display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
EXPECT_EQ(display.bounds().bottom() - kShelfAutoHideSize,
GetShelfWidget()->GetWindowBoundsInScreen().y());
WindowSelectorController* window_selector_controller =
Shell::Get()->window_selector_controller();
// Tests that the shelf is visible when in overview mode and its color is
// overlap.
window_selector_controller->ToggleOverview();
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
// Test that on exiting overview mode, the shelf returns to auto hide state.
window_selector_controller->ToggleOverview();
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
}
// Assertions around SetAutoHideBehavior.
TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
Shelf* shelf = GetPrimaryShelf();
......
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