| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/renderer_host/input/synthetic_mouse_pointer.h" | |
| 6 | |
| 7 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | |
| 8 | |
| 9 namespace content { | |
| 10 | |
| 11 SyntheticMousePointer::SyntheticMousePointer() {} | |
| 12 | |
| 13 SyntheticMousePointer::~SyntheticMousePointer() {} | |
| 14 | |
| 15 void SyntheticMousePointer::DispatchEvent(SyntheticGestureTarget* target, | |
| 16 const base::TimeTicks& timestamp) { | |
| 17 mouse_event_.timeStampSeconds = ConvertTimestampToSeconds(timestamp); | |
| 18 target->DispatchInputEventToPlatform(mouse_event_); | |
| 19 } | |
| 20 | |
| 21 int SyntheticMousePointer::Press(float x, | |
| 22 float y, | |
| 23 SyntheticGestureTarget* target, | |
| 24 const base::TimeTicks& timestamp) { | |
| 25 mouse_event_ = SyntheticWebMouseEventBuilder::Build( | |
| 26 blink::WebInputEvent::MouseDown, x, y, 0); | |
| 27 mouse_event_.clickCount = 1; | |
| 28 return 0; | |
| 29 } | |
| 30 | |
| 31 void SyntheticMousePointer::Move(int index, | |
| 32 float x, | |
| 33 float y, | |
| 34 SyntheticGestureTarget* target, | |
| 35 const base::TimeTicks& timestamp) { | |
| 36 blink::WebMouseEvent::Button button = mouse_event_.button; | |
| 37 int click_count = mouse_event_.clickCount; | |
| 38 mouse_event_ = SyntheticWebMouseEventBuilder::Build( | |
| 39 blink::WebInputEvent::MouseMove, x, y, 0); | |
| 40 mouse_event_.button = button; | |
| 41 mouse_event_.clickCount = click_count; | |
| 42 } | |
| 43 | |
| 44 void SyntheticMousePointer::Release(int index, | |
| 45 SyntheticGestureTarget* target, | |
| 46 const base::TimeTicks& timestamp) { | |
| 47 mouse_event_ = SyntheticWebMouseEventBuilder::Build( | |
| 48 blink::WebInputEvent::MouseUp, mouse_event_.x, mouse_event_.y, 0); | |
| 49 mouse_event_.clickCount = 1; | |
| 50 } | |
| 51 | |
| 52 SyntheticGestureParams::GestureSourceType SyntheticMousePointer::SourceType() | |
| 53 const { | |
| 54 return SyntheticGestureParams::MOUSE_INPUT; | |
| 55 } | |
| 56 | |
| 57 } // namespace content | |
| OLD | NEW |