OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ | |
6 #define CONTENT_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/hash_tables.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "cc/input/input_handler.h" | |
12 #include "content/common/content_export.h" | |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurve.h" | |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurveTarg et.h" | |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingPa rameters.h" | |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | |
17 | |
18 namespace content { | |
19 | |
20 class InputHandlerProxyClient; | |
21 | |
22 class CONTENT_EXPORT InputHandlerProxy | |
danakj
2013/05/06 16:33:39
It took me a while to figure out these things are
| |
23 : public cc::InputHandlerClient, | |
24 public NON_EXPORTED_BASE(WebKit::WebGestureCurveTarget) { | |
25 public: | |
26 explicit InputHandlerProxy(cc::InputHandler* input_handler); | |
27 virtual ~InputHandlerProxy(); | |
28 | |
29 void SetClient(InputHandlerProxyClient* client); | |
30 void HandleInputEvent(const WebKit::WebInputEvent& event); | |
31 | |
32 // cc::InputHandlerClient implementation. | |
33 virtual void Animate(base::TimeTicks time) OVERRIDE; | |
34 virtual void MainThreadHasStoppedFlinging() OVERRIDE; | |
35 | |
36 // WebKit::WebGestureCurveTarget implementation. | |
37 virtual void scrollBy(const WebKit::WebFloatSize& offset); | |
38 virtual void notifyCurrentFlingVelocity(const WebKit::WebFloatSize& velocity); | |
39 | |
40 bool gesture_scroll_on_impl_thread_for_testing() const { | |
41 return gesture_scroll_on_impl_thread_; | |
42 } | |
43 | |
44 private: | |
45 enum EventDisposition { | |
46 DidHandle, | |
47 DidNotHandle, | |
48 DropEvent | |
49 }; | |
50 // This function processes the input event and determines the disposition, but | |
51 // does not make any calls out to the InputHandlerProxyClient. Some input | |
52 // types defer to helpers. | |
53 EventDisposition HandleInputEventInternal(const WebKit::WebInputEvent& event); | |
54 | |
55 EventDisposition HandleGestureFling(const WebKit::WebGestureEvent& event); | |
56 | |
57 // Returns true if we scrolled by the increment. | |
58 bool TouchpadFlingScroll(const WebKit::WebFloatSize& increment); | |
59 | |
60 // Returns true if we actually had an active fling to cancel. | |
61 bool CancelCurrentFling(); | |
62 | |
63 scoped_ptr<WebKit::WebGestureCurve> fling_curve_; | |
64 // Parameters for the active fling animation, stored in case we need to | |
65 // transfer it out later. | |
66 WebKit::WebActiveWheelFlingParameters fling_parameters_; | |
67 | |
68 InputHandlerProxyClient* client_; | |
69 cc::InputHandler* input_handler_; | |
70 | |
71 #ifndef NDEBUG | |
72 bool expect_scroll_update_end_; | |
73 bool expect_pinch_update_end_; | |
74 #endif | |
75 bool gesture_scroll_on_impl_thread_; | |
76 bool gesture_pinch_on_impl_thread_; | |
77 // This is always false when there are no flings on the main thread, but | |
78 // conservative in the sense that we might not be actually flinging when it is | |
79 // true. | |
80 bool fling_active_on_main_thread_; | |
danakj
2013/05/06 16:33:39
fling_may_be_active_on_main_thread_ ?
| |
81 | |
82 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); | |
83 }; | |
84 | |
85 } // namespace content | |
86 | |
87 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ | |
OLD | NEW |