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