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 UI_APP_LIST_PAGINATION_MODEL_H_ | 5 #ifndef UI_APP_LIST_PAGINATION_MODEL_H_ |
6 #define UI_APP_LIST_PAGINATION_MODEL_H_ | 6 #define UI_APP_LIST_PAGINATION_MODEL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const Transition& transition() const { return transition_; } | 86 const Transition& transition() const { return transition_; } |
87 | 87 |
88 bool is_valid_page(int page) const { | 88 bool is_valid_page(int page) const { |
89 return page >= 0 && page < total_pages_; | 89 return page >= 0 && page < total_pages_; |
90 } | 90 } |
91 | 91 |
92 bool has_transition() const { | 92 bool has_transition() const { |
93 return transition_.target_page != -1 || transition_.progress != 0; | 93 return transition_.target_page != -1 || transition_.progress != 0; |
94 } | 94 } |
95 | 95 |
| 96 // Gets the page that the animation will eventually land on. If there is no |
| 97 // active animation, just returns selected_page(). |
| 98 int SelectedTargetPage() const; |
| 99 |
96 private: | 100 private: |
97 void NotifySelectedPageChanged(int old_selected, int new_selected); | 101 void NotifySelectedPageChanged(int old_selected, int new_selected); |
98 void NotifyTransitionStarted(); | 102 void NotifyTransitionStarted(); |
99 void NotifyTransitionChanged(); | 103 void NotifyTransitionChanged(); |
100 | 104 |
101 void clear_transition() { | 105 void clear_transition() { |
102 SetTransition(Transition(-1, 0)); | 106 SetTransition(Transition(-1, 0)); |
103 } | 107 } |
104 | 108 |
105 // Calculates a target page number by combining current page and |delta|. | 109 // Calculates a target page number by combining current page and |delta|. |
(...skipping 29 matching lines...) Expand all Loading... |
135 base::TimeTicks last_overscroll_animation_start_time_; | 139 base::TimeTicks last_overscroll_animation_start_time_; |
136 | 140 |
137 ObserverList<PaginationModelObserver> observers_; | 141 ObserverList<PaginationModelObserver> observers_; |
138 | 142 |
139 DISALLOW_COPY_AND_ASSIGN(PaginationModel); | 143 DISALLOW_COPY_AND_ASSIGN(PaginationModel); |
140 }; | 144 }; |
141 | 145 |
142 } // namespace app_list | 146 } // namespace app_list |
143 | 147 |
144 #endif // UI_APP_LIST_PAGINATION_MODEL_H_ | 148 #endif // UI_APP_LIST_PAGINATION_MODEL_H_ |
OLD | NEW |