| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 if (!SetMouseEventButton(&event, button)) | 241 if (!SetMouseEventButton(&event, button)) |
| 242 return Response::InvalidParams("Invalid mouse button"); | 242 return Response::InvalidParams("Invalid mouse button"); |
| 243 | 243 |
| 244 event.x = x * page_scale_factor_; | 244 event.x = x * page_scale_factor_; |
| 245 event.y = y * page_scale_factor_; | 245 event.y = y * page_scale_factor_; |
| 246 event.windowX = x * page_scale_factor_; | 246 event.windowX = x * page_scale_factor_; |
| 247 event.windowY = y * page_scale_factor_; | 247 event.windowY = y * page_scale_factor_; |
| 248 event.globalX = x * page_scale_factor_; | 248 event.globalX = x * page_scale_factor_; |
| 249 event.globalY = y * page_scale_factor_; | 249 event.globalY = y * page_scale_factor_; |
| 250 event.clickCount = click_count ? *click_count : 0; | 250 event.clickCount = click_count ? *click_count : 0; |
| 251 event.pointerType = blink::WebPointerProperties::PointerType::Mouse; |
| 251 | 252 |
| 252 if (!host_) | 253 if (!host_) |
| 253 return Response::ServerError("Could not connect to view"); | 254 return Response::ServerError("Could not connect to view"); |
| 254 | 255 |
| 255 host_->Focus(); | 256 host_->Focus(); |
| 256 host_->ForwardMouseEvent(event); | 257 host_->ForwardMouseEvent(event); |
| 257 return Response::OK(); | 258 return Response::OK(); |
| 258 } | 259 } |
| 259 | 260 |
| 260 Response InputHandler::EmulateTouchFromMouseEvent(const std::string& type, | 261 Response InputHandler::EmulateTouchFromMouseEvent(const std::string& type, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 289 if (!SetMouseEventButton(event, &button)) | 290 if (!SetMouseEventButton(event, &button)) |
| 290 return Response::InvalidParams("Invalid mouse button"); | 291 return Response::InvalidParams("Invalid mouse button"); |
| 291 | 292 |
| 292 event->x = x; | 293 event->x = x; |
| 293 event->y = y; | 294 event->y = y; |
| 294 event->windowX = x; | 295 event->windowX = x; |
| 295 event->windowY = y; | 296 event->windowY = y; |
| 296 event->globalX = x; | 297 event->globalX = x; |
| 297 event->globalY = y; | 298 event->globalY = y; |
| 298 event->clickCount = click_count ? *click_count : 0; | 299 event->clickCount = click_count ? *click_count : 0; |
| 300 event->pointerType = blink::WebPointerProperties::PointerType::Touch; |
| 299 | 301 |
| 300 if (!host_) | 302 if (!host_) |
| 301 return Response::ServerError("Could not connect to view"); | 303 return Response::ServerError("Could not connect to view"); |
| 302 | 304 |
| 303 if (event->type == blink::WebInputEvent::MouseWheel) | 305 if (event->type == blink::WebInputEvent::MouseWheel) |
| 304 host_->ForwardWheelEvent(wheel_event); | 306 host_->ForwardWheelEvent(wheel_event); |
| 305 else | 307 else |
| 306 host_->ForwardMouseEvent(mouse_event); | 308 host_->ForwardMouseEvent(mouse_event); |
| 307 return Response::OK(); | 309 return Response::OK(); |
| 308 } | 310 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } else { | 514 } else { |
| 513 client_->SendError(command_id, | 515 client_->SendError(command_id, |
| 514 Response::InternalError(base::StringPrintf( | 516 Response::InternalError(base::StringPrintf( |
| 515 "Synthetic tap failed, result was %d", result))); | 517 "Synthetic tap failed, result was %d", result))); |
| 516 } | 518 } |
| 517 } | 519 } |
| 518 | 520 |
| 519 } // namespace input | 521 } // namespace input |
| 520 } // namespace devtools | 522 } // namespace devtools |
| 521 } // namespace content | 523 } // namespace content |
| OLD | NEW |