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

Side by Side Diff: ui/android/overscroll_refresh.h

Issue 2884423003: Use scroll-boundary-behavior to control overscroll-refresh/glow on android. (Closed)
Patch Set: format Created 3 years, 5 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
OLDNEW
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 UI_ANDROID_OVERSCROLL_REFRESH_H_ 5 #ifndef UI_ANDROID_OVERSCROLL_REFRESH_H_
6 #define UI_ANDROID_OVERSCROLL_REFRESH_H_ 6 #define UI_ANDROID_OVERSCROLL_REFRESH_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/android/ui_android_export.h" 9 #include "ui/android/ui_android_export.h"
10 #include "ui/gfx/geometry/size_f.h" 10 #include "ui/gfx/geometry/size_f.h"
(...skipping 19 matching lines...) Expand all
30 enum { kMinPullsToActivate = 3 }; 30 enum { kMinPullsToActivate = 3 };
31 31
32 explicit OverscrollRefresh(OverscrollRefreshHandler* handler); 32 explicit OverscrollRefresh(OverscrollRefreshHandler* handler);
33 ~OverscrollRefresh(); 33 ~OverscrollRefresh();
34 34
35 // Scroll event stream listening methods. 35 // Scroll event stream listening methods.
36 void OnScrollBegin(); 36 void OnScrollBegin();
37 // Returns whether the refresh was activated. 37 // Returns whether the refresh was activated.
38 void OnScrollEnd(const gfx::Vector2dF& velocity); 38 void OnScrollEnd(const gfx::Vector2dF& velocity);
39 39
40 // Scroll ack listener. The effect will only be activated if the initial 40 // Scroll ack listener. The effect will only be activated if the controller
41 // updates go unconsumed. 41 // decides it can navigate based on the consumed result and
42 void OnScrollUpdateAck(bool was_consumed); 42 // scroll-boundary-behavior.
majidvp 2017/07/20 13:26:55 Similar to the previous comment let's try to speci
sunyunjia 2017/07/21 13:52:23 Done.
43 virtual void OnOverscrolled(bool can_navigate);
43 44
44 // Returns true if the effect has consumed the |scroll_delta|. 45 // Returns true if the effect has consumed the |scroll_delta|.
45 bool WillHandleScrollUpdate(const gfx::Vector2dF& scroll_delta); 46 bool WillHandleScrollUpdate(const gfx::Vector2dF& scroll_delta);
46 47
47 // Release the effect (if active), preventing any associated refresh action. 48 // Release the effect (if active), preventing any associated refresh action.
48 void ReleaseWithoutActivation(); 49 void ReleaseWithoutActivation();
49 50
50 // Notify the effect of the latest scroll offset and overflow properties. 51 // Notify the effect of the latest scroll offset and overflow properties.
51 // The effect will be disabled when the offset is non-zero or overflow is 52 // The effect will be disabled when the offset is non-zero or overflow is
52 // hidden. Note: All dimensions are in device pixels. 53 // hidden. Note: All dimensions are in device pixels.
53 void OnFrameUpdated(const gfx::Vector2dF& content_scroll_offset, 54 void OnFrameUpdated(const gfx::Vector2dF& content_scroll_offset,
54 bool root_overflow_y_hidden); 55 bool root_overflow_y_hidden);
55 56
56 // Reset the effect to its inactive state, immediately detaching and 57 // Reset the effect to its inactive state, immediately detaching and
57 // disabling any active effects. 58 // disabling any active effects.
58 void Reset(); 59 void Reset();
59 60
60 // Returns true if the refresh effect is either being manipulated or animated. 61 // Returns true if the refresh effect is either being manipulated or animated.
61 bool IsActive() const; 62 virtual bool IsActive() const;
62 63
63 // Returns true if the effect is waiting for an unconsumed scroll to start. 64 // Returns true if the effect is waiting for an unconsumed scroll to start.
64 bool IsAwaitingScrollUpdateAck() const; 65 virtual bool IsAwaitingScrollUpdateAck() const;
65 66
66 private: 67 private:
67 void Release(bool allow_refresh); 68 void Release(bool allow_refresh);
68 69
69 bool scrolled_to_top_; 70 bool scrolled_to_top_;
70 bool overflow_y_hidden_; 71 bool overflow_y_hidden_;
71 72
72 enum ScrollConsumptionState { 73 enum ScrollConsumptionState {
73 DISABLED, 74 DISABLED,
74 AWAITING_SCROLL_UPDATE_ACK, 75 AWAITING_SCROLL_UPDATE_ACK,
75 ENABLED, 76 ENABLED,
76 } scroll_consumption_state_; 77 } scroll_consumption_state_;
77 78
78 OverscrollRefreshHandler* const handler_; 79 OverscrollRefreshHandler* const handler_;
79 80
80 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh); 81 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh);
81 }; 82 };
82 83
83 } // namespace ui 84 } // namespace ui
84 85
85 #endif // UI_ANDROID_OVERSCROLL_REFRESH_H_ 86 #endif // UI_ANDROID_OVERSCROLL_REFRESH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698