| 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 "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/browser/android/overscroll_glow.h" | 9 #include "content/browser/android/overscroll_glow.h" |
| 10 #include "content/browser/android/overscroll_refresh.h" | 10 #include "content/browser/android/overscroll_refresh.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class WindowAndroidCompositor; | 25 class WindowAndroidCompositor; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 | 29 |
| 30 struct DidOverscrollParams; | 30 struct DidOverscrollParams; |
| 31 | 31 |
| 32 // Glue class for handling all inputs into Android-specific overscroll effects, | 32 // Glue class for handling all inputs into Android-specific overscroll effects, |
| 33 // both the passive overscroll glow and the active overscroll pull-to-refresh. | 33 // both the passive overscroll glow and the active overscroll pull-to-refresh. |
| 34 // Note that all input coordinates (both for events and overscroll) are in DIPs. | 34 // Note that all input coordinates (both for events and overscroll) are in DIPs. |
| 35 class OverscrollControllerAndroid : public OverscrollRefreshClient, | 35 class OverscrollControllerAndroid : public OverscrollGlowClient, |
| 36 public OverscrollRefreshClient, |
| 36 public WebContentsObserver { | 37 public WebContentsObserver { |
| 37 public: | 38 public: |
| 38 OverscrollControllerAndroid(WebContents* web_contents, | 39 OverscrollControllerAndroid(WebContents* web_contents, |
| 39 ui::WindowAndroidCompositor* compositor, | 40 ui::WindowAndroidCompositor* compositor, |
| 40 float dpi_scale); | 41 float dpi_scale); |
| 41 virtual ~OverscrollControllerAndroid(); | 42 virtual ~OverscrollControllerAndroid(); |
| 42 | 43 |
| 43 // Returns true if |event| is consumed by an overscroll effect, in which | 44 // Returns true if |event| is consumed by an overscroll effect, in which |
| 44 // case it should cease propagation. | 45 // case it should cease propagation. |
| 45 bool WillHandleGestureEvent(const blink::WebGestureEvent& event); | 46 bool WillHandleGestureEvent(const blink::WebGestureEvent& event); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 // WebContentsObserver implementation. | 68 // WebContentsObserver implementation. |
| 68 void DidNavigateMainFrame(const LoadCommittedDetails& details, | 69 void DidNavigateMainFrame(const LoadCommittedDetails& details, |
| 69 const FrameNavigateParams& params) override; | 70 const FrameNavigateParams& params) override; |
| 70 | 71 |
| 71 // OverscrollRefreshClient implementation. | 72 // OverscrollRefreshClient implementation. |
| 72 void TriggerRefresh() override; | 73 void TriggerRefresh() override; |
| 73 bool IsStillRefreshing() const override; | 74 bool IsStillRefreshing() const override; |
| 74 | 75 |
| 76 // OverscrollGlowClient implementation. |
| 77 scoped_ptr<EdgeEffectBase> CreateEdgeEffect() override; |
| 78 |
| 75 void SetNeedsAnimate(); | 79 void SetNeedsAnimate(); |
| 76 | 80 |
| 77 ui::WindowAndroidCompositor* compositor_; | 81 ui::WindowAndroidCompositor* compositor_; |
| 78 const float dpi_scale_; | 82 const float dpi_scale_; |
| 79 | 83 |
| 80 bool enabled_; | 84 bool enabled_; |
| 81 | 85 |
| 82 // 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. |
| 83 OverscrollGlow glow_effect_; | 87 scoped_ptr<OverscrollGlow> glow_effect_; |
| 84 OverscrollRefresh refresh_effect_; | 88 scoped_ptr<OverscrollRefresh> refresh_effect_; |
| 85 bool triggered_refresh_active_; | 89 bool triggered_refresh_active_; |
| 86 | 90 |
| 87 DISALLOW_COPY_AND_ASSIGN(OverscrollControllerAndroid); | 91 DISALLOW_COPY_AND_ASSIGN(OverscrollControllerAndroid); |
| 88 }; | 92 }; |
| 89 | 93 |
| 90 } // namespace content | 94 } // namespace content |
| 91 | 95 |
| 92 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_CONTROLLER_ANDROID_H_ | 96 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_CONTROLLER_ANDROID_H_ |
| OLD | NEW |