| 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 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 10 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
| 11 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" | 11 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
| 12 #include "content/common/input_messages.h" | 12 #include "content/common/input_messages.h" |
| 13 #include "content/public/browser/render_widget_host.h" | 13 #include "content/public/browser/render_widget_host.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 SyntheticGestureController::SyntheticGestureController( | 17 SyntheticGestureController::SyntheticGestureController( |
| 18 std::unique_ptr<SyntheticGestureTarget> gesture_target) | 18 std::unique_ptr<SyntheticGestureTarget> gesture_target) |
| 19 : gesture_target_(std::move(gesture_target)) {} | 19 : gesture_target_(std::move(gesture_target)) { |
| 20 pointer_action_controller_.SetDefaultGestureSourceType( |
| 21 gesture_target_->GetDefaultSyntheticGestureSourceType()); |
| 22 } |
| 20 | 23 |
| 21 SyntheticGestureController::~SyntheticGestureController() {} | 24 SyntheticGestureController::~SyntheticGestureController() {} |
| 22 | 25 |
| 23 void SyntheticGestureController::QueueSyntheticGesture( | 26 void SyntheticGestureController::QueueSyntheticGesture( |
| 24 std::unique_ptr<SyntheticGesture> synthetic_gesture, | 27 std::unique_ptr<SyntheticGesture> synthetic_gesture, |
| 25 const OnGestureCompleteCallback& completion_callback) { | 28 const OnGestureCompleteCallback& completion_callback) { |
| 26 DCHECK(synthetic_gesture); | 29 DCHECK(synthetic_gesture); |
| 27 | 30 |
| 28 bool was_empty = pending_gesture_queue_.IsEmpty(); | 31 bool was_empty = pending_gesture_queue_.IsEmpty(); |
| 29 | 32 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const OnGestureCompleteCallback& completion_callback, | 89 const OnGestureCompleteCallback& completion_callback, |
| 87 SyntheticGesture::Result result) { | 90 SyntheticGesture::Result result) { |
| 88 DCHECK_NE(result, SyntheticGesture::GESTURE_RUNNING); | 91 DCHECK_NE(result, SyntheticGesture::GESTURE_RUNNING); |
| 89 TRACE_EVENT_ASYNC_END0("input,benchmark", | 92 TRACE_EVENT_ASYNC_END0("input,benchmark", |
| 90 "SyntheticGestureController::running", | 93 "SyntheticGestureController::running", |
| 91 &gesture); | 94 &gesture); |
| 92 | 95 |
| 93 completion_callback.Run(result); | 96 completion_callback.Run(result); |
| 94 } | 97 } |
| 95 | 98 |
| 99 std::unique_ptr<SyntheticGesture> |
| 100 SyntheticGestureController::CreateSyntheticPointerAction( |
| 101 const SyntheticPointerActionListParams& gesture_params) { |
| 102 return pointer_action_controller_.CreateSyntheticPointerAction( |
| 103 *SyntheticPointerActionListParams::Cast(&gesture_params)); |
| 104 } |
| 105 |
| 96 SyntheticGestureController::GestureAndCallbackQueue::GestureAndCallbackQueue() { | 106 SyntheticGestureController::GestureAndCallbackQueue::GestureAndCallbackQueue() { |
| 97 } | 107 } |
| 98 | 108 |
| 99 SyntheticGestureController::GestureAndCallbackQueue:: | 109 SyntheticGestureController::GestureAndCallbackQueue:: |
| 100 ~GestureAndCallbackQueue() { | 110 ~GestureAndCallbackQueue() { |
| 101 } | 111 } |
| 102 | 112 |
| 103 } // namespace content | 113 } // namespace content |
| OLD | NEW |