Commit af66d90f authored by Kevin Strohbehn's avatar Kevin Strohbehn Committed by Commit Bot

Hide search results when search box is inactive

This prevents ChromeVox from reading a hierarchy of inactive results.

Bug: 910348
Change-Id: I393c7a347c63393890ed84b81647828ccc8f547d
Reviewed-on: https://chromium-review.googlesource.com/c/1369127Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Kevin Strohbehn <ginko@google.com>
Cr-Commit-Position: refs/heads/master@{#615712}
parent 85102b19
......@@ -139,7 +139,14 @@ class AppListViewTest : public views::ViewsTestBase,
// and returns false on failure.
bool SetAppListState(ash::AppListState state) {
ContentsView* contents_view = view_->app_list_main_view()->contents_view();
contents_view->SetActiveState(state);
// The default method of changing the state to |kStateSearchResults| is via
// |ShowSearchResults|
if (state == ash::AppListState::kStateSearchResults)
contents_view->ShowSearchResults(true);
else
contents_view->SetActiveState(state);
contents_view->Layout();
return IsStateShown(state);
}
......@@ -1700,7 +1707,7 @@ TEST_F(AppListViewTest, PageSwitchingAnimationTest) {
IsStateShown(ash::AppListState::kStateStart);
// Change pages. View should not have moved without Layout().
contents_view->SetActiveState(ash::AppListState::kStateSearchResults);
contents_view->ShowSearchResults(true);
IsStateShown(ash::AppListState::kStateStart);
// Change to a third page. This queues up the second animation behind the
......
......@@ -143,6 +143,10 @@ void ContentsView::SetActiveState(ash::AppListState state, bool animate) {
if (IsStateActive(state))
return;
// The primary way to set the state to search results should be via
// |ShowSearchResults|
DCHECK(state != ash::AppListState::kStateSearchResults);
SetActiveStateInternal(GetPageIndexForState(state), false, animate);
}
......@@ -227,12 +231,11 @@ void ContentsView::ShowSearchResults(bool show) {
GetPageIndexForState(ash::AppListState::kStateSearchResults);
DCHECK_GE(search_page, 0);
// Search results page is hidden when it is behind the search box, so reshow
// it here.
if (show)
GetPageView(search_page)->SetVisible(true);
// Hide or Show results
GetPageView(search_page)->SetVisible(show);
SetActiveStateInternal(show ? search_page : page_before_search_, show, true);
SetActiveStateInternal(show ? search_page : page_before_search_, show,
!AppListView::ShortAnimationsForTesting());
}
bool ContentsView::IsShowingSearchResults() const {
......
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