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

Unified Diff: ash/app_list/pagination_model.cc

Issue 10381018: ash: First pass of Applist v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 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 | « ash/app_list/pagination_model.h ('k') | ash/app_list/pagination_model_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/app_list/pagination_model.cc
diff --git a/ash/app_list/pagination_model.cc b/ash/app_list/pagination_model.cc
new file mode 100644
index 0000000000000000000000000000000000000000..413a632e56fa865d98a48b3a7505ed716ed61230
--- /dev/null
+++ b/ash/app_list/pagination_model.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/app_list/pagination_model.h"
+
+#include "ash/app_list/pagination_model_observer.h"
+
+namespace ash {
+
+PaginationModel::PaginationModel()
+ : total_pages_(-1),
+ selected_page_(-1) {
+}
+
+PaginationModel::~PaginationModel() {
+}
+
+void PaginationModel::SetTotalPages(int total_pages) {
+ if (total_pages == total_pages_)
+ return;
+
+ total_pages_ = total_pages;
+ FOR_EACH_OBSERVER(PaginationModelObserver,
+ observers_,
+ TotalPagesChanged());
+}
+
+void PaginationModel::SelectPage(int page) {
+ DCHECK(page >= 0 && page < total_pages_);
+
+ if (page == selected_page_)
+ return;
+
+ int old_selected = selected_page_;
+ selected_page_ = page;
+ FOR_EACH_OBSERVER(PaginationModelObserver,
+ observers_,
+ SelectedPageChanged(old_selected, selected_page_));
+}
+
+void PaginationModel::AddObserver(PaginationModelObserver* observer) {
+ observers_.AddObserver(observer);
+}
+
+void PaginationModel::RemoveObserver(PaginationModelObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+} // namespace ash
« no previous file with comments | « ash/app_list/pagination_model.h ('k') | ash/app_list/pagination_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698