1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/renderer_host/input/synthetic_mouse_pointer.h"
#include "content/browser/renderer_host/input/synthetic_gesture_target.h"
namespace content {
SyntheticMousePointer::SyntheticMousePointer() {}
SyntheticMousePointer::~SyntheticMousePointer() {}
void SyntheticMousePointer::DispatchEvent(SyntheticGestureTarget* target,
const base::TimeTicks& timestamp) {
mouse_event_.timeStampSeconds = ConvertTimestampToSeconds(timestamp);
target->DispatchInputEventToPlatform(mouse_event_);
}
int SyntheticMousePointer::Press(float x,
float y,
SyntheticGestureTarget* target,
const base::TimeTicks& timestamp) {
mouse_event_ = SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::MouseDown, x, y, 0);
mouse_event_.clickCount = 1;
return 0;
}
void SyntheticMousePointer::Move(int index,
float x,
float y,
SyntheticGestureTarget* target,
const base::TimeTicks& timestamp) {
mouse_event_ = SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::MouseMove, x, y, 0);
mouse_event_.button = blink::WebMouseEvent::ButtonLeft;
}
void SyntheticMousePointer::Release(int index,
SyntheticGestureTarget* target,
const base::TimeTicks& timestamp) {
mouse_event_ = SyntheticWebMouseEventBuilder::Build(
blink::WebInputEvent::MouseUp, mouse_event_.x, mouse_event_.y, 0);
mouse_event_.clickCount = 1;
}
} // namespace content
|