Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.h

Issue 138163016: [DevTools] Touch emulation in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix non-aura compile Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
11 #include <queue> 11 #include <queue>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/observer_list.h" 20 #include "base/observer_list.h"
21 #include "base/process/kill.h" 21 #include "base/process/kill.h"
22 #include "base/strings/string16.h" 22 #include "base/strings/string16.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "base/timer/timer.h" 24 #include "base/timer/timer.h"
25 #include "build/build_config.h" 25 #include "build/build_config.h"
26 #include "content/browser/renderer_host/input/input_ack_handler.h" 26 #include "content/browser/renderer_host/input/input_ack_handler.h"
27 #include "content/browser/renderer_host/input/input_router_client.h" 27 #include "content/browser/renderer_host/input/input_router_client.h"
28 #include "content/browser/renderer_host/input/synthetic_gesture.h" 28 #include "content/browser/renderer_host/input/synthetic_gesture.h"
29 #include "content/browser/renderer_host/input/touch_emulator_client.h"
29 #include "content/common/input/synthetic_gesture_packet.h" 30 #include "content/common/input/synthetic_gesture_packet.h"
30 #include "content/common/view_message_enums.h" 31 #include "content/common/view_message_enums.h"
31 #include "content/port/browser/event_with_latency_info.h" 32 #include "content/port/browser/event_with_latency_info.h"
32 #include "content/port/common/input_event_ack_state.h" 33 #include "content/port/common/input_event_ack_state.h"
33 #include "content/public/browser/render_widget_host.h" 34 #include "content/public/browser/render_widget_host.h"
34 #include "content/public/common/page_zoom.h" 35 #include "content/public/common/page_zoom.h"
35 #include "ipc/ipc_listener.h" 36 #include "ipc/ipc_listener.h"
36 #include "ui/base/ime/text_input_mode.h" 37 #include "ui/base/ime/text_input_mode.h"
37 #include "ui/base/ime/text_input_type.h" 38 #include "ui/base/ime/text_input_type.h"
38 #include "ui/events/latency_info.h" 39 #include "ui/events/latency_info.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 namespace content { 79 namespace content {
79 class BackingStore; 80 class BackingStore;
80 class InputRouter; 81 class InputRouter;
81 class MockRenderWidgetHost; 82 class MockRenderWidgetHost;
82 class OverscrollController; 83 class OverscrollController;
83 class RenderWidgetHostDelegate; 84 class RenderWidgetHostDelegate;
84 class RenderWidgetHostViewPort; 85 class RenderWidgetHostViewPort;
85 class SyntheticGestureController; 86 class SyntheticGestureController;
86 class TimeoutMonitor; 87 class TimeoutMonitor;
88 class TouchEmulator;
87 class WebCursor; 89 class WebCursor;
88 struct EditCommand; 90 struct EditCommand;
89 91
90 // This implements the RenderWidgetHost interface that is exposed to 92 // This implements the RenderWidgetHost interface that is exposed to
91 // embedders of content, and adds things only visible to content. 93 // embedders of content, and adds things only visible to content.
92 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, 94 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost,
93 public InputRouterClient, 95 public InputRouterClient,
94 public InputAckHandler, 96 public InputAckHandler,
97 public TouchEmulatorClient,
95 public IPC::Listener { 98 public IPC::Listener {
96 public: 99 public:
97 // routing_id can be MSG_ROUTING_NONE, in which case the next available 100 // routing_id can be MSG_ROUTING_NONE, in which case the next available
98 // routing id is taken from the RenderProcessHost. 101 // routing id is taken from the RenderProcessHost.
99 // If this object outlives |delegate|, DetachDelegate() must be called when 102 // If this object outlives |delegate|, DetachDelegate() must be called when
100 // |delegate| goes away. 103 // |delegate| goes away.
101 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, 104 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
102 RenderProcessHost* process, 105 RenderProcessHost* process,
103 int routing_id, 106 int routing_id,
104 bool hidden); 107 bool hidden);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // the new one will only fire if it has a shorter delay than the time 294 // the new one will only fire if it has a shorter delay than the time
292 // left on the existing timeouts. 295 // left on the existing timeouts.
293 void StartHangMonitorTimeout(base::TimeDelta delay); 296 void StartHangMonitorTimeout(base::TimeDelta delay);
294 297
295 // Stops all existing hang monitor timeouts and assumes the renderer is 298 // Stops all existing hang monitor timeouts and assumes the renderer is
296 // responsive. 299 // responsive.
297 void StopHangMonitorTimeout(); 300 void StopHangMonitorTimeout();
298 301
299 // Forwards the given message to the renderer. These are called by the view 302 // Forwards the given message to the renderer. These are called by the view
300 // when it has received a message. 303 // when it has received a message.
301 void ForwardGestureEvent(const blink::WebGestureEvent& gesture_event);
302 void ForwardGestureEventWithLatencyInfo( 304 void ForwardGestureEventWithLatencyInfo(
303 const blink::WebGestureEvent& gesture_event, 305 const blink::WebGestureEvent& gesture_event,
304 const ui::LatencyInfo& ui_latency); 306 const ui::LatencyInfo& ui_latency);
305 void ForwardTouchEventWithLatencyInfo( 307 void ForwardTouchEventWithLatencyInfo(
306 const blink::WebTouchEvent& touch_event, 308 const blink::WebTouchEvent& touch_event,
307 const ui::LatencyInfo& ui_latency); 309 const ui::LatencyInfo& ui_latency);
308 void ForwardMouseEventWithLatencyInfo( 310 void ForwardMouseEventWithLatencyInfo(
309 const blink::WebMouseEvent& mouse_event, 311 const blink::WebMouseEvent& mouse_event,
310 const ui::LatencyInfo& ui_latency); 312 const ui::LatencyInfo& ui_latency);
311 void ForwardWheelEventWithLatencyInfo( 313 void ForwardWheelEventWithLatencyInfo(
312 const blink::WebMouseWheelEvent& wheel_event, 314 const blink::WebMouseWheelEvent& wheel_event,
313 const ui::LatencyInfo& ui_latency); 315 const ui::LatencyInfo& ui_latency);
314 316
317 // TouchEmulatorClient overrides.
318 virtual void ForwardGestureEvent(
319 const blink::WebGestureEvent& gesture_event) OVERRIDE;
320 virtual void ForwardTouchEvent(
321 const blink::WebTouchEvent& touch_event) OVERRIDE;
322 virtual void SetCursor(const WebCursor& cursor) OVERRIDE;
323
315 // Queues a synthetic gesture for testing purposes. Invokes the on_complete 324 // Queues a synthetic gesture for testing purposes. Invokes the on_complete
316 // callback when the gesture is finished running. 325 // callback when the gesture is finished running.
317 void QueueSyntheticGesture( 326 void QueueSyntheticGesture(
318 scoped_ptr<SyntheticGesture> synthetic_gesture, 327 scoped_ptr<SyntheticGesture> synthetic_gesture,
319 const base::Callback<void(SyntheticGesture::Result)>& on_complete); 328 const base::Callback<void(SyntheticGesture::Result)>& on_complete);
320 329
321 void CancelUpdateTextDirection(); 330 void CancelUpdateTextDirection();
322 331
323 // Called when a mouse click/gesture tap activates the renderer. 332 // Called when a mouse click/gesture tap activates the renderer.
324 virtual void OnPointerEventActivate(); 333 virtual void OnPointerEventActivate();
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 bool OnSwapCompositorFrame(const IPC::Message& message); 660 bool OnSwapCompositorFrame(const IPC::Message& message);
652 void OnOverscrolled(gfx::Vector2dF accumulated_overscroll, 661 void OnOverscrolled(gfx::Vector2dF accumulated_overscroll,
653 gfx::Vector2dF current_fling_velocity); 662 gfx::Vector2dF current_fling_velocity);
654 void OnFlingingStopped(); 663 void OnFlingingStopped();
655 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); 664 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params);
656 void OnUpdateIsDelayed(); 665 void OnUpdateIsDelayed();
657 void OnQueueSyntheticGesture(const SyntheticGesturePacket& gesture_packet); 666 void OnQueueSyntheticGesture(const SyntheticGesturePacket& gesture_packet);
658 virtual void OnFocus(); 667 virtual void OnFocus();
659 virtual void OnBlur(); 668 virtual void OnBlur();
660 void OnSetCursor(const WebCursor& cursor); 669 void OnSetCursor(const WebCursor& cursor);
670 void OnSetTouchEventEmulationEnabled(bool enabled, bool allow_pinch);
661 void OnTextInputTypeChanged(ui::TextInputType type, 671 void OnTextInputTypeChanged(ui::TextInputType type,
662 ui::TextInputMode input_mode, 672 ui::TextInputMode input_mode,
663 bool can_compose_inline); 673 bool can_compose_inline);
664 #if defined(OS_MACOSX) || defined(USE_AURA) 674 #if defined(OS_MACOSX) || defined(USE_AURA)
665 void OnImeCompositionRangeChanged( 675 void OnImeCompositionRangeChanged(
666 const gfx::Range& range, 676 const gfx::Range& range,
667 const std::vector<gfx::Rect>& character_bounds); 677 const std::vector<gfx::Rect>& character_bounds);
668 #endif 678 #endif
669 void OnImeCancelComposition(); 679 void OnImeCancelComposition();
670 void OnDidActivateAcceleratedCompositing(bool activated); 680 void OnDidActivateAcceleratedCompositing(bool activated);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 906
897 // Keeps track of whether the webpage has any touch event handler. If it does, 907 // Keeps track of whether the webpage has any touch event handler. If it does,
898 // then touch events are sent to the renderer. Otherwise, the touch events are 908 // then touch events are sent to the renderer. Otherwise, the touch events are
899 // not sent to the renderer. 909 // not sent to the renderer.
900 bool has_touch_handler_; 910 bool has_touch_handler_;
901 911
902 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; 912 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_;
903 913
904 scoped_ptr<SyntheticGestureController> synthetic_gesture_controller_; 914 scoped_ptr<SyntheticGestureController> synthetic_gesture_controller_;
905 915
916 scoped_ptr<TouchEmulator> touch_emulator_;
917
906 // Receives and handles all input events. 918 // Receives and handles all input events.
907 scoped_ptr<InputRouter> input_router_; 919 scoped_ptr<InputRouter> input_router_;
908 920
909 scoped_ptr<OverscrollController> overscroll_controller_; 921 scoped_ptr<OverscrollController> overscroll_controller_;
910 922
911 scoped_ptr<TimeoutMonitor> hang_monitor_timeout_; 923 scoped_ptr<TimeoutMonitor> hang_monitor_timeout_;
912 924
913 #if defined(OS_WIN) 925 #if defined(OS_WIN)
914 std::list<HWND> dummy_windows_for_activation_; 926 std::list<HWND> dummy_windows_for_activation_;
915 #endif 927 #endif
916 928
917 // List of callbacks for pending snapshot requests to the renderer. 929 // List of callbacks for pending snapshot requests to the renderer.
918 std::queue<base::Callback<void(bool, const SkBitmap&)> > pending_snapshots_; 930 std::queue<base::Callback<void(bool, const SkBitmap&)> > pending_snapshots_;
919 931
920 int64 last_input_number_; 932 int64 last_input_number_;
921 933
922 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); 934 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl);
923 }; 935 };
924 936
925 } // namespace content 937 } // namespace content
926 938
927 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 939 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698