| 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 "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 9 #include "third_party/WebKit/public/web/WebInputEvent.h" | 9 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 namespace devtools { | 12 namespace devtools { |
| 13 namespace input { | 13 namespace input { |
| 14 | 14 |
| 15 typedef DevToolsProtocolClient::Response Response; | 15 typedef DevToolsProtocolClient::Response Response; |
| 16 | 16 |
| 17 InputHandler::InputHandler() | 17 InputHandler::InputHandler() |
| 18 : host_(NULL) { | 18 : host_(NULL) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 InputHandler::~InputHandler() { | 21 InputHandler::~InputHandler() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 void InputHandler::SetRenderViewHost(RenderViewHostImpl* host) { | 24 void InputHandler::SetRenderViewHost(RenderViewHostImpl* host) { |
| 25 host_ = host; | 25 host_ = host; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void InputHandler::SetClient(scoped_ptr<DevToolsProtocolClient> client) { |
| 29 } |
| 30 |
| 28 Response InputHandler::EmulateTouchFromMouseEvent(const std::string& type, | 31 Response InputHandler::EmulateTouchFromMouseEvent(const std::string& type, |
| 29 int x, | 32 int x, |
| 30 int y, | 33 int y, |
| 31 double timestamp, | 34 double timestamp, |
| 32 const std::string& button, | 35 const std::string& button, |
| 33 double* delta_x, | 36 double* delta_x, |
| 34 double* delta_y, | 37 double* delta_y, |
| 35 int* modifiers, | 38 int* modifiers, |
| 36 int* click_count) { | 39 int* click_count) { |
| 37 blink::WebMouseWheelEvent wheel_event; | 40 blink::WebMouseWheelEvent wheel_event; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 if (!host_) | 102 if (!host_) |
| 100 return Response::ServerError("Could not connect to view"); | 103 return Response::ServerError("Could not connect to view"); |
| 101 | 104 |
| 102 if (event->type == blink::WebInputEvent::MouseWheel) | 105 if (event->type == blink::WebInputEvent::MouseWheel) |
| 103 host_->ForwardWheelEvent(wheel_event); | 106 host_->ForwardWheelEvent(wheel_event); |
| 104 else | 107 else |
| 105 host_->ForwardMouseEvent(mouse_event); | 108 host_->ForwardMouseEvent(mouse_event); |
| 106 return Response::OK(); | 109 return Response::OK(); |
| 107 } | 110 } |
| 108 | 111 |
| 112 Response InputHandler::SynthesizePinchGesture( |
| 113 DevToolsCommandId command_id, |
| 114 int x, |
| 115 int y, |
| 116 double scale_factor, |
| 117 const int* relative_speed, |
| 118 const std::string* gesture_source_type) { |
| 119 return Response::InternalError("Not yet implemented"); |
| 120 } |
| 121 |
| 122 Response InputHandler::SynthesizeScrollGesture( |
| 123 DevToolsCommandId command_id, |
| 124 int x, |
| 125 int y, |
| 126 const int* x_distance, |
| 127 const int* y_distance, |
| 128 const int* x_overscroll, |
| 129 const int* y_overscroll, |
| 130 const bool* prevent_fling, |
| 131 const int* speed, |
| 132 const std::string* gesture_source_type) { |
| 133 return Response::InternalError("Not yet implemented"); |
| 134 } |
| 135 |
| 136 Response InputHandler::SynthesizeTapGesture( |
| 137 DevToolsCommandId command_id, |
| 138 int x, |
| 139 int y, |
| 140 const int* duration, |
| 141 const int* tap_count, |
| 142 const std::string* gesture_source_type) { |
| 143 return Response::InternalError("Not yet implemented"); |
| 144 } |
| 145 |
| 109 } // namespace input | 146 } // namespace input |
| 110 } // namespace devtools | 147 } // namespace devtools |
| 111 } // namespace content | 148 } // namespace content |
| OLD | NEW |