Commit 771b72eb authored by Alex Newcomer's avatar Alex Newcomer Committed by Commit Bot

cros: Reset AppListView when hidden with a side shelf.

Some cleanup code is saved until after the AppListView animations are
complete. This makes animations smoother.

Because there are no animations in side shelf mode, this cleanup is
skipped. Do it in SetChildViewsForStateTransition.

Also removed some redundant code (L1007 - L1011). This is done in the
call at L1001.

Bug: 981292
Change-Id: I406cde5bdfb152ab4829e275757c71c3b6f877dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1693503
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676144}
parent 1c7c0d11
......@@ -290,6 +290,32 @@ TEST_F(AppListPresenterDelegateZeroStateTest,
->is_search_box_active());
}
// Tests that the SearchBox activation is reset after the AppList is hidden with
// no animation from FULLSCREEN_SEARCH.
TEST_F(AppListPresenterDelegateZeroStateTest,
SideShelfAppListResetsSearchBoxActivationOnClose) {
// Set the shelf to one side, then show the AppList and activate the
// searchbox.
SetShelfAlignment(ShelfAlignment::SHELF_ALIGNMENT_RIGHT);
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetEventGenerator()->GestureTapAt(GetPointInsideSearchbox());
ASSERT_TRUE(GetAppListTestHelper()
->GetAppListView()
->search_box_view()
->is_search_box_active());
// Dismiss the AppList using the controller, this is the same way we dismiss
// the AppList when a SearchResult is launched, and skips the
// FULLSCREEN_SEARCH -> FULLSCREEN_ALL_APPS transition.
Shell::Get()->app_list_controller()->DismissAppList();
// Test that the search box is not active.
EXPECT_FALSE(GetAppListTestHelper()
->GetAppListView()
->search_box_view()
->is_search_box_active());
}
// Verifies that tapping on the search box in tablet mode with animation and
// zero state enabled should not bring Chrome crash (https://crbug.com/958267).
TEST_F(AppListPresenterDelegateZeroStateTest, ClickSearchBoxInTabletMode) {
......
......@@ -1004,11 +1004,6 @@ void AppListView::SetChildViewsForStateTransition(
if (target_state == ash::AppListViewState::kHalf)
return;
if (target_state == ash::AppListViewState::kClosed) {
app_list_main_view_->contents_view()->CancelDrag();
return;
}
if (GetAppsContainerView()->IsInFolderView())
GetAppsContainerView()->ResetForShowApps();
......@@ -1023,6 +1018,11 @@ void AppListView::SetChildViewsForStateTransition(
pagination_model->SelectPage(0, false /* animate */);
}
}
if (target_state == ash::AppListViewState::kClosed && is_side_shelf_) {
// Reset the search box to be shown again. This is done after the animation
// is complete normally, but there is no animation when |is_side_shelf_|.
search_box_view_->ClearSearchAndDeactivateSearchBox();
}
}
void AppListView::ConvertAppListStateToFullscreenEquivalent(
......
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