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_CONTROLLER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_OVERSCROLL_CONTROLLER_ANDROID_H_ |
6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_CONTROLLER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_CONTROLLER_ANDROID_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "content/common/content_export.h" | |
13 #include "content/common/input/input_event_ack_state.h" | 14 #include "content/common/input/input_event_ack_state.h" |
14 #include "ui/android/overscroll_glow.h" | 15 #include "ui/android/overscroll_glow.h" |
15 #include "ui/android/overscroll_refresh.h" | 16 #include "ui/android/overscroll_refresh.h" |
16 #include "ui/gfx/geometry/vector2d_f.h" | 17 #include "ui/gfx/geometry/vector2d_f.h" |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 class WebGestureEvent; | 20 class WebGestureEvent; |
20 } | 21 } |
21 | 22 |
22 namespace cc { | 23 namespace cc { |
23 class CompositorFrameMetadata; | 24 class CompositorFrameMetadata; |
24 class Layer; | 25 class Layer; |
25 } | 26 } |
26 | 27 |
27 namespace ui { | 28 namespace ui { |
28 class WindowAndroidCompositor; | 29 class WindowAndroidCompositor; |
29 struct DidOverscrollParams; | 30 struct DidOverscrollParams; |
30 } | 31 } |
31 | 32 |
32 namespace content { | 33 namespace content { |
33 | 34 |
34 // Glue class for handling all inputs into Android-specific overscroll effects, | 35 // Glue class for handling all inputs into Android-specific overscroll effects, |
35 // both the passive overscroll glow and the active overscroll pull-to-refresh. | 36 // both the passive overscroll glow and the active overscroll pull-to-refresh. |
36 // Note that all input coordinates (both for events and overscroll) are in DIPs. | 37 // Note that all input coordinates (both for events and overscroll) are in DIPs. |
37 class OverscrollControllerAndroid : public ui::OverscrollGlowClient { | 38 class CONTENT_EXPORT OverscrollControllerAndroid |
39 : public ui::OverscrollGlowClient { | |
38 public: | 40 public: |
39 OverscrollControllerAndroid( | 41 OverscrollControllerAndroid( |
42 ui::WindowAndroidCompositor* compositor, | |
43 float dpi_scale, | |
44 std::unique_ptr<ui::OverscrollGlow> glow_effect, | |
45 std::unique_ptr<ui::OverscrollRefresh> refresh_effect); | |
46 OverscrollControllerAndroid( | |
40 ui::OverscrollRefreshHandler* overscroll_refresh_handler, | 47 ui::OverscrollRefreshHandler* overscroll_refresh_handler, |
41 ui::WindowAndroidCompositor* compositor, | 48 ui::WindowAndroidCompositor* compositor, |
42 float dpi_scale); | 49 float dpi_scale); |
43 ~OverscrollControllerAndroid() override; | 50 ~OverscrollControllerAndroid() override; |
44 | 51 |
45 // Returns true if |event| is consumed by an overscroll effect, in which | 52 // Returns true if |event| is consumed by an overscroll effect, in which |
46 // case it should cease propagation. | 53 // case it should cease propagation. |
47 bool WillHandleGestureEvent(const blink::WebGestureEvent& event); | 54 bool WillHandleGestureEvent(const blink::WebGestureEvent& event); |
48 | 55 |
49 // To be called upon receipt of a gesture event ack. | 56 // To be called upon receipt of a gesture event ack. |
(...skipping 18 matching lines...) Expand all Loading... | |
68 private: | 75 private: |
69 // OverscrollGlowClient implementation. | 76 // OverscrollGlowClient implementation. |
70 std::unique_ptr<ui::EdgeEffectBase> CreateEdgeEffect() override; | 77 std::unique_ptr<ui::EdgeEffectBase> CreateEdgeEffect() override; |
71 | 78 |
72 void SetNeedsAnimate(); | 79 void SetNeedsAnimate(); |
73 | 80 |
74 ui::WindowAndroidCompositor* const compositor_; | 81 ui::WindowAndroidCompositor* const compositor_; |
75 const float dpi_scale_; | 82 const float dpi_scale_; |
76 | 83 |
77 bool enabled_; | 84 bool enabled_; |
85 bool scroll_update_consumed_; | |
aelias_OOO_until_Jul13
2017/08/11 21:50:32
This is refresh-effect specific so it should be st
sunyunjia
2017/08/18 18:44:06
Done.
| |
78 | 86 |
79 // TODO(jdduke): Factor out a common API from the two overscroll effects. | 87 // TODO(jdduke): Factor out a common API from the two overscroll effects. |
80 std::unique_ptr<ui::OverscrollGlow> glow_effect_; | 88 std::unique_ptr<ui::OverscrollGlow> glow_effect_; |
81 std::unique_ptr<ui::OverscrollRefresh> refresh_effect_; | 89 std::unique_ptr<ui::OverscrollRefresh> refresh_effect_; |
82 | 90 |
83 DISALLOW_COPY_AND_ASSIGN(OverscrollControllerAndroid); | 91 DISALLOW_COPY_AND_ASSIGN(OverscrollControllerAndroid); |
84 }; | 92 }; |
85 | 93 |
86 } // namespace content | 94 } // namespace content |
87 | 95 |
88 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_CONTROLLER_ANDROID_H_ | 96 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_CONTROLLER_ANDROID_H_ |
OLD | NEW |