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

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

Issue 10826209: gestures: Generate only either scroll-end or fling-start events at the end of a scroll gesture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win-fix Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SetTransitionDuration(int duration_ms);
63 void ResetTransitionAnimation();
63 64
64 // Starts a scroll transition. If there is a running transition animation, 65 // Starts a scroll transition. If there is a running transition animation,
65 // cancels it but keeps the transition info. 66 // cancels it but keeps the transition info.
66 void StartScroll(); 67 void StartScroll();
67 68
68 // Updates transition progress from |delta|. |delta| > 0 means transit to 69 // Updates transition progress from |delta|. |delta| > 0 means transit to
69 // previous page (moving pages to the right). |delta| < 0 means transit 70 // previous page (moving pages to the right). |delta| < 0 means transit
70 // to next page (moving pages to the left). 71 // to next page (moving pages to the left).
71 void UpdateScroll(double delta); 72 void UpdateScroll(double delta);
72 73
(...skipping 27 matching lines...) Expand all
100 // Calculates a target page number by combining current page and |delta|. 101 // Calculates a target page number by combining current page and |delta|.
101 // When there is no transition, current page is the currently selected page. 102 // When there is no transition, current page is the currently selected page.
102 // If there is a transition, current page is the transition target page or the 103 // If there is a transition, current page is the transition target page or the
103 // pending transition target page. When current page + |delta| goes beyond 104 // pending transition target page. When current page + |delta| goes beyond
104 // valid range and |selected_page_| is at the range ends, invalid page number 105 // valid range and |selected_page_| is at the range ends, invalid page number
105 // -1 or |total_pages_| is returned to indicate the situation. 106 // -1 or |total_pages_| is returned to indicate the situation.
106 int CalculateTargetPage(int delta) const; 107 int CalculateTargetPage(int delta) const;
107 108
108 void StartTranstionAnimation(int target_page); 109 void StartTranstionAnimation(int target_page);
109 void CreateTransitionAnimation(); 110 void CreateTransitionAnimation();
110 void ResetTranstionAnimation();
111 111
112 // ui::AnimationDelegate overrides: 112 // ui::AnimationDelegate overrides:
113 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 113 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
114 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 114 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
115 115
116 int total_pages_; 116 int total_pages_;
117 int selected_page_; 117 int selected_page_;
118 118
119 Transition transition_; 119 Transition transition_;
120 120
121 // Pending selected page when SelectedPage is called during a transition. If 121 // Pending selected page when SelectedPage is called during a transition. If
122 // multiple SelectPage is called while a transition is in progress, only the 122 // multiple SelectPage is called while a transition is in progress, only the
123 // last target page is remembered here. 123 // last target page is remembered here.
124 int pending_selected_page_; 124 int pending_selected_page_;
125 125
126 scoped_ptr<ui::SlideAnimation> transition_animation_; 126 scoped_ptr<ui::SlideAnimation> transition_animation_;
127 int transition_duration_ms_; // Transition duration in millisecond. 127 int transition_duration_ms_; // Transition duration in millisecond.
128 128
129 ObserverList<PaginationModelObserver> observers_; 129 ObserverList<PaginationModelObserver> observers_;
130 130
131 DISALLOW_COPY_AND_ASSIGN(PaginationModel); 131 DISALLOW_COPY_AND_ASSIGN(PaginationModel);
132 }; 132 };
133 133
134 } // namespace app_list 134 } // namespace app_list
135 135
136 #endif // UI_APP_LIST_PAGINATION_MODEL_H_ 136 #endif // UI_APP_LIST_PAGINATION_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698