| Index: content/browser/renderer_host/input/synthetic_mouse_driver.cc
|
| diff --git a/content/browser/renderer_host/input/synthetic_mouse_driver.cc b/content/browser/renderer_host/input/synthetic_mouse_driver.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..108b44932bbb4c18d026a66171d1f5f91a8e5582
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/input/synthetic_mouse_driver.cc
|
| @@ -0,0 +1,64 @@
|
| +// 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_driver.h"
|
| +
|
| +#include "content/browser/renderer_host/input/synthetic_gesture_target.h"
|
| +
|
| +namespace content {
|
| +
|
| +SyntheticMouseDriver::SyntheticMouseDriver() : mouse_index_(-1) {}
|
| +
|
| +SyntheticMouseDriver::~SyntheticMouseDriver() {}
|
| +
|
| +void SyntheticMouseDriver::DispatchEvent(SyntheticGestureTarget* target,
|
| + const base::TimeTicks& timestamp) {
|
| + mouse_event_.timeStampSeconds = ConvertTimestampToSeconds(timestamp);
|
| + target->DispatchInputEventToPlatform(mouse_event_);
|
| +}
|
| +
|
| +int SyntheticMouseDriver::Press(int index,
|
| + float x,
|
| + float y,
|
| + SyntheticGestureTarget* target,
|
| + const base::TimeTicks& timestamp) {
|
| + mouse_event_ = SyntheticWebMouseEventBuilder::Build(
|
| + blink::WebInputEvent::MouseDown, x, y, 0);
|
| + mouse_event_.clickCount = 1;
|
| + mouse_index_ = 0;
|
| + return 0;
|
| +}
|
| +
|
| +void SyntheticMouseDriver::Move(int index,
|
| + float x,
|
| + float y,
|
| + SyntheticGestureTarget* target,
|
| + const base::TimeTicks& timestamp) {
|
| + blink::WebMouseEvent::Button button = mouse_event_.button;
|
| + int click_count = mouse_event_.clickCount;
|
| + mouse_event_ = SyntheticWebMouseEventBuilder::Build(
|
| + blink::WebInputEvent::MouseMove, x, y, 0);
|
| + mouse_event_.button = button;
|
| + mouse_event_.clickCount = click_count;
|
| +}
|
| +
|
| +void SyntheticMouseDriver::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;
|
| + mouse_index_ = -1;
|
| +}
|
| +
|
| +SyntheticGestureParams::GestureSourceType SyntheticMouseDriver::SourceType()
|
| + const {
|
| + return SyntheticGestureParams::MOUSE_INPUT;
|
| +}
|
| +
|
| +int SyntheticMouseDriver::GetPointIndex(int index) const {
|
| + return mouse_index_;
|
| +}
|
| +
|
| +} // namespace content
|
|
|