OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_pointer_gesture.h" | 5 #include "content/browser/renderer_host/input/synthetic_pointer_action.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "third_party/WebKit/public/web/WebInputEvent.h" | 8 #include "third_party/WebKit/public/web/WebInputEvent.h" |
9 #include "ui/events/latency_info.h" | 9 #include "ui/events/latency_info.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 SyntheticPointerGesture::SyntheticPointerGesture( | 13 SyntheticPointerAction::SyntheticPointerAction( |
14 SyntheticGestureParams::GestureSourceType gesture_source_type, | 14 SyntheticGestureParams::GestureSourceType gesture_source_type, |
15 PointerActionType pointer_action_type, | 15 PointerActionType pointer_action_type, |
16 SyntheticPointer* synthetic_pointer, | 16 SyntheticPointer* synthetic_pointer, |
17 gfx::PointF position, | 17 gfx::PointF position, |
18 int index) | 18 int index) |
19 : gesture_source_type_(gesture_source_type), | 19 : gesture_source_type_(gesture_source_type), |
20 pointer_action_type_(pointer_action_type), | 20 pointer_action_type_(pointer_action_type), |
21 position_(position), | 21 position_(position), |
22 index_(index), | 22 index_(index), |
23 synthetic_pointer_(synthetic_pointer) {} | 23 synthetic_pointer_(synthetic_pointer) {} |
24 | 24 |
25 SyntheticPointerGesture::~SyntheticPointerGesture() {} | 25 SyntheticPointerAction::~SyntheticPointerAction() {} |
26 | 26 |
27 SyntheticGesture::Result SyntheticPointerGesture::ForwardInputEvents( | 27 SyntheticGesture::Result SyntheticPointerAction::ForwardInputEvents( |
28 const base::TimeTicks& timestamp, | 28 const base::TimeTicks& timestamp, |
29 SyntheticGestureTarget* target) { | 29 SyntheticGestureTarget* target) { |
30 if (gesture_source_type_ == SyntheticGestureParams::DEFAULT_INPUT) | 30 if (gesture_source_type_ == SyntheticGestureParams::DEFAULT_INPUT) |
31 gesture_source_type_ = target->GetDefaultSyntheticGestureSourceType(); | 31 gesture_source_type_ = target->GetDefaultSyntheticGestureSourceType(); |
32 | 32 |
33 DCHECK_NE(gesture_source_type_, SyntheticGestureParams::DEFAULT_INPUT); | 33 DCHECK_NE(gesture_source_type_, SyntheticGestureParams::DEFAULT_INPUT); |
34 | 34 |
35 ForwardTouchOrMouseInputEvents(timestamp, target); | 35 ForwardTouchOrMouseInputEvents(timestamp, target); |
36 return SyntheticGesture::GESTURE_FINISHED; | 36 return SyntheticGesture::GESTURE_FINISHED; |
37 } | 37 } |
38 | 38 |
39 void SyntheticPointerGesture::ForwardTouchOrMouseInputEvents( | 39 void SyntheticPointerAction::ForwardTouchOrMouseInputEvents( |
40 const base::TimeTicks& timestamp, | 40 const base::TimeTicks& timestamp, |
41 SyntheticGestureTarget* target) { | 41 SyntheticGestureTarget* target) { |
42 switch (pointer_action_type_) { | 42 switch (pointer_action_type_) { |
43 case SyntheticGesture::PRESS: | 43 case SyntheticGesture::PRESS: |
44 synthetic_pointer_->Press(position_.x(), position_.y(), target, | 44 synthetic_pointer_->Press(position_.x(), position_.y(), target, |
45 timestamp); | 45 timestamp); |
46 break; | 46 break; |
47 case SyntheticGesture::MOVE: | 47 case SyntheticGesture::MOVE: |
48 synthetic_pointer_->Move(index_, position_.x(), position_.y(), target, | 48 synthetic_pointer_->Move(index_, position_.x(), position_.y(), target, |
49 timestamp); | 49 timestamp); |
50 break; | 50 break; |
51 case SyntheticGesture::RELEASE: | 51 case SyntheticGesture::RELEASE: |
52 synthetic_pointer_->Release(index_, target, timestamp); | 52 synthetic_pointer_->Release(index_, target, timestamp); |
53 break; | 53 break; |
54 } | 54 } |
55 synthetic_pointer_->DispatchEvent(target, timestamp); | 55 synthetic_pointer_->DispatchEvent(target, timestamp); |
56 } | 56 } |
57 | 57 |
58 } // namespace content | 58 } // namespace content |
OLD | NEW |