Chromium Code Reviews| 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/hash_tables.h" | 9 #include "base/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 "content/port/common/input_event_ack_state.h" | |
| 13 #include "third_party/WebKit/public/platform/WebGestureCurve.h" | 14 #include "third_party/WebKit/public/platform/WebGestureCurve.h" |
| 14 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" | 15 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingPa rameters.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebActiveWheelFlingPa rameters.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| 20 class InputHandlerProxyClient; | 21 class InputHandlerProxyClient; |
| 21 | 22 |
| 22 // This class is a proxy between the content input event filtering and the | 23 // This class is a proxy between the content input event filtering and the |
| 23 // compositor's input handling logic. InputHandlerProxy instances live entirely | 24 // compositor's input handling logic. InputHandlerProxy instances live entirely |
| 24 // on the compositor thread. Each InputHandler instance handles input events | 25 // on the compositor thread. Each InputHandler instance handles input events |
| 25 // intended for a specific WebWidget. | 26 // intended for a specific WebWidget. |
| 26 class CONTENT_EXPORT InputHandlerProxy | 27 class CONTENT_EXPORT InputHandlerProxy |
| 27 : public cc::InputHandlerClient, | 28 : public cc::InputHandlerClient, |
| 28 public NON_EXPORTED_BASE(WebKit::WebGestureCurveTarget) { | 29 public NON_EXPORTED_BASE(WebKit::WebGestureCurveTarget) { |
| 29 public: | 30 public: |
| 30 explicit InputHandlerProxy(cc::InputHandler* input_handler); | 31 explicit InputHandlerProxy(cc::InputHandler* input_handler); |
| 31 virtual ~InputHandlerProxy(); | 32 virtual ~InputHandlerProxy(); |
| 32 | 33 |
| 33 void SetClient(InputHandlerProxyClient* client); | 34 void SetClient(InputHandlerProxyClient* client); |
| 34 void HandleInputEvent(const WebKit::WebInputEvent& event); | 35 |
| 36 enum EventDisposition { | |
| 37 EVENT_DISPOSITION_DID_HANDLE, | |
|
jamesr
2013/06/03 22:07:44
nit: the whole "put the enum name in the enum valu
jdduke (slow)
2013/06/03 22:31:03
Oh heck yes. I'll update.
| |
| 38 EVENT_DISPOSITION_DID_NOT_HANDLE, | |
| 39 EVENT_DISPOSITION_DROP_EVENT | |
| 40 }; | |
| 41 EventDisposition HandleInputEvent(const WebKit::WebInputEvent& event); | |
| 35 | 42 |
| 36 // cc::InputHandlerClient implementation. | 43 // cc::InputHandlerClient implementation. |
| 37 virtual void WillShutdown() OVERRIDE; | 44 virtual void WillShutdown() OVERRIDE; |
| 38 virtual void Animate(base::TimeTicks time) OVERRIDE; | 45 virtual void Animate(base::TimeTicks time) OVERRIDE; |
| 39 virtual void MainThreadHasStoppedFlinging() OVERRIDE; | 46 virtual void MainThreadHasStoppedFlinging() OVERRIDE; |
| 40 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, | 47 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, |
| 41 gfx::Vector2dF current_fling_velocity) OVERRIDE; | 48 gfx::Vector2dF current_fling_velocity) OVERRIDE; |
| 42 | 49 |
| 43 // WebKit::WebGestureCurveTarget implementation. | 50 // WebKit::WebGestureCurveTarget implementation. |
| 44 virtual void scrollBy(const WebKit::WebFloatSize& offset); | 51 virtual void scrollBy(const WebKit::WebFloatSize& offset); |
| 45 virtual void notifyCurrentFlingVelocity(const WebKit::WebFloatSize& velocity); | 52 virtual void notifyCurrentFlingVelocity(const WebKit::WebFloatSize& velocity); |
| 46 | 53 |
| 47 bool gesture_scroll_on_impl_thread_for_testing() const { | 54 bool gesture_scroll_on_impl_thread_for_testing() const { |
| 48 return gesture_scroll_on_impl_thread_; | 55 return gesture_scroll_on_impl_thread_; |
| 49 } | 56 } |
| 50 | 57 |
| 51 private: | 58 private: |
| 52 enum EventDisposition { | |
| 53 DidHandle, | |
| 54 DidNotHandle, | |
| 55 DropEvent | |
| 56 }; | |
| 57 // This function processes the input event and determines the disposition, but | 59 // This function processes the input event and determines the disposition, but |
| 58 // does not make any calls out to the InputHandlerProxyClient. Some input | 60 // does not make any calls out to the InputHandlerProxyClient. Some input |
| 59 // types defer to helpers. | 61 // types defer to helpers. |
| 60 EventDisposition HandleInputEventInternal(const WebKit::WebInputEvent& event); | 62 EventDisposition HandleInputEventInternal(const WebKit::WebInputEvent& event); |
| 61 | 63 |
| 62 EventDisposition HandleGestureFling(const WebKit::WebGestureEvent& event); | 64 EventDisposition HandleGestureFling(const WebKit::WebGestureEvent& event); |
| 63 | 65 |
| 64 // Returns true if we scrolled by the increment. | 66 // Returns true if we scrolled by the increment. |
| 65 bool TouchpadFlingScroll(const WebKit::WebFloatSize& increment); | 67 bool TouchpadFlingScroll(const WebKit::WebFloatSize& increment); |
| 66 | 68 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 85 // conservative in the sense that we might not be actually flinging when it is | 87 // conservative in the sense that we might not be actually flinging when it is |
| 86 // true. | 88 // true. |
| 87 bool fling_may_be_active_on_main_thread_; | 89 bool fling_may_be_active_on_main_thread_; |
| 88 | 90 |
| 89 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); | 91 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); |
| 90 }; | 92 }; |
| 91 | 93 |
| 92 } // namespace content | 94 } // namespace content |
| 93 | 95 |
| 94 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ | 96 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_PROXY_H_ |
| OLD | NEW |