Skip to content

Commit

Permalink
cros: Make auto-hide shelf use the same background as shown shelf.
Browse files Browse the repository at this point in the history
Bug: 1009706, 1006965
Change-Id: Ie7a4314e593adb2a991ff611063380a1b572a34c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1835219
Reviewed-by: Manu Cornet <manucornet@chromium.org>
Commit-Queue: Matthew Mourgos <mmourgos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702600}
  • Loading branch information
Matthew Mourgos authored and Commit Bot committed Oct 3, 2019
1 parent 4c3b762 commit e69d29d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ash/shelf/shelf_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const {
Shell::Get()->split_view_controller()->InSplitViewMode();
const bool maximized =
in_split_view_mode ||
(state_.visibility_state != SHELF_AUTO_HIDE &&
state_.window_state == WorkspaceWindowState::kMaximized &&
state_.window_state == WorkspaceWindowState::kFullscreen ||
(state_.window_state == WorkspaceWindowState::kMaximized &&
!Shell::Get()
->home_screen_controller()
->home_launcher_gesture_handler()
Expand Down
21 changes: 18 additions & 3 deletions ash/shelf/shelf_layout_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ TEST_P(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) {

UnlockScreen();
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());
EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType());
}

// Tests that the shelf should be visible when in overview mode.
Expand Down Expand Up @@ -2567,8 +2567,8 @@ TEST_P(ShelfLayoutManagerTest, TabletModeTransitionWithAppListVisible) {
EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType());
}

// Verify that the shelf doesn't have the opaque background if it's auto-hide
// status.
// Verify that the auto-hide shelf has default background by default and has
// maxmimized background when a window is maximized.
TEST_P(ShelfLayoutManagerTest, ShelfBackgroundColorAutoHide) {
EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());

Expand All @@ -2577,8 +2577,23 @@ TEST_P(ShelfLayoutManagerTest, ShelfBackgroundColorAutoHide) {
w1->Show();
wm::ActivateWindow(w1.get());
EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());

w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType());
}

// Verify that the shelf has a maximized background when a window is in the
// fullscreen state.
TEST_P(ShelfLayoutManagerTest, ShelfBackgroundColorFullscreen) {
EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());

std::unique_ptr<aura::Window> w1(CreateTestWindow());
w1->Show();
wm::ActivateWindow(w1.get());
EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());

w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType());
}

// Verify the hit bounds of the status area extend to the edge of the shelf.
Expand Down

0 comments on commit e69d29d

Please sign in to comment.