Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1171)

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture_controller.cc

Issue 1884883005: Prepare SyntheticPointerAction to handle touch actions for multiple fingers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests for mouse and change type of params_list Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
30 pending_gesture_queue_.Push(std::move(synthetic_gesture), 33 pending_gesture_queue_.Push(std::move(synthetic_gesture),
31 completion_callback); 34 completion_callback);
32 35
33 if (was_empty) 36 if (was_empty)
34 StartGesture(*pending_gesture_queue_.FrontGesture()); 37 StartGesture(*pending_gesture_queue_.FrontGesture());
35 } 38 }
36 39
40 void SyntheticGestureController::QueueSyntheticPointerAction(
41 const SyntheticPointerActionParams& gesture_params,
42 const OnGestureCompleteCallback& completion_callback) {
43 std::unique_ptr<SyntheticGesture> synthetic_gesture =
44 pointer_action_controller_.CreateSyntheticPointerAction(gesture_params);
45 if (synthetic_gesture)
46 QueueSyntheticGesture(std::move(synthetic_gesture), completion_callback);
47 }
48
49 void SyntheticGestureController::ResetSyntheticPointer() {
50 pointer_action_controller_.ResetSyntheticPointer();
51 }
52
37 void SyntheticGestureController::Flush(base::TimeTicks timestamp) { 53 void SyntheticGestureController::Flush(base::TimeTicks timestamp) {
38 TRACE_EVENT0("input", "SyntheticGestureController::Flush"); 54 TRACE_EVENT0("input", "SyntheticGestureController::Flush");
39 if (pending_gesture_queue_.IsEmpty()) 55 if (pending_gesture_queue_.IsEmpty())
40 return; 56 return;
41 57
42 if (pending_gesture_result_) 58 if (pending_gesture_result_)
43 return; 59 return;
44 60
45 SyntheticGesture* gesture = pending_gesture_queue_.FrontGesture(); 61 SyntheticGesture* gesture = pending_gesture_queue_.FrontGesture();
46 SyntheticGesture::Result result = 62 SyntheticGesture::Result result =
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 110 }
95 111
96 SyntheticGestureController::GestureAndCallbackQueue::GestureAndCallbackQueue() { 112 SyntheticGestureController::GestureAndCallbackQueue::GestureAndCallbackQueue() {
97 } 113 }
98 114
99 SyntheticGestureController::GestureAndCallbackQueue:: 115 SyntheticGestureController::GestureAndCallbackQueue::
100 ~GestureAndCallbackQueue() { 116 ~GestureAndCallbackQueue() {
101 } 117 }
102 118
103 } // namespace content 119 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698