| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/protocol/input_handler.h" | 5 #include "content/browser/devtools/protocol/input_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "cc/output/compositor_frame_metadata.h" | 13 #include "cc/output/compositor_frame_metadata.h" |
| 14 #include "content/browser/devtools/devtools_session.h" | 14 #include "content/browser/devtools/devtools_session.h" |
| 15 #include "content/browser/frame_host/render_frame_host_impl.h" | 15 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 16 #include "content/browser/renderer_host/render_widget_host_impl.h" | 16 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 17 #include "content/common/input/synthetic_pinch_gesture_params.h" | 17 #include "content/common/input/synthetic_pinch_gesture_params.h" |
| 18 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" | 18 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
| 19 #include "content/common/input/synthetic_tap_gesture_params.h" | 19 #include "content/common/input/synthetic_tap_gesture_params.h" |
| 20 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 20 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 21 #include "ui/events/blink/web_input_event_traits.h" |
| 21 #include "ui/events/keycodes/dom/keycode_converter.h" | 22 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 22 #include "ui/gfx/geometry/point.h" | 23 #include "ui/gfx/geometry/point.h" |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 namespace protocol { | 26 namespace protocol { |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 gfx::PointF CssPixelsToPointF(int x, int y, float page_scale_factor) { | 30 gfx::PointF CssPixelsToPointF(int x, int y, float page_scale_factor) { |
| 30 return gfx::PointF(x * page_scale_factor, y * page_scale_factor); | 31 return gfx::PointF(x * page_scale_factor, y * page_scale_factor); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 base::StringPrintf("Unexpected event type '%s'", type.c_str())); | 411 base::StringPrintf("Unexpected event type '%s'", type.c_str())); |
| 411 } | 412 } |
| 412 } | 413 } |
| 413 | 414 |
| 414 blink::WebPointerProperties::Button event_button = | 415 blink::WebPointerProperties::Button event_button = |
| 415 blink::WebPointerProperties::Button::NoButton; | 416 blink::WebPointerProperties::Button::NoButton; |
| 416 int button_modifiers = 0; | 417 int button_modifiers = 0; |
| 417 if (!GetMouseEventButton(button, &event_button, &button_modifiers)) | 418 if (!GetMouseEventButton(button, &event_button, &button_modifiers)) |
| 418 return Response::InvalidParams("Invalid mouse button"); | 419 return Response::InvalidParams("Invalid mouse button"); |
| 419 | 420 |
| 420 blink::WebScopedInputEvent event; | 421 ui::WebScopedInputEvent event; |
| 421 blink::WebMouseWheelEvent* wheel_event = nullptr; | 422 blink::WebMouseWheelEvent* wheel_event = nullptr; |
| 422 blink::WebMouseEvent* mouse_event = nullptr; | 423 blink::WebMouseEvent* mouse_event = nullptr; |
| 423 if (type == Input::EmulateTouchFromMouseEvent::TypeEnum::MouseWheel) { | 424 if (type == Input::EmulateTouchFromMouseEvent::TypeEnum::MouseWheel) { |
| 424 wheel_event = new blink::WebMouseWheelEvent( | 425 wheel_event = new blink::WebMouseWheelEvent( |
| 425 event_type, GetEventModifiers( | 426 event_type, GetEventModifiers( |
| 426 modifiers.fromMaybe(blink::WebInputEvent::NoModifiers), | 427 modifiers.fromMaybe(blink::WebInputEvent::NoModifiers), |
| 427 false, false) | | 428 false, false) | |
| 428 button_modifiers, | 429 button_modifiers, |
| 429 GetEventTimestamp(timestamp)); | 430 GetEventTimestamp(timestamp)); |
| 430 mouse_event = wheel_event; | 431 mouse_event = wheel_event; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 for (auto& callback : pending_key_callbacks_) | 644 for (auto& callback : pending_key_callbacks_) |
| 644 callback->sendSuccess(); | 645 callback->sendSuccess(); |
| 645 pending_key_callbacks_.clear(); | 646 pending_key_callbacks_.clear(); |
| 646 for (auto& callback : pending_mouse_callbacks_) | 647 for (auto& callback : pending_mouse_callbacks_) |
| 647 callback->sendSuccess(); | 648 callback->sendSuccess(); |
| 648 pending_mouse_callbacks_.clear(); | 649 pending_mouse_callbacks_.clear(); |
| 649 } | 650 } |
| 650 | 651 |
| 651 } // namespace protocol | 652 } // namespace protocol |
| 652 } // namespace content | 653 } // namespace content |
| OLD | NEW |