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 redirects trackpad events |
| 16 // to the web-contents window. The delegate destroys itself when the window is |
| 17 // destroyed. |
| 18 class OverscrollWindowDelegate : public aura_extra::ImageWindowDelegate { |
| 19 public: |
| 20 OverscrollWindowDelegate(OverscrollControllerDelegate* delegate, |
| 21 const gfx::Image& image); |
| 22 |
| 23 private: |
| 24 ~OverscrollWindowDelegate() override; |
| 25 |
| 26 // Starts the overscroll gesture. |
| 27 void StartOverscroll(); |
| 28 |
| 29 // Resets the overscroll state. |
| 30 void ResetOverscroll(); |
| 31 |
| 32 // Completes or resets the overscroll from the current state. |
| 33 void CompleteOrResetOverscroll(); |
| 34 |
| 35 // Updates the current horizontal overscroll. |
| 36 void UpdateOverscroll(float delta_x); |
| 37 |
| 38 // Overridden from ui::EventHandler. |
| 39 void OnKeyEvent(ui::KeyEvent* event) override; |
| 40 void OnMouseEvent(ui::MouseEvent* event) override; |
| 41 void OnScrollEvent(ui::ScrollEvent* event) override; |
| 42 void OnGestureEvent(ui::GestureEvent* event) override; |
| 43 |
| 44 // Delegate to which we forward overscroll events. |
| 45 OverscrollControllerDelegate* delegate_; |
| 46 |
| 47 // The current overscroll mode. |
| 48 OverscrollMode overscroll_mode_; |
| 49 |
| 50 // The latest delta_x scroll update. |
| 51 float delta_x_; |
| 52 |
| 53 // The ratio of overscroll at which we consider the overscroll completed. |
| 54 const int complete_threshold_ratio_; |
| 55 |
| 56 // The threshold for starting the overscroll gesture, for touchscreen or |
| 57 // touchpads. |
| 58 const float start_threshold_touchscreen_; |
| 59 const float start_threshold_touchpad_; |
| 60 |
| 61 // The threshold for starting the overscroll gesture for the current touch |
| 62 // input. |
| 63 float active_start_threshold_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(OverscrollWindowDelegate); |
| 66 }; |
| 67 |
| 68 } // namespace content |
| 69 |
| 70 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_WINDOW_DELEGATE_H_ |
OLD | NEW |