| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 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 CCInputHandler_h | 5 #ifndef CCInputHandler_h |
| 6 #define CCInputHandler_h | 6 #define CCInputHandler_h |
| 7 | 7 |
| 8 #include <wtf/Noncopyable.h> | 8 #include <wtf/Noncopyable.h> |
| 9 #include <wtf/PassOwnPtr.h> | 9 #include <wtf/PassOwnPtr.h> |
| 10 | 10 |
| 11 namespace WebCore { | 11 namespace WebCore { |
| 12 | 12 |
| 13 class CCActiveGestureAnimation; | |
| 14 class CCGestureCurveTarget; | |
| 15 class IntPoint; | 13 class IntPoint; |
| 16 class IntSize; | 14 class IntSize; |
| 17 | 15 |
| 18 // The CCInputHandler is a way for the embedders to interact with | 16 // The CCInputHandler is a way for the embedders to interact with |
| 19 // the impl thread side of the compositor implementation. | 17 // the impl thread side of the compositor implementation. |
| 20 // | 18 // |
| 21 // There is one CCInputHandler for every CCLayerTreeHost. It is | 19 // There is one CCInputHandler for every CCLayerTreeHost. It is |
| 22 // created and used only on the impl thread. | 20 // created on the main thread and used only on the impl thread. |
| 23 // | 21 // |
| 24 // The CCInputHandler is constructed with an InputHandlerClient, which is the | 22 // The CCInputHandler is constructed with a CCInputHandlerClient, which is the |
| 25 // interface by which the handler can manipulate the LayerTree. | 23 // interface by which the handler can manipulate the LayerTree. |
| 26 class CCInputHandlerClient { | 24 class CCInputHandlerClient { |
| 27 WTF_MAKE_NONCOPYABLE(CCInputHandlerClient); | 25 WTF_MAKE_NONCOPYABLE(CCInputHandlerClient); |
| 28 public: | 26 public: |
| 29 enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored }; | 27 enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored }; |
| 30 enum ScrollInputType { Gesture, Wheel }; | 28 enum ScrollInputType { Gesture, Wheel }; |
| 31 | 29 |
| 32 // Selects a layer to be scrolled at a given point in window coordinates. | 30 // Selects a layer to be scrolled at a given point in window coordinates. |
| 33 // Returns ScrollStarted if the layer at the coordinates can be scrolled, | 31 // Returns ScrollStarted if the layer at the coordinates can be scrolled, |
| 34 // ScrollOnMainThread if the scroll event should instead be delegated to the | 32 // ScrollOnMainThread if the scroll event should instead be delegated to the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 49 virtual void pinchGestureBegin() = 0; | 47 virtual void pinchGestureBegin() = 0; |
| 50 virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor)
= 0; | 48 virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor)
= 0; |
| 51 virtual void pinchGestureEnd() = 0; | 49 virtual void pinchGestureEnd() = 0; |
| 52 | 50 |
| 53 virtual void startPageScaleAnimation(const IntSize& targetPosition, | 51 virtual void startPageScaleAnimation(const IntSize& targetPosition, |
| 54 bool anchorPoint, | 52 bool anchorPoint, |
| 55 float pageScale, | 53 float pageScale, |
| 56 double startTime, | 54 double startTime, |
| 57 double duration) = 0; | 55 double duration) = 0; |
| 58 | 56 |
| 59 virtual CCActiveGestureAnimation* activeGestureAnimation() = 0; | |
| 60 virtual void setActiveGestureAnimation(PassOwnPtr<CCActiveGestureAnimation>)
= 0; | |
| 61 | |
| 62 // Request another callback to CCInputHandler::animate(). | 57 // Request another callback to CCInputHandler::animate(). |
| 63 virtual void scheduleAnimation() = 0; | 58 virtual void scheduleAnimation() = 0; |
| 64 | 59 |
| 65 protected: | 60 protected: |
| 66 CCInputHandlerClient() { } | 61 CCInputHandlerClient() { } |
| 67 virtual ~CCInputHandlerClient() { } | 62 virtual ~CCInputHandlerClient() { } |
| 68 }; | 63 }; |
| 69 | 64 |
| 70 class CCInputHandler { | 65 class CCInputHandler { |
| 71 WTF_MAKE_NONCOPYABLE(CCInputHandler); | 66 WTF_MAKE_NONCOPYABLE(CCInputHandler); |
| 72 public: | 67 public: |
| 73 static PassOwnPtr<CCInputHandler> create(CCInputHandlerClient*); | |
| 74 virtual ~CCInputHandler() { } | 68 virtual ~CCInputHandler() { } |
| 75 | 69 |
| 76 virtual int identifier() const = 0; | 70 virtual void bindToClient(CCInputHandlerClient*) = 0; |
| 77 virtual void animate(double monotonicTime) = 0; | 71 virtual void animate(double monotonicTime) = 0; |
| 78 | 72 |
| 79 protected: | 73 protected: |
| 80 CCInputHandler() { } | 74 CCInputHandler() { } |
| 81 }; | 75 }; |
| 82 | 76 |
| 83 } | 77 } |
| 84 | 78 |
| 85 #endif | 79 #endif |
| OLD | NEW |