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

Side by Side Diff: ui/app_list/pagination_model.h

Issue 11275320: app_list: Make over scroll animation faster. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/app_list/contents_view.cc ('k') | ui/app_list/pagination_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 void SetTotalPages(int total_pages); 53 void SetTotalPages(int total_pages);
54 54
55 // Selects a page. |animate| is true if the transition should be animated. 55 // Selects a page. |animate| is true if the transition should be animated.
56 void SelectPage(int page, bool animate); 56 void SelectPage(int page, bool animate);
57 57
58 // Selects a page by relative |delta|. 58 // Selects a page by relative |delta|.
59 void SelectPageRelative(int delta, bool animate); 59 void SelectPageRelative(int delta, bool animate);
60 60
61 void SetTransition(const Transition& transition); 61 void SetTransition(const Transition& transition);
62 void SetTransitionDuration(int duration_ms); 62 void SetTransitionDurations(int duration_ms, int overscroll_duration_ms);
63 63
64 // Starts a scroll transition. If there is a running transition animation, 64 // Starts a scroll transition. If there is a running transition animation,
65 // cancels it but keeps the transition info. 65 // cancels it but keeps the transition info.
66 void StartScroll(); 66 void StartScroll();
67 67
68 // Updates transition progress from |delta|. |delta| > 0 means transit to 68 // Updates transition progress from |delta|. |delta| > 0 means transit to
69 // previous page (moving pages to the right). |delta| < 0 means transit 69 // previous page (moving pages to the right). |delta| < 0 means transit
70 // to next page (moving pages to the left). 70 // to next page (moving pages to the left).
71 void UpdateScroll(double delta); 71 void UpdateScroll(double delta);
72 72
(...skipping 28 matching lines...) Expand all
101 } 101 }
102 102
103 // Calculates a target page number by combining current page and |delta|. 103 // Calculates a target page number by combining current page and |delta|.
104 // When there is no transition, current page is the currently selected page. 104 // When there is no transition, current page is the currently selected page.
105 // If there is a transition, current page is the transition target page or the 105 // If there is a transition, current page is the transition target page or the
106 // pending transition target page. When current page + |delta| goes beyond 106 // pending transition target page. When current page + |delta| goes beyond
107 // valid range and |selected_page_| is at the range ends, invalid page number 107 // valid range and |selected_page_| is at the range ends, invalid page number
108 // -1 or |total_pages_| is returned to indicate the situation. 108 // -1 or |total_pages_| is returned to indicate the situation.
109 int CalculateTargetPage(int delta) const; 109 int CalculateTargetPage(int delta) const;
110 110
111 void StartTranstionAnimation(int target_page); 111 void StartTransitionAnimation(const Transition& transition);
112 void CreateTransitionAnimation();
113 void ResetTransitionAnimation(); 112 void ResetTransitionAnimation();
114 113
115 // ui::AnimationDelegate overrides: 114 // ui::AnimationDelegate overrides:
116 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 115 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
117 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 116 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
118 117
119 int total_pages_; 118 int total_pages_;
120 int selected_page_; 119 int selected_page_;
121 120
122 Transition transition_; 121 Transition transition_;
123 122
124 // Pending selected page when SelectedPage is called during a transition. If 123 // Pending selected page when SelectedPage is called during a transition. If
125 // multiple SelectPage is called while a transition is in progress, only the 124 // multiple SelectPage is called while a transition is in progress, only the
126 // last target page is remembered here. 125 // last target page is remembered here.
127 int pending_selected_page_; 126 int pending_selected_page_;
128 127
129 scoped_ptr<ui::SlideAnimation> transition_animation_; 128 scoped_ptr<ui::SlideAnimation> transition_animation_;
130 int transition_duration_ms_; // Transition duration in millisecond. 129 int transition_duration_ms_; // Transition duration in millisecond.
130 int overscroll_transition_duration_ms_;
131 131
132 ObserverList<PaginationModelObserver> observers_; 132 ObserverList<PaginationModelObserver> observers_;
133 133
134 DISALLOW_COPY_AND_ASSIGN(PaginationModel); 134 DISALLOW_COPY_AND_ASSIGN(PaginationModel);
135 }; 135 };
136 136
137 } // namespace app_list 137 } // namespace app_list
138 138
139 #endif // UI_APP_LIST_PAGINATION_MODEL_H_ 139 #endif // UI_APP_LIST_PAGINATION_MODEL_H_
OLDNEW
« no previous file with comments | « ui/app_list/contents_view.cc ('k') | ui/app_list/pagination_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698