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 gfx { | 20 namespace gfx { |
| 20 class Point; | 21 class Point; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 class RenderWidgetHostImpl; | 26 class RenderWidgetHostImpl; |
| 26 | 27 |
| 27 namespace devtools { | 28 namespace devtools { |
| 28 namespace input { | 29 namespace input { |
| 29 | 30 |
| 30 class InputHandler { | 31 class InputHandler : public RenderWidgetHost::InputEventObserver { |
| 31 public: | 32 public: |
| 32 typedef DevToolsProtocolClient::Response Response; | 33 typedef DevToolsProtocolClient::Response Response; |
| 33 | 34 |
| 34 InputHandler(); | 35 InputHandler(); |
| 35 virtual ~InputHandler(); | 36 ~InputHandler() override; |
| 37 | |
| 38 // InputEventObserver | |
| 39 void OnInputEvent(const blink::WebInputEvent& event) override {}; | |
| 40 void OnInputEventAck(const blink::WebInputEvent& event, bool was_synthetic) | |
| 41 override; | |
| 36 | 42 |
| 37 void SetRenderWidgetHost(RenderWidgetHostImpl* host); | 43 void SetRenderWidgetHost(RenderWidgetHostImpl* host); |
| 38 void SetClient(std::unique_ptr<Client> client); | 44 void SetClient(std::unique_ptr<Client> client); |
| 39 void OnSwapCompositorFrame(const cc::CompositorFrameMetadata& frame_metadata); | 45 void OnSwapCompositorFrame(const cc::CompositorFrameMetadata& frame_metadata); |
| 40 | 46 |
| 41 Response DispatchKeyEvent(const std::string& type, | 47 Response DispatchKeyEvent(DevToolsCommandId command_id, |
| 48 const std::string& type, | |
| 42 const int* modifiers, | 49 const int* modifiers, |
| 43 const double* timestamp, | 50 const double* timestamp, |
| 44 const std::string* text, | 51 const std::string* text, |
| 45 const std::string* unmodified_text, | 52 const std::string* unmodified_text, |
| 46 const std::string* key_identifier, | 53 const std::string* key_identifier, |
| 47 const std::string* code, | 54 const std::string* code, |
| 48 const std::string* key, | 55 const std::string* key, |
| 49 const int* windows_virtual_key_code, | 56 const int* windows_virtual_key_code, |
| 50 const int* native_virtual_key_code, | 57 const int* native_virtual_key_code, |
| 51 const bool* auto_repeat, | 58 const bool* auto_repeat, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 const std::string* interaction_marker_name); | 99 const std::string* interaction_marker_name); |
| 93 | 100 |
| 94 Response SynthesizeTapGesture(DevToolsCommandId command_id, | 101 Response SynthesizeTapGesture(DevToolsCommandId command_id, |
| 95 int x, | 102 int x, |
| 96 int y, | 103 int y, |
| 97 const int* duration, | 104 const int* duration, |
| 98 const int* tap_count, | 105 const int* tap_count, |
| 99 const std::string* gesture_source_type); | 106 const std::string* gesture_source_type); |
| 100 | 107 |
| 101 private: | 108 private: |
| 109 void SendDispatchKeyEventResponse(DevToolsCommandId command_id); | |
| 110 | |
| 102 void SendSynthesizePinchGestureResponse(DevToolsCommandId command_id, | 111 void SendSynthesizePinchGestureResponse(DevToolsCommandId command_id, |
| 103 SyntheticGesture::Result result); | 112 SyntheticGesture::Result result); |
| 104 | 113 |
| 105 void SendSynthesizeScrollGestureResponse(DevToolsCommandId command_id, | 114 void SendSynthesizeScrollGestureResponse(DevToolsCommandId command_id, |
| 106 SyntheticGesture::Result result); | 115 SyntheticGesture::Result result); |
| 107 | 116 |
| 108 void SendSynthesizeTapGestureResponse(DevToolsCommandId command_id, | 117 void SendSynthesizeTapGestureResponse(DevToolsCommandId command_id, |
| 109 bool send_success, | 118 bool send_success, |
| 110 SyntheticGesture::Result result); | 119 SyntheticGesture::Result result); |
| 111 | 120 |
| 112 void SynthesizeRepeatingScroll( | 121 void SynthesizeRepeatingScroll( |
| 113 SyntheticSmoothScrollGestureParams gesture_params, | 122 SyntheticSmoothScrollGestureParams gesture_params, |
| 114 int repeat_count, | 123 int repeat_count, |
| 115 base::TimeDelta repeat_delay, | 124 base::TimeDelta repeat_delay, |
| 116 std::string interaction_marker_name, | 125 std::string interaction_marker_name, |
| 117 DevToolsCommandId command_id); | 126 DevToolsCommandId command_id); |
| 118 | 127 |
| 119 void OnScrollFinished(SyntheticSmoothScrollGestureParams gesture_params, | 128 void OnScrollFinished(SyntheticSmoothScrollGestureParams gesture_params, |
| 120 int repeat_count, | 129 int repeat_count, |
| 121 base::TimeDelta repeat_delay, | 130 base::TimeDelta repeat_delay, |
| 122 std::string interaction_marker_name, | 131 std::string interaction_marker_name, |
| 123 DevToolsCommandId command_id, | 132 DevToolsCommandId command_id, |
| 124 SyntheticGesture::Result result); | 133 SyntheticGesture::Result result); |
| 125 | 134 |
| 126 RenderWidgetHostImpl* host_; | 135 RenderWidgetHostImpl* host_; |
| 127 std::unique_ptr<Client> client_; | 136 std::unique_ptr<Client> client_; |
| 137 std::queue<DevToolsCommandId> pending_key_event_ids_; | |
|
tdresser
2016/10/12 19:49:36
Can you add a comment here explaining what we're d
samuong
2016/10/13 22:59:10
Done.
| |
| 128 float page_scale_factor_; | 138 float page_scale_factor_; |
| 129 gfx::SizeF scrollable_viewport_size_; | 139 gfx::SizeF scrollable_viewport_size_; |
| 130 base::WeakPtrFactory<InputHandler> weak_factory_; | 140 base::WeakPtrFactory<InputHandler> weak_factory_; |
| 131 | 141 |
| 132 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 142 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
| 133 }; | 143 }; |
| 134 | 144 |
| 135 } // namespace input | 145 } // namespace input |
| 136 } // namespace devtools | 146 } // namespace devtools |
| 137 } // namespace content | 147 } // namespace content |
| 138 | 148 |
| 139 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_ | 149 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_ |
| OLD | NEW |