Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: ui/app_list/views/contents_view.cc

Issue 331413003: Slight refactor of search result handling in ContentsView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/contents_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 188926076b313d92e5dc8440bac2a86997721e88..4c40b448ed9e2e1ba302d9d53c0c9d7ba4b1e148 100644
--- a/ui/app_list/views/contents_view.cc
+++ b/ui/app_list/views/contents_view.cc
@@ -82,8 +82,7 @@ void ContentsView::SetActivePage(int page_index) {
if (active_page_ == page_index)
return;
- active_page_ = page_index;
- ActivePageChanged();
+ SetActivePageInternal(page_index, false);
}
bool ContentsView::IsNamedPageActive(NamedPage named_page) const {
@@ -104,7 +103,13 @@ int ContentsView::GetPageIndexForNamedPage(NamedPage named_page) const {
return it->second;
}
-void ContentsView::ActivePageChanged() {
+void ContentsView::SetActivePageInternal(int page_index,
+ bool show_search_results) {
+ active_page_ = page_index;
+ ActivePageChanged(show_search_results);
+}
+
+void ContentsView::ActivePageChanged(bool show_search_results) {
// TODO(xiyuan): Highlight default match instead of the first.
if (IsNamedPageActive(NAMED_PAGE_SEARCH_RESULTS) &&
search_results_view_->visible()) {
@@ -113,8 +118,12 @@ void ContentsView::ActivePageChanged() {
if (search_results_view_)
search_results_view_->UpdateAutoLaunchState();
- if (IsNamedPageActive(NAMED_PAGE_START))
- start_page_view_->Reset();
+ if (IsNamedPageActive(NAMED_PAGE_START)) {
+ if (show_search_results)
+ start_page_view_->ShowSearchResults();
+ else
+ start_page_view_->Reset();
+ }
// Notify parent AppListMainView of the page change.
app_list_main_view_->UpdateSearchBoxVisibility();
@@ -127,15 +136,7 @@ void ContentsView::ShowSearchResults(bool show) {
if (app_list::switches::IsExperimentalAppListEnabled())
new_named_page = NAMED_PAGE_START;
- SetActivePage(GetPageIndexForNamedPage(new_named_page));
-
- if (app_list::switches::IsExperimentalAppListEnabled()) {
- if (show)
- start_page_view_->ShowSearchResults();
- else
- start_page_view_->Reset();
- app_list_main_view_->UpdateSearchBoxVisibility();
- }
+ SetActivePageInternal(GetPageIndexForNamedPage(new_named_page), show);
}
bool ContentsView::IsShowingSearchResults() const {
« no previous file with comments | « ui/app_list/views/contents_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698