Commit 9f4945a7 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

cros: Paint headers for splitview snapped windows part 2.

Missed a case for part 1 (https://chromium-review.googlesource.com/c/chromium/src/+/797681).
After both snap, press F5 to return to one snap + overview. Snapped
windows header is not shown. This is because on entering overview mode
or switching from split view states happen when overview is starting,
not when it is entered (IsSelecting() returns false in OnOverviewModeStarting),
so remove that check.

Test: manual, ash_unittests CustomFrameViewAshTest.HeaderVisibility
Bug: 789378
Change-Id: I1f1589b359983dcc6a2db65be62cd185121411c0
Reviewed-on: https://chromium-review.googlesource.com/809757Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522344}
parent ed18cc58
......@@ -506,17 +506,19 @@ void CustomFrameViewAsh::SetShouldPaintHeader(bool paint) {
}
void CustomFrameViewAsh::OnOverviewModeStarting() {
in_overview_mode_ = true;
SetShouldPaintHeader(false);
}
void CustomFrameViewAsh::OnOverviewModeEnded() {
in_overview_mode_ = false;
SetShouldPaintHeader(true);
}
void CustomFrameViewAsh::OnSplitViewStateChanged(
SplitViewController::State /* previous_state */,
SplitViewController::State state) {
if (Shell::Get()->window_selector_controller()->IsSelecting())
if (in_overview_mode_)
MaybePaintHeaderForSplitview(state);
}
......
......@@ -155,6 +155,13 @@ class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView,
static bool use_empty_minimum_size_for_test_;
// Track whether the device is in overview mode. Set this to true when
// overview mode started and false when overview mode finished. Use this to
// check whether we should paint when splitview state changes instead of
// Shell::Get()->window_selector_controller()->IsSelecting() because the later
// actually may be still be false after overview mode has started.
bool in_overview_mode_ = false;
DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAsh);
};
......
......@@ -374,6 +374,15 @@ TEST_F(CustomFrameViewAshTest, HeaderVisibilityInSplitview) {
EXPECT_TRUE(delegate1->header_view()->should_paint());
EXPECT_TRUE(delegate2->header_view()->should_paint());
// Toggle overview mode so we return back to left snapped mode. Verify that
// the header is again drawn for the snapped window, but not for the unsnapped
// window.
Shell::Get()->window_selector_controller()->ToggleOverview();
ASSERT_EQ(SplitViewController::LEFT_SNAPPED,
Shell::Get()->split_view_controller()->state());
EXPECT_TRUE(delegate1->header_view()->should_paint());
EXPECT_FALSE(delegate2->header_view()->should_paint());
Shell::Get()->split_view_controller()->EndSplitView();
}
......
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