OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_ |
| 7 |
| 8 #include "content/browser/renderer_host/overscroll_controller.h" |
| 9 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
| 10 #include "content/browser/web_contents/web_contents_impl.h" |
| 11 #include "ui/aura_extra/image_window_delegate.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 // The window delegate for the overscroll window. This processes UI trackpad and |
| 16 // touch events and converts them to overscroll event. The delegate destroys |
| 17 // itself when the window is destroyed. |
| 18 class OverscrollWindowDelegate : public aura_extra::ImageWindowDelegate { |
| 19 public: |
| 20 OverscrollWindowDelegate(OverscrollControllerDelegate* delegate, |
| 21 const gfx::Image& image); |
| 22 |
| 23 private: |
| 24 FRIEND_TEST_ALL_PREFIXES(OverscrollWindowDelegateTest, BasicOverscrollModes); |
| 25 |
| 26 ~OverscrollWindowDelegate() override; |
| 27 |
| 28 // Starts the overscroll gesture. |
| 29 void StartOverscroll(); |
| 30 |
| 31 // Resets the overscroll state. |
| 32 void ResetOverscroll(); |
| 33 |
| 34 // Completes or resets the overscroll from the current state. |
| 35 void CompleteOrResetOverscroll(); |
| 36 |
| 37 // Updates the current horizontal overscroll. |
| 38 void UpdateOverscroll(float delta_x); |
| 39 |
| 40 // Overridden from ui::EventHandler. |
| 41 void OnKeyEvent(ui::KeyEvent* event) override; |
| 42 void OnMouseEvent(ui::MouseEvent* event) override; |
| 43 void OnScrollEvent(ui::ScrollEvent* event) override; |
| 44 void OnGestureEvent(ui::GestureEvent* event) override; |
| 45 |
| 46 // Delegate to which we forward overscroll events. |
| 47 OverscrollControllerDelegate* delegate_; |
| 48 |
| 49 // The current overscroll mode. |
| 50 OverscrollMode overscroll_mode_; |
| 51 |
| 52 // The latest delta_x scroll update. |
| 53 float delta_x_; |
| 54 |
| 55 // The ratio of overscroll at which we consider the overscroll completed. |
| 56 const float complete_threshold_ratio_; |
| 57 |
| 58 // The threshold for starting the overscroll gesture, for touchscreen or |
| 59 // touchpads. |
| 60 const float start_threshold_touchscreen_; |
| 61 const float start_threshold_touchpad_; |
| 62 |
| 63 // The threshold for starting the overscroll gesture for the current touch |
| 64 // input. |
| 65 float active_start_threshold_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(OverscrollWindowDelegate); |
| 68 }; |
| 69 |
| 70 } // namespace content |
| 71 |
| 72 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_ |
OLD | NEW |