Chromium Code Reviews| 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_CLIENT_IMPL_H_ | |
| 6 #define CONTENT_RENDERER_GPU_INPUT_HANDLER_CLIENT_IMPL_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 InputHandlerClientImplClient; | |
| 21 | |
| 22 class CONTENT_EXPORT InputHandlerClientImpl | |
|
danakj
2013/05/01 19:20:43
This seems like an InputHandlerProxy?
It proxys e
| |
| 23 : public cc::InputHandlerClient, | |
| 24 public WebKit::WebGestureCurveTarget { | |
| 25 public: | |
| 26 explicit InputHandlerClientImpl(cc::InputHandler* input_handler); | |
| 27 virtual ~InputHandlerClientImpl(); | |
| 28 | |
| 29 void SetClient(InputHandlerClientImplClient* 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 // Included for testing purposes. | |
| 41 bool gesture_scroll_on_impl_thread() const { | |
|
danakj
2013/05/01 19:20:43
name this BlahForTesting()?
| |
| 42 return gesture_scroll_on_impl_thread_; | |
| 43 } | |
| 44 | |
| 45 private: | |
| 46 enum EventDisposition { | |
| 47 DidHandle, | |
| 48 DidNotHandle, | |
| 49 DropEvent | |
| 50 }; | |
| 51 // This function processes the input event and determines the disposition, but | |
| 52 // does not make any calls out to the InputHandlerClientImplClient. Some input | |
| 53 // types defer to helpers. | |
| 54 EventDisposition HandleInputEventInternal(const WebKit::WebInputEvent& event); | |
| 55 | |
| 56 EventDisposition HandleGestureFling(const WebKit::WebGestureEvent& event); | |
| 57 | |
| 58 // Returns true if we scrolled by the increment. | |
| 59 bool touchpadFlingScroll(const WebKit::WebFloatSize& increment); | |
|
danakj
2013/05/01 19:20:43
webkit style non-virtual
| |
| 60 | |
| 61 // Returns true if we actually had an active fling to cancel. | |
| 62 bool CancelCurrentFling(); | |
| 63 | |
| 64 scoped_ptr<WebKit::WebGestureCurve> fling_curve_; | |
| 65 // Parameters for the active fling animation, stored in case we need to | |
| 66 // transfer it out later. | |
| 67 WebKit::WebActiveWheelFlingParameters fling_parameters_; | |
| 68 | |
| 69 InputHandlerClientImplClient* client_; | |
| 70 cc::InputHandler* input_handler_; | |
| 71 | |
| 72 #ifndef NDEBUG | |
| 73 bool expect_scroll_update_end_; | |
| 74 bool expect_pinch_update_end_; | |
| 75 #endif | |
| 76 bool gesture_scroll_on_impl_thread_; | |
| 77 bool gesture_pinch_on_impl_thread_; | |
| 78 // This is always false when there are no flings on the main thread, but | |
| 79 // conservative in the sense that we might not be actually flinging when it is | |
| 80 // true. | |
| 81 bool fling_active_on_main_thread_; | |
| 82 | |
| 83 DISALLOW_COPY_AND_ASSIGN(InputHandlerClientImpl); | |
| 84 }; | |
| 85 | |
| 86 } // namespace content | |
| 87 | |
| 88 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_CLIENT_IMPL_H_ | |
| OLD | NEW |