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