| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 // Temporary forwarding header |
| 6 #define CCInputHandler_h | 6 #include "cc/input_handler.h" |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include <wtf/PassOwnPtr.h> | |
| 10 | |
| 11 namespace cc { | |
| 12 | |
| 13 class IntPoint; | |
| 14 class IntSize; | |
| 15 | |
| 16 // The CCInputHandler is a way for the embedders to interact with | |
| 17 // the impl thread side of the compositor implementation. | |
| 18 // | |
| 19 // There is one CCInputHandler for every CCLayerTreeHost. It is | |
| 20 // created on the main thread and used only on the impl thread. | |
| 21 // | |
| 22 // The CCInputHandler is constructed with a CCInputHandlerClient, which is the | |
| 23 // interface by which the handler can manipulate the LayerTree. | |
| 24 class CCInputHandlerClient { | |
| 25 public: | |
| 26 enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored }; | |
| 27 enum ScrollInputType { Gesture, Wheel }; | |
| 28 | |
| 29 // Selects a layer to be scrolled at a given point in window coordinates. | |
| 30 // Returns ScrollStarted if the layer at the coordinates can be scrolled, | |
| 31 // ScrollOnMainThread if the scroll event should instead be delegated to the | |
| 32 // main thread, or ScrollIgnored if there is nothing to be scrolled at the | |
| 33 // given coordinates. | |
| 34 virtual ScrollStatus scrollBegin(const IntPoint&, ScrollInputType) = 0; | |
| 35 | |
| 36 // Scroll the selected layer starting at the given window coordinate. If | |
| 37 // there is no room to move the layer in the requested direction, its first | |
| 38 // ancestor layer that can be scrolled will be moved instead. Should only be | |
| 39 // called if scrollBegin() returned ScrollStarted. | |
| 40 virtual void scrollBy(const IntPoint&, const IntSize&) = 0; | |
| 41 | |
| 42 // Stop scrolling the selected layer. Should only be called if scrollBegin() | |
| 43 // returned ScrollStarted. | |
| 44 virtual void scrollEnd() = 0; | |
| 45 | |
| 46 virtual void pinchGestureBegin() = 0; | |
| 47 virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor)
= 0; | |
| 48 virtual void pinchGestureEnd() = 0; | |
| 49 | |
| 50 virtual void startPageScaleAnimation(const IntSize& targetPosition, | |
| 51 bool anchorPoint, | |
| 52 float pageScale, | |
| 53 double startTime, | |
| 54 double duration) = 0; | |
| 55 | |
| 56 // Request another callback to CCInputHandler::animate(). | |
| 57 virtual void scheduleAnimation() = 0; | |
| 58 | |
| 59 protected: | |
| 60 CCInputHandlerClient() { } | |
| 61 virtual ~CCInputHandlerClient() { } | |
| 62 | |
| 63 private: | |
| 64 DISALLOW_COPY_AND_ASSIGN(CCInputHandlerClient); | |
| 65 }; | |
| 66 | |
| 67 class CCInputHandler { | |
| 68 public: | |
| 69 virtual ~CCInputHandler() { } | |
| 70 | |
| 71 virtual void bindToClient(CCInputHandlerClient*) = 0; | |
| 72 virtual void animate(double monotonicTime) = 0; | |
| 73 | |
| 74 protected: | |
| 75 CCInputHandler() { } | |
| 76 | |
| 77 private: | |
| 78 DISALLOW_COPY_AND_ASSIGN(CCInputHandler); | |
| 79 }; | |
| 80 | |
| 81 } | |
| 82 | |
| 83 #endif | |
| OLD | NEW |