| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 typedef base::Callback<void(SyntheticGesture::Result)> | 32 typedef base::Callback<void(SyntheticGesture::Result)> |
| 33 OnGestureCompleteCallback; | 33 OnGestureCompleteCallback; |
| 34 void QueueSyntheticGesture( | 34 void QueueSyntheticGesture( |
| 35 scoped_ptr<SyntheticGesture> synthetic_gesture, | 35 scoped_ptr<SyntheticGesture> synthetic_gesture, |
| 36 const OnGestureCompleteCallback& completion_callback); | 36 const OnGestureCompleteCallback& completion_callback); |
| 37 | 37 |
| 38 // Forward input events of the currently processed gesture. | 38 // Forward input events of the currently processed gesture. |
| 39 void Flush(base::TimeTicks timestamp); | 39 void Flush(base::TimeTicks timestamp); |
| 40 | 40 |
| 41 // To be called when all events generated from the current gesture have been |
| 42 // fully flushed from the input pipeline (i.e., sent, processed and ack'ed). |
| 43 void OnDidFlushInput(); |
| 44 |
| 41 private: | 45 private: |
| 42 void StartGesture(const SyntheticGesture& gesture); | 46 void StartGesture(const SyntheticGesture& gesture); |
| 43 void StopGesture(const SyntheticGesture& gesture, | 47 void StopGesture(const SyntheticGesture& gesture, |
| 44 const OnGestureCompleteCallback& completion_callback, | 48 const OnGestureCompleteCallback& completion_callback, |
| 45 SyntheticGesture::Result result); | 49 SyntheticGesture::Result result); |
| 46 | 50 |
| 47 scoped_ptr<SyntheticGestureTarget> gesture_target_; | 51 scoped_ptr<SyntheticGestureTarget> gesture_target_; |
| 52 scoped_ptr<SyntheticGesture::Result> pending_gesture_result_; |
| 48 | 53 |
| 49 // A queue of gesture/callback pairs. Implemented as two queues to | 54 // A queue of gesture/callback pairs. Implemented as two queues to |
| 50 // simplify the ownership of SyntheticGesture pointers. | 55 // simplify the ownership of SyntheticGesture pointers. |
| 51 class GestureAndCallbackQueue { | 56 class GestureAndCallbackQueue { |
| 52 public: | 57 public: |
| 53 GestureAndCallbackQueue(); | 58 GestureAndCallbackQueue(); |
| 54 ~GestureAndCallbackQueue(); | 59 ~GestureAndCallbackQueue(); |
| 55 void Push(scoped_ptr<SyntheticGesture> gesture, | 60 void Push(scoped_ptr<SyntheticGesture> gesture, |
| 56 const OnGestureCompleteCallback& callback) { | 61 const OnGestureCompleteCallback& callback) { |
| 57 gestures_.push_back(gesture.release()); | 62 gestures_.push_back(gesture.release()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 75 ScopedVector<SyntheticGesture> gestures_; | 80 ScopedVector<SyntheticGesture> gestures_; |
| 76 std::queue<OnGestureCompleteCallback> callbacks_; | 81 std::queue<OnGestureCompleteCallback> callbacks_; |
| 77 } pending_gesture_queue_; | 82 } pending_gesture_queue_; |
| 78 | 83 |
| 79 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController); | 84 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController); |
| 80 }; | 85 }; |
| 81 | 86 |
| 82 } // namespace content | 87 } // namespace content |
| 83 | 88 |
| 84 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ | 89 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ |
| OLD | NEW |