OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ |
6 #define CONTENT_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ | 6 #define CONTENT_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "cc/input/input_handler.h" | 11 #include "cc/input/input_handler.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "third_party/WebKit/public/web/WebActiveWheelFlingParameters.h" | 13 #include "third_party/WebKit/public/web/WebActiveWheelFlingParameters.h" |
14 #include "third_party/WebKit/public/web/WebInputEvent.h" | 14 #include "third_party/WebKit/public/web/WebInputEvent.h" |
15 #include "third_party/WebKit/public/platform/WebGestureCurve.h" | 15 #include "third_party/WebKit/public/platform/WebGestureCurve.h" |
16 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" | 16 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class InputHandlerProxyClient; | 20 class InputHandlerProxyClient; |
21 | 21 |
22 // This class is a proxy between the content input event filtering and the | 22 // This class is a proxy between the content input event filtering and the |
23 // compositor's input handling logic. InputHandlerProxy instances live entirely | 23 // compositor's input handling logic. InputHandlerProxy instances live entirely |
24 // on the compositor thread. Each InputHandler instance handles input events | 24 // on the compositor thread. Each InputHandler instance handles input events |
25 // intended for a specific WebWidget. | 25 // intended for a specific WebWidget. |
26 class CONTENT_EXPORT InputHandlerProxy | 26 class CONTENT_EXPORT InputHandlerProxy |
27 : public cc::InputHandlerClient, | 27 : public cc::InputHandlerClient, |
28 public NON_EXPORTED_BASE(WebKit::WebGestureCurveTarget) { | 28 public NON_EXPORTED_BASE(blink::WebGestureCurveTarget) { |
29 public: | 29 public: |
30 explicit InputHandlerProxy(cc::InputHandler* input_handler); | 30 explicit InputHandlerProxy(cc::InputHandler* input_handler); |
31 virtual ~InputHandlerProxy(); | 31 virtual ~InputHandlerProxy(); |
32 | 32 |
33 void SetClient(InputHandlerProxyClient* client); | 33 void SetClient(InputHandlerProxyClient* client); |
34 | 34 |
35 enum EventDisposition { | 35 enum EventDisposition { |
36 DID_HANDLE, | 36 DID_HANDLE, |
37 DID_NOT_HANDLE, | 37 DID_NOT_HANDLE, |
38 DROP_EVENT | 38 DROP_EVENT |
39 }; | 39 }; |
40 EventDisposition HandleInputEventWithLatencyInfo( | 40 EventDisposition HandleInputEventWithLatencyInfo( |
41 const WebKit::WebInputEvent& event, | 41 const blink::WebInputEvent& event, |
42 const ui::LatencyInfo& latency_info); | 42 const ui::LatencyInfo& latency_info); |
43 EventDisposition HandleInputEvent(const WebKit::WebInputEvent& event); | 43 EventDisposition HandleInputEvent(const blink::WebInputEvent& event); |
44 | 44 |
45 // cc::InputHandlerClient implementation. | 45 // cc::InputHandlerClient implementation. |
46 virtual void WillShutdown() OVERRIDE; | 46 virtual void WillShutdown() OVERRIDE; |
47 virtual void Animate(base::TimeTicks time) OVERRIDE; | 47 virtual void Animate(base::TimeTicks time) OVERRIDE; |
48 virtual void MainThreadHasStoppedFlinging() OVERRIDE; | 48 virtual void MainThreadHasStoppedFlinging() OVERRIDE; |
49 virtual void DidOverscroll(const cc::DidOverscrollParams& params) OVERRIDE; | 49 virtual void DidOverscroll(const cc::DidOverscrollParams& params) OVERRIDE; |
50 | 50 |
51 // WebKit::WebGestureCurveTarget implementation. | 51 // blink::WebGestureCurveTarget implementation. |
52 virtual void scrollBy(const WebKit::WebFloatSize& offset); | 52 virtual void scrollBy(const blink::WebFloatSize& offset); |
53 virtual void notifyCurrentFlingVelocity(const WebKit::WebFloatSize& velocity); | 53 virtual void notifyCurrentFlingVelocity(const blink::WebFloatSize& velocity); |
54 | 54 |
55 bool gesture_scroll_on_impl_thread_for_testing() const { | 55 bool gesture_scroll_on_impl_thread_for_testing() const { |
56 return gesture_scroll_on_impl_thread_; | 56 return gesture_scroll_on_impl_thread_; |
57 } | 57 } |
58 | 58 |
59 private: | 59 private: |
60 EventDisposition HandleGestureFling(const WebKit::WebGestureEvent& event); | 60 EventDisposition HandleGestureFling(const blink::WebGestureEvent& event); |
61 | 61 |
62 // Returns true if we scrolled by the increment. | 62 // Returns true if we scrolled by the increment. |
63 bool TouchpadFlingScroll(const WebKit::WebFloatSize& increment); | 63 bool TouchpadFlingScroll(const blink::WebFloatSize& increment); |
64 | 64 |
65 // Returns true if we actually had an active fling to cancel. | 65 // Returns true if we actually had an active fling to cancel. |
66 bool CancelCurrentFling(); | 66 bool CancelCurrentFling(); |
67 | 67 |
68 scoped_ptr<WebKit::WebGestureCurve> fling_curve_; | 68 scoped_ptr<blink::WebGestureCurve> fling_curve_; |
69 // Parameters for the active fling animation, stored in case we need to | 69 // Parameters for the active fling animation, stored in case we need to |
70 // transfer it out later. | 70 // transfer it out later. |
71 WebKit::WebActiveWheelFlingParameters fling_parameters_; | 71 blink::WebActiveWheelFlingParameters fling_parameters_; |
72 | 72 |
73 InputHandlerProxyClient* client_; | 73 InputHandlerProxyClient* client_; |
74 cc::InputHandler* input_handler_; | 74 cc::InputHandler* input_handler_; |
75 | 75 |
76 #ifndef NDEBUG | 76 #ifndef NDEBUG |
77 bool expect_scroll_update_end_; | 77 bool expect_scroll_update_end_; |
78 bool expect_pinch_update_end_; | 78 bool expect_pinch_update_end_; |
79 #endif | 79 #endif |
80 bool gesture_scroll_on_impl_thread_; | 80 bool gesture_scroll_on_impl_thread_; |
81 bool gesture_pinch_on_impl_thread_; | 81 bool gesture_pinch_on_impl_thread_; |
82 // This is always false when there are no flings on the main thread, but | 82 // This is always false when there are no flings on the main thread, but |
83 // conservative in the sense that we might not be actually flinging when it is | 83 // conservative in the sense that we might not be actually flinging when it is |
84 // true. | 84 // true. |
85 bool fling_may_be_active_on_main_thread_; | 85 bool fling_may_be_active_on_main_thread_; |
86 // The axes on which the current fling has overshot the bounds of the content. | 86 // The axes on which the current fling has overshot the bounds of the content. |
87 bool fling_overscrolled_horizontally_; | 87 bool fling_overscrolled_horizontally_; |
88 bool fling_overscrolled_vertically_; | 88 bool fling_overscrolled_vertically_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); | 90 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace content | 93 } // namespace content |
94 | 94 |
95 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ | 95 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ |
OLD | NEW |