Commit 2c653e93 authored by Eliot Courtney's avatar Eliot Courtney Committed by Commit Bot

Let PIP windows be excluded but visible during overview.

overview. It was visible but not included in the overview.

Bug: b/112668590
Test: Added unittests + put a window into PIP mode then started the
Change-Id: I245c6a9eb05fb08fca68619b35261967d1becea2
Reviewed-on: https://chromium-review.googlesource.com/1177207Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585873}
parent 59f30549
...@@ -269,7 +269,8 @@ aura::Window* GetDraggedWindow( ...@@ -269,7 +269,8 @@ aura::Window* GetDraggedWindow(
// static // static
bool WindowSelector::IsSelectable(const aura::Window* window) { bool WindowSelector::IsSelectable(const aura::Window* window) {
return wm::GetWindowState(window)->IsUserPositionable(); auto* window_state = wm::GetWindowState(window);
return window_state->IsUserPositionable() && !window_state->IsPip();
} }
WindowSelector::WindowSelector(WindowSelectorDelegate* delegate) WindowSelector::WindowSelector(WindowSelectorDelegate* delegate)
......
...@@ -151,6 +151,27 @@ class TweenTester : public ui::LayerAnimationObserver { ...@@ -151,6 +151,27 @@ class TweenTester : public ui::LayerAnimationObserver {
DISALLOW_COPY_AND_ASSIGN(TweenTester); DISALLOW_COPY_AND_ASSIGN(TweenTester);
}; };
// WindowState that lets us specify an initial state.
class InitialStateTestState : public wm::WindowState::State {
public:
explicit InitialStateTestState(mojom::WindowStateType initial_state_type)
: state_type_(initial_state_type) {}
~InitialStateTestState() override = default;
// WindowState::State overrides:
void OnWMEvent(wm::WindowState* window_state,
const wm::WMEvent* event) override {}
mojom::WindowStateType GetType() const override { return state_type_; }
void AttachState(wm::WindowState* window_state,
wm::WindowState::State* previous_state) override {}
void DetachState(wm::WindowState* window_state) override {}
private:
mojom::WindowStateType state_type_;
DISALLOW_COPY_AND_ASSIGN(InitialStateTestState);
};
} // namespace } // namespace
// TODO(bruthig): Move all non-simple method definitions out of class // TODO(bruthig): Move all non-simple method definitions out of class
...@@ -2993,6 +3014,23 @@ TEST_F(WindowSelectorTest, ShadowDisappearsInOverview) { ...@@ -2993,6 +3014,23 @@ TEST_F(WindowSelectorTest, ShadowDisappearsInOverview) {
EXPECT_TRUE(shadow_controller->IsShadowVisibleForWindow(window.get())); EXPECT_TRUE(shadow_controller->IsShadowVisibleForWindow(window.get()));
} }
// Verify that PIP windows will be excluded from the overview, but not hidden.
TEST_F(WindowSelectorTest, PipWindowShownButExcludedFromOverview) {
const gfx::Rect bounds(200, 200);
std::unique_ptr<aura::Window> pip_window(CreateWindow(bounds));
wm::GetWindowState(pip_window.get())
->SetStateObject(std::unique_ptr<wm::WindowState::State>(
new InitialStateTestState(mojom::WindowStateType::PIP)));
// Enter overview.
ToggleOverview();
// PIP window should be visible but not in the overview.
EXPECT_TRUE(pip_window->IsVisible());
EXPECT_FALSE(SelectWindow(pip_window.get()));
}
// Tests the PositionWindows function works as expected. // Tests the PositionWindows function works as expected.
TEST_F(WindowSelectorTest, PositionWindows) { TEST_F(WindowSelectorTest, PositionWindows) {
const gfx::Rect bounds(200, 200); const gfx::Rect bounds(200, 200);
......
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