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

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

Issue 947903002: Change ContentsView::SetActivePage to use States rather than indexes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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 11bbd3f04ebd389087ce4e381d94ea1b1baff881..024466e77a85c33d6a0629ce9aef91047af9897b 100644
--- a/ui/app_list/views/contents_view.cc
+++ b/ui/app_list/views/contents_view.cc
@@ -131,15 +131,15 @@ void ContentsView::SetDragAndDropHostOfCurrentAppList(
apps_container_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host);
}
-void ContentsView::SetActivePage(int page_index) {
- SetActivePage(page_index, true);
+void ContentsView::SetActivePage(AppListModel::State state) {
+ SetActivePage(state, true);
}
-void ContentsView::SetActivePage(int page_index, bool animate) {
- if (GetActivePageIndex() == page_index)
+void ContentsView::SetActivePage(AppListModel::State state, bool animate) {
+ if (IsStateActive(state))
return;
- SetActivePageInternal(page_index, false, animate);
+ SetActivePageInternal(GetPageIndexForState(state), false, animate);
}
int ContentsView::GetActivePageIndex() const {
@@ -432,13 +432,13 @@ bool ContentsView::Back() {
if (app_list_main_view_->model()->PopCustomLauncherPageSubpage())
app_list_main_view_->view_delegate()->CustomLauncherPagePopSubpage();
else
- SetActivePage(GetPageIndexForState(AppListModel::STATE_START));
+ SetActivePage(AppListModel::STATE_START);
break;
case AppListModel::STATE_APPS:
if (apps_container_view_->IsInFolderView())
apps_container_view_->app_list_folder_view()->CloseFolderPage();
else
- SetActivePage(GetPageIndexForState(AppListModel::STATE_START));
+ SetActivePage(AppListModel::STATE_START);
break;
case AppListModel::STATE_SEARCH_RESULTS:
GetSearchBoxView()->ClearSearch();

Powered by Google App Engine
This is Rietveld 408576698