Chromium Code Reviews| Index: ui/app_list/views/contents_view.cc |
| diff --git a/ui/app_list/views/contents_view.cc b/ui/app_list/views/contents_view.cc |
| index 452e4fdfc2d17aba57f8218b3e880806ecc1afb7..82081f5ce7b7e96f31f5e14f1edf97b91689e003 100644 |
| --- a/ui/app_list/views/contents_view.cc |
| +++ b/ui/app_list/views/contents_view.cc |
| @@ -40,7 +40,8 @@ ContentsView::ContentsView(AppListMainView* app_list_main_view) |
| start_page_view_(NULL), |
| app_list_main_view_(app_list_main_view), |
| contents_switcher_view_(NULL), |
| - view_model_(new views::ViewModel) { |
| + view_model_(new views::ViewModel), |
| + page_before_search_(0) { |
| pagination_model_.AddObserver(this); |
| } |
| @@ -75,6 +76,7 @@ void ContentsView::InitNamedPages(AppListModel* model, |
| if (app_list::switches::IsExperimentalAppListEnabled()) |
| initial_page_index = GetPageIndexForNamedPage(NAMED_PAGE_START); |
| + page_before_search_ = initial_page_index; |
| pagination_model_.SelectPage(initial_page_index, false); |
| // Needed to update the main search box visibility. |
| @@ -133,6 +135,8 @@ int ContentsView::NumLauncherPages() const { |
| void ContentsView::SetActivePageInternal(int page_index, |
| bool show_search_results) { |
| + if (!show_search_results) |
| + page_before_search_ = page_index; |
| // Start animating to the new page. |
| pagination_model_.SelectPage(page_index, true); |
| ActivePageChanged(show_search_results); |
| @@ -159,11 +163,16 @@ void ContentsView::ActivePageChanged(bool show_search_results) { |
| } |
| void ContentsView::ShowSearchResults(bool show) { |
| - NamedPage new_named_page = show ? NAMED_PAGE_SEARCH_RESULTS : NAMED_PAGE_APPS; |
| - if (app_list::switches::IsExperimentalAppListEnabled()) |
| - new_named_page = NAMED_PAGE_START; |
| + int page = page_before_search_; |
| + if (show) { |
| + NamedPage new_named_page = |
| + show ? NAMED_PAGE_SEARCH_RESULTS : NAMED_PAGE_APPS; |
|
Matt Giuca
2014/07/09 04:42:07
show is always true.. see later.
calamity
2014/07/11 04:22:17
Acknowledged.
|
| + if (app_list::switches::IsExperimentalAppListEnabled()) |
| + new_named_page = NAMED_PAGE_START; |
| + page = GetPageIndexForNamedPage(new_named_page); |
|
Matt Giuca
2014/07/09 04:42:07
Can just collapse the entire body of this if state
calamity
2014/07/11 04:22:17
Acknowledged.
|
| + } |
|
Matt Giuca
2014/07/09 04:42:07
else { page = page_before_search_; }
I find it ea
calamity
2014/07/11 04:22:17
Changed the whole thing. Should be nicer now.
|
| - SetActivePageInternal(GetPageIndexForNamedPage(new_named_page), show); |
| + SetActivePageInternal(page, show); |
| } |
| bool ContentsView::IsShowingSearchResults() const { |