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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 void resetInputMethod() override; | 254 void resetInputMethod() override; |
253 void didHandleGestureEvent(const blink::WebGestureEvent& event, | 255 void didHandleGestureEvent(const blink::WebGestureEvent& event, |
254 bool event_cancelled) override; | 256 bool event_cancelled) override; |
255 void didOverscroll(const blink::WebFloatSize& overscrollDelta, | 257 void didOverscroll(const blink::WebFloatSize& overscrollDelta, |
256 const blink::WebFloatSize& accumulatedOverscroll, | 258 const blink::WebFloatSize& accumulatedOverscroll, |
257 const blink::WebFloatPoint& position, | 259 const blink::WebFloatPoint& position, |
258 const blink::WebFloatSize& velocity) override; | 260 const blink::WebFloatSize& velocity) override; |
259 void showImeIfNeeded() override; | 261 void showImeIfNeeded() override; |
260 void convertViewportToWindow(blink::WebRect* rect) override; | 262 void convertViewportToWindow(blink::WebRect* rect) override; |
261 void convertWindowToViewport(blink::WebFloatRect* rect) override; | 263 void convertWindowToViewport(blink::WebFloatRect* rect) override; |
264 bool requestPointerLock() override; | |
265 void requestPointerUnlock() override; | |
266 bool isPointerLocked() override; | |
262 | 267 |
263 // Override point to obtain that the current input method state and caret | 268 // Override point to obtain that the current input method state and caret |
264 // position. | 269 // position. |
265 virtual ui::TextInputType GetTextInputType(); | 270 virtual ui::TextInputType GetTextInputType(); |
266 virtual ui::TextInputType WebKitToUiTextInputType( | 271 virtual ui::TextInputType WebKitToUiTextInputType( |
267 blink::WebTextInputType type); | 272 blink::WebTextInputType type); |
268 | 273 |
269 #if defined(OS_ANDROID) | 274 #if defined(OS_ANDROID) |
270 // Notifies that a tap was not consumed, so showing a UI for the unhandled | 275 // Notifies that a tap was not consumed, so showing a UI for the unhandled |
271 // tap may be needed. | 276 // tap may be needed. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 // handle composition range and composition character bounds. | 361 // handle composition range and composition character bounds. |
357 void UpdateCompositionInfo(bool should_update_range); | 362 void UpdateCompositionInfo(bool should_update_range); |
358 | 363 |
359 // Change the device ICC color profile while running a layout test. | 364 // Change the device ICC color profile while running a layout test. |
360 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); | 365 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); |
361 void ResetDeviceColorProfileForTesting(); | 366 void ResetDeviceColorProfileForTesting(); |
362 | 367 |
363 // Indicates whether this widget has focus. | 368 // Indicates whether this widget has focus. |
364 bool has_focus() const { return has_focus_; } | 369 bool has_focus() const { return has_focus_; } |
365 | 370 |
371 MouseLockDispatcher* mouse_lock_dispatcher() { | |
372 return mouse_lock_dispatcher_.get(); | |
373 } | |
374 | |
366 protected: | 375 protected: |
367 // Friend RefCounted so that the dtor can be non-public. Using this class | 376 // Friend RefCounted so that the dtor can be non-public. Using this class |
368 // without ref-counting is an error. | 377 // without ref-counting is an error. |
369 friend class base::RefCounted<RenderWidget>; | 378 friend class base::RefCounted<RenderWidget>; |
370 | 379 |
371 // For unit tests. | 380 // For unit tests. |
372 friend class RenderWidgetTest; | 381 friend class RenderWidgetTest; |
373 | 382 |
374 enum ResizeAck { | 383 enum ResizeAck { |
375 SEND_RESIZE_ACK, | 384 SEND_RESIZE_ACK, |
(...skipping 15 matching lines...) Expand all Loading... | |
391 | 400 |
392 // Creates a WebWidget based on the popup type. | 401 // Creates a WebWidget based on the popup type. |
393 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget); | 402 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
394 | 403 |
395 // Initializes this view with the given opener. | 404 // Initializes this view with the given opener. |
396 bool Init(int32_t opener_id); | 405 bool Init(int32_t opener_id); |
397 | 406 |
398 // Called by Init and subclasses to perform initialization. | 407 // Called by Init and subclasses to perform initialization. |
399 bool DoInit(int32_t opener_id, | 408 bool DoInit(int32_t opener_id, |
400 blink::WebWidget* web_widget, | 409 blink::WebWidget* web_widget, |
401 IPC::SyncMessage* create_widget_message); | 410 IPC::SyncMessage* create_widget_message, |
411 bool should_add_route); | |
scheib
2016/05/19 00:38:58
Is this part of the mouse lock move? I didn't foll
lfg
2016/05/19 23:54:06
It's not strictly necessary, but since I've moved
| |
402 | 412 |
403 // Sets whether this RenderWidget has been swapped out to be displayed by | 413 // Sets whether this RenderWidget has been swapped out to be displayed by |
404 // a RenderWidget in a different process. If so, no new IPC messages will be | 414 // a RenderWidget in a different process. If so, no new IPC messages will be |
405 // sent (only ACKs) and the process is free to exit when there are no other | 415 // sent (only ACKs) and the process is free to exit when there are no other |
406 // active RenderWidgets. | 416 // active RenderWidgets. |
407 void SetSwappedOut(bool is_swapped_out); | 417 void SetSwappedOut(bool is_swapped_out); |
408 | 418 |
409 // Allows the process to exit once the unload handler has finished, if there | 419 // Allows the process to exit once the unload handler has finished, if there |
410 // are no other active RenderWidgets. | 420 // are no other active RenderWidgets. |
411 void WasSwappedOut(); | 421 void WasSwappedOut(); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
750 // are sent to each frame in the list for events such as changing | 760 // are sent to each frame in the list for events such as changing |
751 // visibility state for example. | 761 // visibility state for example. |
752 base::ObserverList<RenderFrameImpl> render_frames_; | 762 base::ObserverList<RenderFrameImpl> render_frames_; |
753 | 763 |
754 bool has_host_context_menu_location_; | 764 bool has_host_context_menu_location_; |
755 gfx::Point host_context_menu_location_; | 765 gfx::Point host_context_menu_location_; |
756 | 766 |
757 std::unique_ptr<scheduler::RenderWidgetSchedulingState> | 767 std::unique_ptr<scheduler::RenderWidgetSchedulingState> |
758 render_widget_scheduling_state_; | 768 render_widget_scheduling_state_; |
759 | 769 |
770 // Mouse Lock dispatcher attached to this view. | |
771 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; | |
772 | |
773 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. | |
774 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; | |
775 | |
760 private: | 776 private: |
761 // When emulated, this returns original device scale factor. | 777 // When emulated, this returns original device scale factor. |
762 float GetOriginalDeviceScaleFactor() const; | 778 float GetOriginalDeviceScaleFactor() const; |
763 | 779 |
764 // Indicates whether this widget has focus. | 780 // Indicates whether this widget has focus. |
765 bool has_focus_; | 781 bool has_focus_; |
766 | 782 |
767 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 783 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
768 }; | 784 }; |
769 | 785 |
770 } // namespace content | 786 } // namespace content |
771 | 787 |
772 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 788 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |