Commit 31318191 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

Revert "shelf: Users cannot hide shelf by swipe down in tablet mode anymore."

This reverts commit 4d9e568b.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> shelf: Users cannot hide shelf by swipe down in tablet mode anymore.
> 
> Test: ash_unittests ShelfLayoutManagerTest.SwipingUpOnShelfInTabletModeForFullscreenAppList
> Bug: 801684
> Change-Id: I142180f8204fc413a46381c45267c7be9463c1ef
> Reviewed-on: https://chromium-review.googlesource.com/868453
> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> Commit-Queue: Sammie Quon <sammiequon@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#529507}

TBR=xiyuan@chromium.org,sammiequon@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 801684
Change-Id: I5edae712f04a26eea47811e3f2fd69fd0b9c79d9
Reviewed-on: https://chromium-review.googlesource.com/877160Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530701}
parent d94308f4
......@@ -86,12 +86,6 @@ bool IsAppListWindow(const aura::Window* window) {
return parent && parent->id() == kShellWindowId_AppListContainer;
}
bool IsTabletModeEnabled() {
return Shell::Get()
->tablet_mode_controller()
->IsTabletModeWindowManagerEnabled();
}
} // namespace
// ShelfLayoutManager::UpdateShelfObserver -------------------------------------
......@@ -1106,14 +1100,10 @@ void ShelfLayoutManager::StartGestureDrag(
launcher_above_shelf_bottom_amount_ =
shelf_bounds.bottom() - gesture_in_screen.location().y();
} else {
// Only app list drags are allowed in tablet mode.
if (IsTabletModeEnabled())
return;
// Disable the shelf dragging if the fullscreen app list is opened.
if (is_app_list_visible_)
if (is_app_list_visible_) {
return;
}
gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS;
gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE
? auto_hide_state()
......@@ -1141,10 +1131,6 @@ void ShelfLayoutManager::UpdateGestureDrag(
launcher_above_shelf_bottom_amount_ =
shelf_bounds.bottom() - gesture_in_screen.location().y();
} else {
// Only app list drags are allowed in tablet mode.
if (IsTabletModeEnabled())
return;
gesture_drag_amount_ +=
PrimaryAxisValue(gesture_in_screen.details().scroll_y(),
gesture_in_screen.details().scroll_x());
......@@ -1154,10 +1140,6 @@ void ShelfLayoutManager::UpdateGestureDrag(
void ShelfLayoutManager::CompleteGestureDrag(
const ui::GestureEvent& gesture_in_screen) {
// Only app list drags are allowed in tablet mode.
if (IsTabletModeEnabled())
return;
bool should_change = false;
if (gesture_in_screen.type() == ui::ET_GESTURE_SCROLL_END) {
// The visibility of the shelf changes only if the shelf was dragged X%
......@@ -1230,7 +1212,9 @@ void ShelfLayoutManager::CompleteAppListDrag(
} else {
// Snap the app list to corresponding state according to the snapping
// thresholds.
if (IsTabletModeEnabled()) {
if (Shell::Get()
->tablet_mode_controller()
->IsTabletModeWindowManagerEnabled()) {
app_list_state = launcher_above_shelf_bottom_amount_ >
kAppListDragSnapToFullscreenThreshold
? AppListState::FULLSCREEN_ALL_APPS
......
......@@ -1503,6 +1503,9 @@ TEST_F(ShelfLayoutManagerTest,
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
// Note: A window must be visible in order to hide the shelf.
views::Widget* widget = CreateTestWidget();
app_list::test::TestAppListPresenter test_app_list_presenter;
shell->app_list()->SetAppListPresenter(
test_app_list_presenter.CreateInterfacePtrAndBind());
......@@ -1543,12 +1546,35 @@ TEST_F(ShelfLayoutManagerTest,
EXPECT_EQ(app_list::mojom::AppListState::CLOSED,
test_app_list_presenter.app_list_state());
// Swiping down on the shelf should do nothing in tablet mode.
// Swiping down on the shelf should hide it.
end = start + delta;
generator.GestureScrollSequence(start, end, kTimeDelta, kNumScrollSteps);
EXPECT_EQ(SHELF_ALIGNMENT_BOTTOM, shelf->alignment());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
// Swiping up should show the shelf but not the app list if shelf is hidden.
generator.GestureScrollSequence(end, start, kTimeDelta, kNumScrollSteps);
RunAllPendingInMessageLoop();
EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
EXPECT_EQ(2u, test_app_list_presenter.show_count());
EXPECT_GE(test_app_list_presenter.set_y_position_count(), 1u);
EXPECT_EQ(app_list::mojom::AppListState::CLOSED,
test_app_list_presenter.app_list_state());
// Swiping down should hide the shelf.
generator.GestureScrollSequence(start, end, kTimeDelta, kNumScrollSteps);
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
// Minimize the visible window, the shelf should be shown if there are no
// visible windows, even in auto-hide mode.
widget->Minimize();
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
// Swiping up on the shelf in this state should open the app list.
delta.set_y(ShelfLayoutManager::kAppListDragSnapToFullscreenThreshold + 10);
......
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