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

Unified Diff: ui/app_list/pagination_model.cc

Issue 20656002: Add profile selector menu to app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: small fixups Created 7 years, 5 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/pagination_model.cc
diff --git a/ui/app_list/pagination_model.cc b/ui/app_list/pagination_model.cc
index 2bf69020ab87950d110cba73853c6bbd9bbe135a..aafce1e795856a2f473dfe0a7f370d8132a5ad74 100644
--- a/ui/app_list/pagination_model.cc
+++ b/ui/app_list/pagination_model.cc
@@ -29,10 +29,12 @@ void PaginationModel::SetTotalPages(int total_pages) {
return;
total_pages_ = total_pages;
- if (selected_page_ < 0)
+ if (selected_page_ < 0) {
koz (OOO until 15th September) 2013/08/02 01:51:16 nit: one line ifs shouldn't have curlies.
calamity 2013/08/02 09:59:54 Done.
SelectPage(0, false /* animate */);
- if (selected_page_ >= total_pages_)
- SelectPage(total_pages_ - 1, false /* animate */);
+ }
+ if (selected_page_ >= total_pages_) {
+ SelectPage(std::max(total_pages_ - 1, 0), false /* animate */);
+ }
FOR_EACH_OBSERVER(PaginationModelObserver, observers_, TotalPagesChanged());
}
@@ -82,7 +84,7 @@ void PaginationModel::SelectPage(int page, bool animate) {
}
}
} else {
- DCHECK(page >= 0 && page < total_pages_);
+ DCHECK(page == 0 || (page > 0 && page < total_pages_));
if (page == selected_page_)
return;

Powered by Google App Engine
This is Rietveld 408576698