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 <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> |
11 | 12 |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/scoped_vector.h" | |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 16 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "content/common/input/synthetic_gesture_params.h" | 18 #include "content/common/input/synthetic_gesture_params.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class SyntheticGestureTarget; | 22 class SyntheticGestureTarget; |
23 | 23 |
24 // Controls a synthetic gesture. | 24 // Controls a synthetic gesture. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 ~GestureAndCallbackQueue(); | 60 ~GestureAndCallbackQueue(); |
61 void Push(std::unique_ptr<SyntheticGesture> gesture, | 61 void Push(std::unique_ptr<SyntheticGesture> gesture, |
62 const OnGestureCompleteCallback& callback) { | 62 const OnGestureCompleteCallback& callback) { |
63 gestures_.push_back(std::move(gesture)); | 63 gestures_.push_back(std::move(gesture)); |
64 callbacks_.push(callback); | 64 callbacks_.push(callback); |
65 } | 65 } |
66 void Pop() { | 66 void Pop() { |
67 gestures_.erase(gestures_.begin()); | 67 gestures_.erase(gestures_.begin()); |
68 callbacks_.pop(); | 68 callbacks_.pop(); |
69 } | 69 } |
70 SyntheticGesture* FrontGesture() { | 70 SyntheticGesture* FrontGesture() { return gestures_.front().get(); } |
71 return gestures_.front(); | |
72 } | |
73 OnGestureCompleteCallback& FrontCallback() { | 71 OnGestureCompleteCallback& FrontCallback() { |
74 return callbacks_.front(); | 72 return callbacks_.front(); |
75 } | 73 } |
76 bool IsEmpty() { | 74 bool IsEmpty() { |
77 CHECK(gestures_.empty() == callbacks_.empty()); | 75 CHECK(gestures_.empty() == callbacks_.empty()); |
78 return gestures_.empty(); | 76 return gestures_.empty(); |
79 } | 77 } |
80 private: | 78 private: |
81 ScopedVector<SyntheticGesture> gestures_; | 79 std::vector<std::unique_ptr<SyntheticGesture>> gestures_; |
82 std::queue<OnGestureCompleteCallback> callbacks_; | 80 std::queue<OnGestureCompleteCallback> callbacks_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(GestureAndCallbackQueue); |
83 } pending_gesture_queue_; | 83 } pending_gesture_queue_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController); | 85 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace content | 88 } // namespace content |
89 | 89 |
90 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ | 90 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_ |
OLD | NEW |