OLD | NEW |
| (Empty) |
1 // Copyright 2011 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 WebCompositorInputHandlerImpl_h | |
6 #define WebCompositorInputHandlerImpl_h | |
7 | |
8 #include "CCGestureCurve.h" | |
9 #include "CCInputHandler.h" | |
10 #include "WebActiveWheelFlingParameters.h" | |
11 #include "WebCompositorInputHandler.h" | |
12 #include "WebInputEvent.h" | |
13 #include <public/WebCompositor.h> | |
14 #include <wtf/HashSet.h> | |
15 #include <wtf/Noncopyable.h> | |
16 #include <wtf/OwnPtr.h> | |
17 | |
18 namespace WTF { | |
19 class Mutex; | |
20 } | |
21 | |
22 namespace WebCore { | |
23 class IntPoint; | |
24 class CCGestureCurveTarget; | |
25 class CCInputHandlerClient; | |
26 class CCThread; | |
27 } | |
28 | |
29 namespace WebKit { | |
30 | |
31 class WebCompositorInputHandlerClient; | |
32 | |
33 class WebCompositorInputHandlerImpl : public WebCompositorInputHandler, public W
ebCore::CCInputHandler, public WebCore::CCGestureCurveTarget { | |
34 WTF_MAKE_NONCOPYABLE(WebCompositorInputHandlerImpl); | |
35 public: | |
36 static PassOwnPtr<WebCompositorInputHandlerImpl> create(WebCore::CCInputHand
lerClient*); | |
37 static WebCompositorInputHandler* fromIdentifier(int identifier); | |
38 | |
39 virtual ~WebCompositorInputHandlerImpl(); | |
40 | |
41 // WebCompositorInputHandler implementation. | |
42 virtual void setClient(WebCompositorInputHandlerClient*); | |
43 virtual void handleInputEvent(const WebInputEvent&); | |
44 | |
45 // WebCore::CCInputHandler implementation. | |
46 virtual int identifier() const; | |
47 virtual void animate(double monotonicTime); | |
48 | |
49 // WebCore::CCGestureCurveTarget implementation. | |
50 virtual void scrollBy(const WebCore::IntPoint&); | |
51 | |
52 private: | |
53 explicit WebCompositorInputHandlerImpl(WebCore::CCInputHandlerClient*); | |
54 | |
55 enum EventDisposition { DidHandle, DidNotHandle, DropEvent }; | |
56 // This function processes the input event and determines the disposition, b
ut does not make | |
57 // any calls out to the WebCompositorInputHandlerClient. Some input types de
fer to helpers. | |
58 EventDisposition handleInputEventInternal(const WebInputEvent&); | |
59 | |
60 EventDisposition handleGestureFling(const WebGestureEvent&); | |
61 | |
62 // Returns true if we actually had an active fling to cancel. | |
63 bool cancelCurrentFling(); | |
64 | |
65 OwnPtr<WebCore::CCActiveGestureAnimation> m_wheelFlingAnimation; | |
66 // Parameters for the active fling animation, stored in case we need to tran
sfer it out later. | |
67 WebActiveWheelFlingParameters m_wheelFlingParameters; | |
68 | |
69 WebCompositorInputHandlerClient* m_client; | |
70 int m_identifier; | |
71 WebCore::CCInputHandlerClient* m_inputHandlerClient; | |
72 | |
73 #ifndef NDEBUG | |
74 bool m_expectScrollUpdateEnd; | |
75 bool m_expectPinchUpdateEnd; | |
76 #endif | |
77 bool m_gestureScrollStarted; | |
78 | |
79 static int s_nextAvailableIdentifier; | |
80 static HashSet<WebCompositorInputHandlerImpl*>* s_compositors; | |
81 }; | |
82 | |
83 } | |
84 | |
85 #endif // WebCompositorImpl_h | |
OLD | NEW |