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

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

Issue 1419123002: android: move overscroll effects to ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix exports for component build Created 5 years, 2 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
« no previous file with comments | « ui/android/overscroll_glow.cc ('k') | ui/android/overscroll_refresh.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 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 UI_ANDROID_OVERSCROLL_REFRESH_H_
6 #define CONTENT_BROWSER_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 "content/common/content_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"
11 #include "ui/gfx/geometry/vector2d_f.h" 11 #include "ui/gfx/geometry/vector2d_f.h"
12 12
13 namespace content { 13 namespace ui {
14 14
15 class CONTENT_EXPORT OverscrollRefreshHandler { 15 class UI_ANDROID_EXPORT OverscrollRefreshHandler {
16 public: 16 public:
17 // Signals the start of an overscrolling pull. Returns whether the handler 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 18 // will consume the overscroll gesture, in which case it will receive the
19 // remaining pull updates. 19 // remaining pull updates.
20 virtual bool PullStart() = 0; 20 virtual bool PullStart() = 0;
21 21
22 // Signals a pull update, where |delta| is in device pixels. 22 // Signals a pull update, where |delta| is in device pixels.
23 virtual void PullUpdate(float delta) = 0; 23 virtual void PullUpdate(float delta) = 0;
24 24
25 // Signals the release of the pull, and whether the release is allowed to 25 // Signals the release of the pull, and whether the release is allowed to
26 // trigger the refresh action. 26 // trigger the refresh action.
27 virtual void PullRelease(bool allow_refresh) = 0; 27 virtual void PullRelease(bool allow_refresh) = 0;
28 28
29 // Reset the active pull state. 29 // Reset the active pull state.
30 virtual void PullReset() = 0; 30 virtual void PullReset() = 0;
31 31
32 protected: 32 protected:
33 virtual ~OverscrollRefreshHandler() {} 33 virtual ~OverscrollRefreshHandler() {}
34 }; 34 };
35 35
36 // Simple pull-to-refresh styled effect. Listens to scroll events, conditionally 36 // Simple pull-to-refresh styled effect. Listens to scroll events, conditionally
37 // activating when: 37 // activating when:
38 // 1) The scroll begins when the page's root layer 1) has no vertical scroll 38 // 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. 39 // offset and 2) lacks the overflow-y:hidden property.
40 // 2) The page doesn't consume the initial scroll events. 40 // 2) The page doesn't consume the initial scroll events.
41 // 3) The initial scroll direction is upward. 41 // 3) The initial scroll direction is upward.
42 // The actuall pull response, animation and action are delegated to the 42 // The actuall pull response, animation and action are delegated to the
43 // provided refresh handler. 43 // provided refresh handler.
44 class CONTENT_EXPORT OverscrollRefresh { 44 class UI_ANDROID_EXPORT OverscrollRefresh {
45 public: 45 public:
46 // Minmum number of overscrolling pull events required to activate the effect. 46 // Minmum number of overscrolling pull events required to activate the effect.
47 // Useful for avoiding accidental triggering when a scroll janks (is delayed), 47 // Useful for avoiding accidental triggering when a scroll janks (is delayed),
48 // capping the impulse per event. 48 // capping the impulse per event.
49 enum { kMinPullsToActivate = 3 }; 49 enum { kMinPullsToActivate = 3 };
50 50
51 explicit OverscrollRefresh(OverscrollRefreshHandler* handler); 51 explicit OverscrollRefresh(OverscrollRefreshHandler* handler);
52 ~OverscrollRefresh(); 52 ~OverscrollRefresh();
53 53
54 // Scroll event stream listening methods. 54 // Scroll event stream listening methods.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 ENABLED, 94 ENABLED,
95 } scroll_consumption_state_; 95 } scroll_consumption_state_;
96 96
97 OverscrollRefreshHandler* const handler_; 97 OverscrollRefreshHandler* const handler_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh); 99 DISALLOW_COPY_AND_ASSIGN(OverscrollRefresh);
100 }; 100 };
101 101
102 } // namespace content 102 } // namespace content
103 103
104 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_REFRESH_H_ 104 #endif // UI_ANDROID_OVERSCROLL_REFRESH_H_
OLDNEW
« no previous file with comments | « ui/android/overscroll_glow.cc ('k') | ui/android/overscroll_refresh.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698