| 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/frame_host/render_frame_host_impl.h" | 15 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 15 #include "content/browser/renderer_host/render_widget_host_impl.h" | 16 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 16 #include "content/common/input/synthetic_pinch_gesture_params.h" | 17 #include "content/common/input/synthetic_pinch_gesture_params.h" |
| 17 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" | 18 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
| 18 #include "content/common/input/synthetic_tap_gesture_params.h" | 19 #include "content/common/input/synthetic_tap_gesture_params.h" |
| 19 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 20 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 20 #include "ui/events/keycodes/dom/keycode_converter.h" | 21 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 21 #include "ui/gfx/geometry/point.h" | 22 #include "ui/gfx/geometry/point.h" |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 callback->sendSuccess(); | 174 callback->sendSuccess(); |
| 174 } else { | 175 } else { |
| 175 callback->sendFailure(Response::Error( | 176 callback->sendFailure(Response::Error( |
| 176 base::StringPrintf("Synthetic scroll failed, result was %d", result))); | 177 base::StringPrintf("Synthetic scroll failed, result was %d", result))); |
| 177 } | 178 } |
| 178 } | 179 } |
| 179 | 180 |
| 180 } // namespace | 181 } // namespace |
| 181 | 182 |
| 182 InputHandler::InputHandler() | 183 InputHandler::InputHandler() |
| 183 : host_(NULL), | 184 : DevToolsDomainHandler(Input::Metainfo::domainName), |
| 185 host_(nullptr), |
| 184 page_scale_factor_(1.0), | 186 page_scale_factor_(1.0), |
| 185 last_id_(0), | 187 last_id_(0), |
| 186 weak_factory_(this) { | 188 weak_factory_(this) { |
| 187 } | 189 } |
| 188 | 190 |
| 189 InputHandler::~InputHandler() { | 191 InputHandler::~InputHandler() { |
| 190 } | 192 } |
| 191 | 193 |
| 194 // static |
| 195 InputHandler* InputHandler::FromSession(DevToolsSession* session) { |
| 196 return static_cast<InputHandler*>( |
| 197 session->GetHandlerByName(Input::Metainfo::domainName)); |
| 198 } |
| 199 |
| 192 void InputHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { | 200 void InputHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { |
| 193 host_ = host; | 201 host_ = host; |
| 194 } | 202 } |
| 195 | 203 |
| 196 void InputHandler::Wire(UberDispatcher* dispatcher) { | 204 void InputHandler::Wire(UberDispatcher* dispatcher) { |
| 197 Input::Dispatcher::wire(dispatcher, this); | 205 Input::Dispatcher::wire(dispatcher, this); |
| 198 } | 206 } |
| 199 | 207 |
| 200 void InputHandler::OnSwapCompositorFrame( | 208 void InputHandler::OnSwapCompositorFrame( |
| 201 const cc::CompositorFrameMetadata& frame_metadata) { | 209 const cc::CompositorFrameMetadata& frame_metadata) { |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 for (int i = 0; i < count; i++) { | 541 for (int i = 0; i < count; i++) { |
| 534 host_->GetRenderWidgetHost()->QueueSyntheticGesture( | 542 host_->GetRenderWidgetHost()->QueueSyntheticGesture( |
| 535 SyntheticGesture::Create(gesture_params), | 543 SyntheticGesture::Create(gesture_params), |
| 536 base::Bind(&TapGestureResponse::OnGestureResult, | 544 base::Bind(&TapGestureResponse::OnGestureResult, |
| 537 base::Unretained(response))); | 545 base::Unretained(response))); |
| 538 } | 546 } |
| 539 } | 547 } |
| 540 | 548 |
| 541 } // namespace protocol | 549 } // namespace protocol |
| 542 } // namespace content | 550 } // namespace content |
| OLD | NEW |