OLD | NEW |
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_RENDERER_RENDER_WIDGET_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <deque> | 11 #include <deque> |
12 #include <map> | 12 #include <map> |
13 #include <memory> | 13 #include <memory> |
14 | 14 |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
22 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
23 #include "content/common/cursors/webcursor.h" | 23 #include "content/common/cursors/webcursor.h" |
24 #include "content/common/input/synthetic_gesture_params.h" | 24 #include "content/common/input/synthetic_gesture_params.h" |
25 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" | 25 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" |
26 #include "content/renderer/gpu/render_widget_compositor_delegate.h" | 26 #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
27 #include "content/renderer/input/render_widget_input_handler.h" | 27 #include "content/renderer/input/render_widget_input_handler.h" |
28 #include "content/renderer/input/render_widget_input_handler_delegate.h" | 28 #include "content/renderer/input/render_widget_input_handler_delegate.h" |
29 #include "content/renderer/message_delivery_policy.h" | 29 #include "content/renderer/message_delivery_policy.h" |
| 30 #include "content/renderer/mouse_lock_dispatcher.h" |
| 31 #include "content/renderer/render_widget_mouse_lock_dispatcher.h" |
30 #include "ipc/ipc_listener.h" | 32 #include "ipc/ipc_listener.h" |
31 #include "ipc/ipc_sender.h" | 33 #include "ipc/ipc_sender.h" |
32 #include "third_party/WebKit/public/platform/WebDisplayMode.h" | 34 #include "third_party/WebKit/public/platform/WebDisplayMode.h" |
33 #include "third_party/WebKit/public/platform/WebRect.h" | 35 #include "third_party/WebKit/public/platform/WebRect.h" |
34 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 36 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
35 #include "third_party/WebKit/public/web/WebInputEvent.h" | 37 #include "third_party/WebKit/public/web/WebInputEvent.h" |
36 #include "third_party/WebKit/public/web/WebPopupType.h" | 38 #include "third_party/WebKit/public/web/WebPopupType.h" |
37 #include "third_party/WebKit/public/web/WebTextDirection.h" | 39 #include "third_party/WebKit/public/web/WebTextDirection.h" |
38 #include "third_party/WebKit/public/web/WebTextInputInfo.h" | 40 #include "third_party/WebKit/public/web/WebTextInputInfo.h" |
39 #include "third_party/WebKit/public/web/WebTouchAction.h" | 41 #include "third_party/WebKit/public/web/WebTouchAction.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 void resetInputMethod() override; | 256 void resetInputMethod() override; |
255 void didHandleGestureEvent(const blink::WebGestureEvent& event, | 257 void didHandleGestureEvent(const blink::WebGestureEvent& event, |
256 bool event_cancelled) override; | 258 bool event_cancelled) override; |
257 void didOverscroll(const blink::WebFloatSize& overscrollDelta, | 259 void didOverscroll(const blink::WebFloatSize& overscrollDelta, |
258 const blink::WebFloatSize& accumulatedOverscroll, | 260 const blink::WebFloatSize& accumulatedOverscroll, |
259 const blink::WebFloatPoint& position, | 261 const blink::WebFloatPoint& position, |
260 const blink::WebFloatSize& velocity) override; | 262 const blink::WebFloatSize& velocity) override; |
261 void showImeIfNeeded() override; | 263 void showImeIfNeeded() override; |
262 void convertViewportToWindow(blink::WebRect* rect) override; | 264 void convertViewportToWindow(blink::WebRect* rect) override; |
263 void convertWindowToViewport(blink::WebFloatRect* rect) override; | 265 void convertWindowToViewport(blink::WebFloatRect* rect) override; |
| 266 bool requestPointerLock() override; |
| 267 void requestPointerUnlock() override; |
| 268 bool isPointerLocked() override; |
264 | 269 |
265 // Override point to obtain that the current input method state and caret | 270 // Override point to obtain that the current input method state and caret |
266 // position. | 271 // position. |
267 virtual ui::TextInputType GetTextInputType(); | 272 virtual ui::TextInputType GetTextInputType(); |
268 virtual ui::TextInputType WebKitToUiTextInputType( | 273 virtual ui::TextInputType WebKitToUiTextInputType( |
269 blink::WebTextInputType type); | 274 blink::WebTextInputType type); |
270 | 275 |
271 #if defined(OS_ANDROID) | 276 #if defined(OS_ANDROID) |
272 // Notifies that a tap was not consumed, so showing a UI for the unhandled | 277 // Notifies that a tap was not consumed, so showing a UI for the unhandled |
273 // tap may be needed. | 278 // tap may be needed. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 // handle composition range and composition character bounds. | 363 // handle composition range and composition character bounds. |
359 void UpdateCompositionInfo(bool should_update_range); | 364 void UpdateCompositionInfo(bool should_update_range); |
360 | 365 |
361 // Change the device ICC color profile while running a layout test. | 366 // Change the device ICC color profile while running a layout test. |
362 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); | 367 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); |
363 void ResetDeviceColorProfileForTesting(); | 368 void ResetDeviceColorProfileForTesting(); |
364 | 369 |
365 // Indicates whether this widget has focus. | 370 // Indicates whether this widget has focus. |
366 bool has_focus() const { return has_focus_; } | 371 bool has_focus() const { return has_focus_; } |
367 | 372 |
| 373 MouseLockDispatcher* mouse_lock_dispatcher() { |
| 374 return mouse_lock_dispatcher_.get(); |
| 375 } |
| 376 |
368 protected: | 377 protected: |
369 // Friend RefCounted so that the dtor can be non-public. Using this class | 378 // Friend RefCounted so that the dtor can be non-public. Using this class |
370 // without ref-counting is an error. | 379 // without ref-counting is an error. |
371 friend class base::RefCounted<RenderWidget>; | 380 friend class base::RefCounted<RenderWidget>; |
372 | 381 |
373 // For unit tests. | 382 // For unit tests. |
374 friend class RenderWidgetTest; | 383 friend class RenderWidgetTest; |
375 | 384 |
376 enum ResizeAck { | 385 enum ResizeAck { |
377 SEND_RESIZE_ACK, | 386 SEND_RESIZE_ACK, |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 // are sent to each frame in the list for events such as changing | 761 // are sent to each frame in the list for events such as changing |
753 // visibility state for example. | 762 // visibility state for example. |
754 base::ObserverList<RenderFrameImpl> render_frames_; | 763 base::ObserverList<RenderFrameImpl> render_frames_; |
755 | 764 |
756 bool has_host_context_menu_location_; | 765 bool has_host_context_menu_location_; |
757 gfx::Point host_context_menu_location_; | 766 gfx::Point host_context_menu_location_; |
758 | 767 |
759 std::unique_ptr<scheduler::RenderWidgetSchedulingState> | 768 std::unique_ptr<scheduler::RenderWidgetSchedulingState> |
760 render_widget_scheduling_state_; | 769 render_widget_scheduling_state_; |
761 | 770 |
| 771 // Mouse Lock dispatcher attached to this view. |
| 772 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; |
| 773 |
| 774 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. |
| 775 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; |
| 776 |
762 private: | 777 private: |
763 // When emulated, this returns original device scale factor. | 778 // When emulated, this returns original device scale factor. |
764 float GetOriginalDeviceScaleFactor() const; | 779 float GetOriginalDeviceScaleFactor() const; |
765 | 780 |
766 // Indicates whether this widget has focus. | 781 // Indicates whether this widget has focus. |
767 bool has_focus_; | 782 bool has_focus_; |
768 | 783 |
769 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 784 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
770 }; | 785 }; |
771 | 786 |
772 } // namespace content | 787 } // namespace content |
773 | 788 |
774 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 789 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |