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

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

Issue 2528823002: Separate SwipeRefreshHandler and ContentViewCore (Closed)
Patch Set: Make boliu's requested changes Created 4 years 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/overscroll_refresh_handler.h"
9 #include "ui/android/ui_android_export.h" 10 #include "ui/android/ui_android_export.h"
10 #include "ui/gfx/geometry/size_f.h" 11 #include "ui/gfx/geometry/size_f.h"
11 #include "ui/gfx/geometry/vector2d_f.h" 12 #include "ui/gfx/geometry/vector2d_f.h"
12 13
13 namespace ui { 14 namespace ui {
14 15
15 class UI_ANDROID_EXPORT OverscrollRefreshHandler {
16 public:
17 // Signals the start of an overscrolling pull. Returns whether the handler
18 // will consume the overscroll gesture, in which case it will receive the
19 // remaining pull updates.
20 virtual bool PullStart() = 0;
21
22 // Signals a pull update, where |delta| is in device pixels.
23 virtual void PullUpdate(float delta) = 0;
24
25 // Signals the release of the pull, and whether the release is allowed to
26 // trigger the refresh action.
27 virtual void PullRelease(bool allow_refresh) = 0;
28
29 // Reset the active pull state.
30 virtual void PullReset() = 0;
31
32 protected:
33 virtual ~OverscrollRefreshHandler() {}
34 };
35
36 // Simple pull-to-refresh styled effect. Listens to scroll events, conditionally 16 // Simple pull-to-refresh styled effect. Listens to scroll events, conditionally
37 // activating when: 17 // activating when:
38 // 1) The scroll begins when the page's root layer 1) has no vertical scroll 18 // 1) The scroll begins when the page's root layer 1) has no vertical scroll
39 // offset and 2) lacks the overflow-y:hidden property. 19 // offset and 2) lacks the overflow-y:hidden property.
40 // 2) The page doesn't consume the initial scroll events. 20 // 2) The page doesn't consume the initial scroll events.
41 // 3) The initial scroll direction is upward. 21 // 3) The initial scroll direction is upward.
42 // The actuall pull response, animation and action are delegated to the 22 // The actuall pull response, animation and action are delegated to the
43 // provided refresh handler. 23 // provided refresh handler.
44 class UI_ANDROID_EXPORT OverscrollRefresh { 24 class UI_ANDROID_EXPORT OverscrollRefresh {
45 public: 25 public:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 67
88 bool scrolled_to_top_; 68 bool scrolled_to_top_;
89 bool overflow_y_hidden_; 69 bool overflow_y_hidden_;
90 70
91 enum ScrollConsumptionState { 71 enum ScrollConsumptionState {
92 DISABLED, 72 DISABLED,
93 AWAITING_SCROLL_UPDATE_ACK, 73 AWAITING_SCROLL_UPDATE_ACK,
94 ENABLED, 74 ENABLED,
95 } scroll_consumption_state_; 75 } scroll_consumption_state_;
96 76
97 OverscrollRefreshHandler* const handler_; 77 OverscrollRefreshHandler* handler_;
boliu 2016/12/06 00:58:16 can stay const I think?
rlanday 2016/12/06 03:25:26 Yep
98 78
99 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh); 79 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh);
100 }; 80 };
101 81
102 } // namespace content 82 } // namespace content
103 83
104 #endif // UI_ANDROID_OVERSCROLL_REFRESH_H_ 84 #endif // UI_ANDROID_OVERSCROLL_REFRESH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698