| 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: |
| 41 OverscrollControllerAndroid(ui::OverscrollGlow* glow_effect, |
| 42 ui::OverscrollRefresh* refresh_effect, |
| 43 ui::WindowAndroidCompositor* compositor, |
| 44 float dpi_scale); |
| 39 OverscrollControllerAndroid( | 45 OverscrollControllerAndroid( |
| 40 ui::OverscrollRefreshHandler* overscroll_refresh_handler, | 46 ui::OverscrollRefreshHandler* overscroll_refresh_handler, |
| 41 ui::WindowAndroidCompositor* compositor, | 47 ui::WindowAndroidCompositor* compositor, |
| 42 float dpi_scale); | 48 float dpi_scale); |
| 43 ~OverscrollControllerAndroid() override; | 49 ~OverscrollControllerAndroid() override; |
| 44 | 50 |
| 45 // Returns true if |event| is consumed by an overscroll effect, in which | 51 // Returns true if |event| is consumed by an overscroll effect, in which |
| 46 // case it should cease propagation. | 52 // case it should cease propagation. |
| 47 bool WillHandleGestureEvent(const blink::WebGestureEvent& event); | 53 bool WillHandleGestureEvent(const blink::WebGestureEvent& event); |
| 48 | 54 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 68 private: | 74 private: |
| 69 // OverscrollGlowClient implementation. | 75 // OverscrollGlowClient implementation. |
| 70 std::unique_ptr<ui::EdgeEffectBase> CreateEdgeEffect() override; | 76 std::unique_ptr<ui::EdgeEffectBase> CreateEdgeEffect() override; |
| 71 | 77 |
| 72 void SetNeedsAnimate(); | 78 void SetNeedsAnimate(); |
| 73 | 79 |
| 74 ui::WindowAndroidCompositor* const compositor_; | 80 ui::WindowAndroidCompositor* const compositor_; |
| 75 const float dpi_scale_; | 81 const float dpi_scale_; |
| 76 | 82 |
| 77 bool enabled_; | 83 bool enabled_; |
| 84 bool scroll_update_consumed_; |
| 78 | 85 |
| 79 // TODO(jdduke): Factor out a common API from the two overscroll effects. | 86 // TODO(jdduke): Factor out a common API from the two overscroll effects. |
| 80 std::unique_ptr<ui::OverscrollGlow> glow_effect_; | 87 std::unique_ptr<ui::OverscrollGlow> glow_effect_; |
| 81 std::unique_ptr<ui::OverscrollRefresh> refresh_effect_; | 88 std::unique_ptr<ui::OverscrollRefresh> refresh_effect_; |
| 82 | 89 |
| 83 DISALLOW_COPY_AND_ASSIGN(OverscrollControllerAndroid); | 90 DISALLOW_COPY_AND_ASSIGN(OverscrollControllerAndroid); |
| 84 }; | 91 }; |
| 85 | 92 |
| 86 } // namespace content | 93 } // namespace content |
| 87 | 94 |
| 88 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_CONTROLLER_ANDROID_H_ | 95 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_CONTROLLER_ANDROID_H_ |
| OLD | NEW |