Chromium Code Reviews| 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 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" | 10 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
| 11 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 11 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| 12 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" | 12 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
| 13 #include "content/public/browser/render_widget_host.h" | |
| 13 #include "ui/gfx/geometry/size_f.h" | 14 #include "ui/gfx/geometry/size_f.h" |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 class CompositorFrameMetadata; | 17 class CompositorFrameMetadata; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 class RenderWidgetHostImpl; | 22 class RenderWidgetHostImpl; |
| 22 | 23 |
| 23 namespace devtools { | 24 namespace devtools { |
| 24 namespace input { | 25 namespace input { |
| 25 | 26 |
| 26 class InputHandler { | 27 class InputHandler : public RenderWidgetHost::InputEventObserver { |
| 27 public: | 28 public: |
| 28 typedef DevToolsProtocolClient::Response Response; | 29 typedef DevToolsProtocolClient::Response Response; |
| 29 | 30 |
| 30 InputHandler(); | 31 InputHandler(); |
| 31 virtual ~InputHandler(); | 32 ~InputHandler() override; |
| 33 | |
| 34 // InputEventObserver | |
| 35 void OnInputEvent(const blink::WebInputEvent& event) override; | |
|
dgozman
2016/11/21 19:14:39
We can probably move these to private.
samuong
2016/11/21 22:28:43
Done.
| |
| 36 void OnInputEventAck(const blink::WebInputEvent& event) override; | |
| 32 | 37 |
| 33 void SetRenderWidgetHost(RenderWidgetHostImpl* host); | 38 void SetRenderWidgetHost(RenderWidgetHostImpl* host); |
| 34 void SetClient(std::unique_ptr<Client> client); | 39 void SetClient(std::unique_ptr<Client> client); |
| 35 void OnSwapCompositorFrame(const cc::CompositorFrameMetadata& frame_metadata); | 40 void OnSwapCompositorFrame(const cc::CompositorFrameMetadata& frame_metadata); |
| 36 | 41 |
| 37 Response DispatchKeyEvent(const std::string& type, | 42 Response DispatchKeyEvent(DevToolsCommandId command_id, |
| 43 const std::string& type, | |
| 38 const int* modifiers, | 44 const int* modifiers, |
| 39 const double* timestamp, | 45 const double* timestamp, |
| 40 const std::string* text, | 46 const std::string* text, |
| 41 const std::string* unmodified_text, | 47 const std::string* unmodified_text, |
| 42 const std::string* key_identifier, | 48 const std::string* key_identifier, |
| 43 const std::string* code, | 49 const std::string* code, |
| 44 const std::string* key, | 50 const std::string* key, |
| 45 const int* windows_virtual_key_code, | 51 const int* windows_virtual_key_code, |
| 46 const int* native_virtual_key_code, | 52 const int* native_virtual_key_code, |
| 47 const bool* auto_repeat, | 53 const bool* auto_repeat, |
| 48 const bool* is_keypad, | 54 const bool* is_keypad, |
| 49 const bool* is_system_key); | 55 const bool* is_system_key); |
| 50 | 56 |
| 51 Response DispatchMouseEvent(const std::string& type, | 57 Response DispatchMouseEvent(DevToolsCommandId command_id, |
| 58 const std::string& type, | |
| 52 int x, | 59 int x, |
| 53 int y, | 60 int y, |
| 54 const int* modifiers, | 61 const int* modifiers, |
| 55 const double* timestamp, | 62 const double* timestamp, |
| 56 const std::string* button, | 63 const std::string* button, |
| 57 const int* click_count); | 64 const int* click_count); |
| 58 | 65 |
| 59 Response EmulateTouchFromMouseEvent(const std::string& type, | 66 Response EmulateTouchFromMouseEvent(const std::string& type, |
| 60 int x, | 67 int x, |
| 61 int y, | 68 int y, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 const int* tap_count, | 101 const int* tap_count, |
| 95 const std::string* gesture_source_type); | 102 const std::string* gesture_source_type); |
| 96 | 103 |
| 97 Response DispatchTouchEvent( | 104 Response DispatchTouchEvent( |
| 98 const std::string& type, | 105 const std::string& type, |
| 99 const std::vector<std::unique_ptr<base::DictionaryValue>>& touch_points, | 106 const std::vector<std::unique_ptr<base::DictionaryValue>>& touch_points, |
| 100 const int* modifiers, | 107 const int* modifiers, |
| 101 const double* timestamp); | 108 const double* timestamp); |
| 102 | 109 |
| 103 private: | 110 private: |
| 111 void SendDispatchKeyEventResponse(DevToolsCommandId command_id); | |
| 112 void SendDispatchMouseEventResponse(DevToolsCommandId command_id); | |
| 113 | |
| 104 void SendSynthesizePinchGestureResponse(DevToolsCommandId command_id, | 114 void SendSynthesizePinchGestureResponse(DevToolsCommandId command_id, |
| 105 SyntheticGesture::Result result); | 115 SyntheticGesture::Result result); |
| 106 | 116 |
| 107 void SendSynthesizeScrollGestureResponse(DevToolsCommandId command_id, | 117 void SendSynthesizeScrollGestureResponse(DevToolsCommandId command_id, |
| 108 SyntheticGesture::Result result); | 118 SyntheticGesture::Result result); |
| 109 | 119 |
| 110 void SendSynthesizeTapGestureResponse(DevToolsCommandId command_id, | 120 void SendSynthesizeTapGestureResponse(DevToolsCommandId command_id, |
| 111 bool send_success, | 121 bool send_success, |
| 112 SyntheticGesture::Result result); | 122 SyntheticGesture::Result result); |
| 113 | 123 |
| 114 void SynthesizeRepeatingScroll( | 124 void SynthesizeRepeatingScroll( |
| 115 SyntheticSmoothScrollGestureParams gesture_params, | 125 SyntheticSmoothScrollGestureParams gesture_params, |
| 116 int repeat_count, | 126 int repeat_count, |
| 117 base::TimeDelta repeat_delay, | 127 base::TimeDelta repeat_delay, |
| 118 std::string interaction_marker_name, | 128 std::string interaction_marker_name, |
| 119 DevToolsCommandId command_id); | 129 DevToolsCommandId command_id); |
| 120 | 130 |
| 121 void OnScrollFinished(SyntheticSmoothScrollGestureParams gesture_params, | 131 void OnScrollFinished(SyntheticSmoothScrollGestureParams gesture_params, |
| 122 int repeat_count, | 132 int repeat_count, |
| 123 base::TimeDelta repeat_delay, | 133 base::TimeDelta repeat_delay, |
| 124 std::string interaction_marker_name, | 134 std::string interaction_marker_name, |
| 125 DevToolsCommandId command_id, | 135 DevToolsCommandId command_id, |
| 126 SyntheticGesture::Result result); | 136 SyntheticGesture::Result result); |
| 127 | 137 |
| 128 RenderWidgetHostImpl* host_; | 138 RenderWidgetHostImpl* host_; |
| 129 std::unique_ptr<Client> client_; | 139 std::unique_ptr<Client> client_; |
| 140 // DevToolsCommandIds for calls to Input.dispatchKey/MouseEvent that have been | |
| 141 // sent to the renderer, but that we haven't yet received an ack for. | |
| 142 bool input_queued_; | |
| 143 std::deque<DevToolsCommandId> pending_key_command_ids_; | |
| 144 std::deque<DevToolsCommandId> pending_mouse_command_ids_; | |
| 130 float page_scale_factor_; | 145 float page_scale_factor_; |
| 131 gfx::SizeF scrollable_viewport_size_; | 146 gfx::SizeF scrollable_viewport_size_; |
| 132 base::WeakPtrFactory<InputHandler> weak_factory_; | 147 base::WeakPtrFactory<InputHandler> weak_factory_; |
| 133 | 148 |
| 134 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 149 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
| 135 }; | 150 }; |
| 136 | 151 |
| 137 } // namespace input | 152 } // namespace input |
| 138 } // namespace devtools | 153 } // namespace devtools |
| 139 } // namespace content | 154 } // namespace content |
| 140 | 155 |
| 141 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_ | 156 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_ |
| OLD | NEW |