OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_APP_LIST_PAGINATION_MODEL_H_ | 5 #ifndef UI_APP_LIST_PAGINATION_MODEL_H_ |
6 #define ASH_APP_LIST_PAGINATION_MODEL_H_ | 6 #define UI_APP_LIST_PAGINATION_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/ash_export.h" | 9 #include "ui/app_list/app_list_export.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 | 12 |
13 namespace ash { | 13 namespace app_list { |
14 | 14 |
15 class PaginationModelObserver; | 15 class PaginationModelObserver; |
16 | 16 |
17 // A simple pagination model that consists of two numbers: the total pages and | 17 // A simple pagination model that consists of two numbers: the total pages and |
18 // the currently selected page. The model is a single selection model that at | 18 // the currently selected page. The model is a single selection model that at |
19 // the most one page can become selected at any time. | 19 // the most one page can become selected at any time. |
20 class ASH_EXPORT PaginationModel { | 20 class APP_LIST_EXPORT PaginationModel { |
21 public: | 21 public: |
22 PaginationModel(); | 22 PaginationModel(); |
23 ~PaginationModel(); | 23 ~PaginationModel(); |
24 | 24 |
25 void SetTotalPages(int total_pages); | 25 void SetTotalPages(int total_pages); |
26 void SelectPage(int page); | 26 void SelectPage(int page); |
27 | 27 |
28 void AddObserver(PaginationModelObserver* observer); | 28 void AddObserver(PaginationModelObserver* observer); |
29 void RemoveObserver(PaginationModelObserver* observer); | 29 void RemoveObserver(PaginationModelObserver* observer); |
30 | 30 |
31 int total_pages() const { | 31 int total_pages() const { |
32 return total_pages_; | 32 return total_pages_; |
33 } | 33 } |
34 | 34 |
35 int selected_page() const { | 35 int selected_page() const { |
36 return selected_page_; | 36 return selected_page_; |
37 } | 37 } |
38 | 38 |
39 private: | 39 private: |
40 int total_pages_; | 40 int total_pages_; |
41 int selected_page_; | 41 int selected_page_; |
42 ObserverList<PaginationModelObserver> observers_; | 42 ObserverList<PaginationModelObserver> observers_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(PaginationModel); | 44 DISALLOW_COPY_AND_ASSIGN(PaginationModel); |
45 }; | 45 }; |
46 | 46 |
47 } // namespace ash | 47 } // namespace app_list |
48 | 48 |
49 #endif // ASH_APP_LIST_PAGINATION_MODEL_H_ | 49 #endif // UI_APP_LIST_PAGINATION_MODEL_H_ |
OLD | NEW |