Add configs that depend on linux builder and linux builder (dbg).
[chromium-blink-merge.git] / content / browser / devtools / protocol / input_handler.h
blobc4de07876bc5e3c6b08e11e8a4ba2c25853544e1
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_
8 #include "base/memory/weak_ptr.h"
9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h"
10 #include "content/browser/renderer_host/input/synthetic_gesture.h"
11 #include "ui/gfx/geometry/size_f.h"
13 namespace cc {
14 class CompositorFrameMetadata;
17 namespace gfx {
18 class Point;
21 namespace content {
23 class RenderWidgetHostImpl;
25 namespace devtools {
26 namespace input {
28 class InputHandler {
29 public:
30 typedef DevToolsProtocolClient::Response Response;
32 InputHandler();
33 virtual ~InputHandler();
35 void SetRenderWidgetHost(RenderWidgetHostImpl* host);
36 void SetClient(scoped_ptr<Client> client);
37 void OnSwapCompositorFrame(const cc::CompositorFrameMetadata& frame_metadata);
39 Response DispatchKeyEvent(const std::string& type,
40 const int* modifiers,
41 const double* timestamp,
42 const std::string* text,
43 const std::string* unmodified_text,
44 const std::string* key_identifier,
45 const std::string* code,
46 const std::string* key,
47 const int* windows_virtual_key_code,
48 const int* native_virtual_key_code,
49 const bool* auto_repeat,
50 const bool* is_keypad,
51 const bool* is_system_key);
53 Response DispatchMouseEvent(const std::string& type,
54 int x,
55 int y,
56 const int* modifiers,
57 const double* timestamp,
58 const std::string* button,
59 const int* click_count);
61 Response EmulateTouchFromMouseEvent(const std::string& type,
62 int x,
63 int y,
64 double timestamp,
65 const std::string& button,
66 double* delta_x,
67 double* delta_y,
68 int* modifiers,
69 int* click_count);
71 Response SynthesizePinchGesture(DevToolsCommandId command_id,
72 int x,
73 int y,
74 double scale_factor,
75 const int* relative_speed,
76 const std::string* gesture_source_type);
78 Response SynthesizeScrollGesture(DevToolsCommandId command_id,
79 int x,
80 int y,
81 const int* x_distance,
82 const int* y_distance,
83 const int* x_overscroll,
84 const int* y_overscroll,
85 const bool* prevent_fling,
86 const int* speed,
87 const std::string* gesture_source_type);
89 Response SynthesizeTapGesture(DevToolsCommandId command_id,
90 int x,
91 int y,
92 const int* duration,
93 const int* tap_count,
94 const std::string* gesture_source_type);
96 private:
97 void SendSynthesizePinchGestureResponse(DevToolsCommandId command_id,
98 SyntheticGesture::Result result);
100 void SendSynthesizeScrollGestureResponse(DevToolsCommandId command_id,
101 SyntheticGesture::Result result);
103 void SendSynthesizeTapGestureResponse(DevToolsCommandId command_id,
104 bool send_success,
105 SyntheticGesture::Result result);
107 RenderWidgetHostImpl* host_;
108 scoped_ptr<Client> client_;
109 float page_scale_factor_;
110 gfx::SizeF scrollable_viewport_size_;
111 base::WeakPtrFactory<InputHandler> weak_factory_;
113 DISALLOW_COPY_AND_ASSIGN(InputHandler);
116 } // namespace input
117 } // namespace devtools
118 } // namespace content
120 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_INPUT_HANDLER_H_