Commit fa0e1405 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Do not change the workspace when entering/leaving overview

* This also fixes the IsSelecting so that it returns false
during shutdown.

BUG=834400
TEST=Covered by unit test

Change-Id: Iac0cb8a3bdf03609727c31c51000c52ececfc66a
Reviewed-on: https://chromium-review.googlesource.com/1140749
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576078}
parent 457457cd
......@@ -28,6 +28,7 @@
#include "ash/system/status_area_widget.h"
#include "ash/wm/fullscreen_window_finder.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_selector_controller.h"
#include "ash/wm/screen_pinning_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_state.h"
......@@ -673,7 +674,9 @@ void ShelfLayoutManager::UpdateBoundsAndOpacity(
const display::Display display =
display::Screen::GetScreen()->GetDisplayNearestWindow(
shelf_widget_->GetNativeWindow());
if (!state_.IsScreenLocked() && change_work_area &&
bool in_overview =
Shell::Get()->window_selector_controller()->IsSelecting();
if (!in_overview && !state_.IsScreenLocked() && change_work_area &&
(shelf_->alignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED ||
display.work_area() == display.bounds())) {
gfx::Insets insets;
......
......@@ -410,10 +410,10 @@ void WindowSelectorController::OnSelectionEnded() {
overview_blur_controller_->Unblur();
is_shutting_down_ = true;
Shell::Get()->NotifyOverviewModeEnding();
window_selector_->Shutdown();
auto* window_selector = window_selector_.release();
window_selector->Shutdown();
// Don't delete |window_selector_| yet since the stack is still using it.
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE,
window_selector_.release());
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, window_selector);
last_selection_time_ = base::Time::Now();
Shell::Get()->NotifyOverviewModeEnded();
is_shutting_down_ = false;
......
......@@ -949,6 +949,7 @@ TEST_F(WindowSelectorTest, SkipOverviewWindow) {
// mode correctly applies the transformations to the window and correctly
// updates the window bounds on exiting overview mode: http://crbug.com/401664.
TEST_F(WindowSelectorTest, FullscreenWindowTabletMode) {
UpdateDisplay("800x600");
const gfx::Rect bounds(400, 400);
std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
......@@ -961,13 +962,24 @@ TEST_F(WindowSelectorTest, FullscreenWindowTabletMode) {
gfx::Rect fullscreen_window_bounds(window1->bounds());
EXPECT_NE(normal_window_bounds, fullscreen_window_bounds);
EXPECT_EQ(fullscreen_window_bounds, window2->GetTargetBounds());
const gfx::Rect fullscreen(800, 600);
const gfx::Rect normal_work_area(800, 552);
display::Screen* screen = display::Screen::GetScreen();
EXPECT_EQ(gfx::Rect(800, 600),
screen->GetDisplayNearestWindow(window1.get()).work_area());
ToggleOverview();
EXPECT_EQ(fullscreen,
screen->GetDisplayNearestWindow(window1.get()).work_area());
// Window 2 would normally resize to normal window bounds on showing the shelf
// for overview but this is deferred until overview is exited.
EXPECT_EQ(fullscreen_window_bounds, window2->GetTargetBounds());
EXPECT_FALSE(WindowsOverlapping(window1.get(), window2.get()));
ToggleOverview();
EXPECT_EQ(fullscreen,
screen->GetDisplayNearestWindow(window1.get()).work_area());
// Since the fullscreen window is still active, window2 will still have the
// larger bounds.
EXPECT_EQ(fullscreen_window_bounds, window2->GetTargetBounds());
......@@ -976,7 +988,19 @@ TEST_F(WindowSelectorTest, FullscreenWindowTabletMode) {
// the shelf bringing window2 back to the normal bounds.
ToggleOverview();
ClickWindow(window2.get());
// Selecting non fullscreen window should set the work area back to normal.
EXPECT_EQ(normal_work_area,
screen->GetDisplayNearestWindow(window1.get()).work_area());
EXPECT_EQ(normal_window_bounds, window2->GetTargetBounds());
ToggleOverview();
EXPECT_EQ(normal_work_area,
screen->GetDisplayNearestWindow(window1.get()).work_area());
ClickWindow(window1.get());
// Selecting fullscreen. The work area should be updated to fullscreen as
// well.
EXPECT_EQ(fullscreen,
screen->GetDisplayNearestWindow(window1.get()).work_area());
}
// Tests that beginning window selection hides the app list.
......
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