Commit d4652a31 authored by wutao's avatar wutao Committed by Commit Bot

app_list: assistant_page to search_result_page

This patch modifies the behavior that Back() from assistant_page should
be to the search_result_page.

Bug: 924624
Test: manual
Change-Id: Iba644fee5426ab8b36f47ad4b2e459b1286bd50d
Reviewed-on: https://chromium-review.googlesource.com/c/1455519Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Tao Wu <wutao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630070}
parent dbd4f075
...@@ -22,6 +22,10 @@ namespace { ...@@ -22,6 +22,10 @@ namespace {
constexpr int kHeight = 440; constexpr int kHeight = 440;
constexpr int kWidth = 640; constexpr int kWidth = 640;
// The height of the search box in |search_result_page_view_|. It is only for
// animation.
constexpr int kSearchBoxHeight = 56;
} // namespace } // namespace
AssistantPageView::AssistantPageView( AssistantPageView::AssistantPageView(
...@@ -73,6 +77,15 @@ gfx::Rect AssistantPageView::GetPageBoundsForState( ...@@ -73,6 +77,15 @@ gfx::Rect AssistantPageView::GetPageBoundsForState(
return onscreen_bounds; return onscreen_bounds;
} }
gfx::Rect AssistantPageView::GetSearchBoxBounds() const {
gfx::Rect rect(AppListPage::GetSearchBoxBounds());
rect.Offset((rect.width() - kWidth) / 2, 0);
rect.set_size(gfx::Size(kWidth, kSearchBoxHeight));
return rect;
}
views::View* AssistantPageView::GetFirstFocusableView() { views::View* AssistantPageView::GetFirstFocusableView() {
return GetFocusManager()->GetNextFocusableView( return GetFocusManager()->GetNextFocusableView(
this, GetWidget(), /*reverse=*/false, /*dont_loop=*/false); this, GetWidget(), /*reverse=*/false, /*dont_loop=*/false);
......
...@@ -34,6 +34,7 @@ class APP_LIST_EXPORT AssistantPageView : public AppListPage { ...@@ -34,6 +34,7 @@ class APP_LIST_EXPORT AssistantPageView : public AppListPage {
// AppListPage: // AppListPage:
gfx::Rect GetPageBoundsForState(ash::AppListState state) const override; gfx::Rect GetPageBoundsForState(ash::AppListState state) const override;
gfx::Rect GetSearchBoxBounds() const override;
views::View* GetFirstFocusableView() override; views::View* GetFirstFocusableView() override;
views::View* GetLastFocusableView() override; views::View* GetLastFocusableView() override;
......
...@@ -267,7 +267,7 @@ bool ContentsView::IsShowingSearchResults() const { ...@@ -267,7 +267,7 @@ bool ContentsView::IsShowingSearchResults() const {
} }
void ContentsView::ShowEmbeddedAssistantUI(bool show) { void ContentsView::ShowEmbeddedAssistantUI(bool show) {
int assistant_page = const int assistant_page =
GetPageIndexForState(ash::AppListState::kStateEmbeddedAssistant); GetPageIndexForState(ash::AppListState::kStateEmbeddedAssistant);
DCHECK_GE(assistant_page, 0); DCHECK_GE(assistant_page, 0);
...@@ -276,7 +276,14 @@ void ContentsView::ShowEmbeddedAssistantUI(bool show) { ...@@ -276,7 +276,14 @@ void ContentsView::ShowEmbeddedAssistantUI(bool show) {
if (show) if (show)
GetPageView(assistant_page)->RequestFocus(); GetPageView(assistant_page)->RequestFocus();
SetActiveStateInternal(show ? assistant_page : page_before_search_, show, // Embedded Assistant UI can only be transitioned from/to
// |search_result_page_view_|.
const int search_results_page =
GetPageIndexForState(ash::AppListState::kStateSearchResults);
DCHECK_GE(search_results_page, 0);
GetPageView(search_results_page)->SetVisible(!show);
SetActiveStateInternal(show ? assistant_page : search_results_page,
/*show_search_or_assistant_results=*/true,
!AppListView::ShortAnimationsForTesting()); !AppListView::ShortAnimationsForTesting());
} }
...@@ -499,8 +506,6 @@ bool ContentsView::Back() { ...@@ -499,8 +506,6 @@ bool ContentsView::Back() {
ShowSearchResults(false); ShowSearchResults(false);
break; break;
case ash::AppListState::kStateEmbeddedAssistant: case ash::AppListState::kStateEmbeddedAssistant:
GetSearchBoxView()->ClearSearch();
GetSearchBoxView()->SetSearchBoxActive(false, ui::ET_UNKNOWN);
ShowEmbeddedAssistantUI(false); ShowEmbeddedAssistantUI(false);
break; break;
case ash::AppListState::kInvalidState: // Falls through. case ash::AppListState::kInvalidState: // Falls through.
......
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