OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ |
6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ | 6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Simple pull-to-refresh styled effect. Listens to scroll events, conditionally | 38 // Simple pull-to-refresh styled effect. Listens to scroll events, conditionally |
39 // activating when: | 39 // activating when: |
40 // 1) The scroll begins when the page has no vertical scroll offset. | 40 // 1) The scroll begins when the page has no vertical scroll offset. |
41 // 2) The page doesn't consume the initial scroll events. | 41 // 2) The page doesn't consume the initial scroll events. |
42 // 3) The initial scroll direction is upward. | 42 // 3) The initial scroll direction is upward. |
43 // The actual page reload action is triggered only when the effect is active | 43 // The actual page reload action is triggered only when the effect is active |
44 // and beyond a particular threshold when released. | 44 // and beyond a particular threshold when released. |
45 class CONTENT_EXPORT OverscrollRefresh { | 45 class CONTENT_EXPORT OverscrollRefresh { |
46 public: | 46 public: |
| 47 // Both |resource_manager| and |client| must not be null. |
| 48 // |target_drag_offset_pixels| is the threshold beyond which the effect |
| 49 // will trigger a refresh action when released. |
47 OverscrollRefresh(ui::SystemUIResourceManager* resource_manager, | 50 OverscrollRefresh(ui::SystemUIResourceManager* resource_manager, |
48 OverscrollRefreshClient* client); | 51 OverscrollRefreshClient* client, |
| 52 float target_drag_offset_pixels); |
49 ~OverscrollRefresh(); | 53 ~OverscrollRefresh(); |
50 | 54 |
51 // Scroll event stream listening methods. | 55 // Scroll event stream listening methods. |
52 void OnScrollBegin(); | 56 void OnScrollBegin(); |
53 void OnScrollEnd(const gfx::Vector2dF& velocity); | 57 void OnScrollEnd(const gfx::Vector2dF& velocity); |
54 | 58 |
55 // Scroll ack listener. The effect will only be activated if the initial | 59 // Scroll ack listener. The effect will only be activated if the initial |
56 // updates go unconsumed. | 60 // updates go unconsumed. |
57 void OnScrollUpdateAck(bool was_consumed); | 61 void OnScrollUpdateAck(bool was_consumed); |
58 | 62 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 98 |
95 class Effect; | 99 class Effect; |
96 scoped_ptr<Effect> effect_; | 100 scoped_ptr<Effect> effect_; |
97 | 101 |
98 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh); | 102 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh); |
99 }; | 103 }; |
100 | 104 |
101 } // namespace content | 105 } // namespace content |
102 | 106 |
103 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ | 107 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ |
OLD | NEW |