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 #include <queue> | 14 #include <queue> |
15 | 15 |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/memory/weak_ptr.h" |
20 #include "base/observer_list.h" | 21 #include "base/observer_list.h" |
21 #include "base/time/time.h" | 22 #include "base/time/time.h" |
22 #include "build/build_config.h" | 23 #include "build/build_config.h" |
23 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
24 #include "content/common/cursors/webcursor.h" | 25 #include "content/common/cursors/webcursor.h" |
25 #include "content/common/edit_command.h" | 26 #include "content/common/edit_command.h" |
26 #include "content/common/input/synthetic_gesture_params.h" | 27 #include "content/common/input/synthetic_gesture_params.h" |
27 #include "content/public/common/screen_info.h" | 28 #include "content/public/common/screen_info.h" |
28 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" | 29 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" |
29 #include "content/renderer/gpu/render_widget_compositor_delegate.h" | 30 #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
(...skipping 27 matching lines...) Expand all Loading... |
57 | 58 |
58 namespace IPC { | 59 namespace IPC { |
59 class SyncMessage; | 60 class SyncMessage; |
60 class SyncMessageFilter; | 61 class SyncMessageFilter; |
61 } | 62 } |
62 | 63 |
63 namespace blink { | 64 namespace blink { |
64 namespace scheduler { | 65 namespace scheduler { |
65 class RenderWidgetSchedulingState; | 66 class RenderWidgetSchedulingState; |
66 } | 67 } |
| 68 struct WebActiveWheelFlingParameters; |
67 struct WebDeviceEmulationParams; | 69 struct WebDeviceEmulationParams; |
68 class WebFrameWidget; | 70 class WebFrameWidget; |
69 class WebGestureEvent; | 71 class WebGestureEvent; |
70 class WebLocalFrame; | 72 class WebLocalFrame; |
71 class WebMouseEvent; | 73 class WebMouseEvent; |
72 class WebNode; | 74 class WebNode; |
| 75 class WebURL; |
73 struct WebPoint; | 76 struct WebPoint; |
74 } | 77 } |
75 | 78 |
76 namespace cc { | 79 namespace cc { |
77 class CompositorFrameSink; | 80 class CompositorFrameSink; |
78 class FrameSinkId; | 81 class FrameSinkId; |
79 class SwapPromise; | 82 class SwapPromise; |
80 } | 83 } |
81 | 84 |
82 namespace gfx { | 85 namespace gfx { |
(...skipping 28 matching lines...) Expand all Loading... |
111 // - Fullscreen mode (RenderWidgetFullScreen) | 114 // - Fullscreen mode (RenderWidgetFullScreen) |
112 // - Popup "menus" (like the color chooser and date picker) | 115 // - Popup "menus" (like the color chooser and date picker) |
113 // - Widgets for frames (for out-of-process iframe support) | 116 // - Widgets for frames (for out-of-process iframe support) |
114 class CONTENT_EXPORT RenderWidget | 117 class CONTENT_EXPORT RenderWidget |
115 : public IPC::Listener, | 118 : public IPC::Listener, |
116 public IPC::Sender, | 119 public IPC::Sender, |
117 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient), | 120 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient), |
118 public RenderWidgetCompositorDelegate, | 121 public RenderWidgetCompositorDelegate, |
119 public RenderWidgetInputHandlerDelegate, | 122 public RenderWidgetInputHandlerDelegate, |
120 public RenderWidgetScreenMetricsEmulatorDelegate, | 123 public RenderWidgetScreenMetricsEmulatorDelegate, |
| 124 public base::SupportsWeakPtr<RenderWidget>, |
121 public base::RefCounted<RenderWidget> { | 125 public base::RefCounted<RenderWidget> { |
122 public: | 126 public: |
123 // Creates a new RenderWidget. The opener_id is the routing ID of the | 127 // Creates a new RenderWidget. The opener_id is the routing ID of the |
124 // RenderView that this widget lives inside. | 128 // RenderView that this widget lives inside. |
125 static RenderWidget* Create(int32_t opener_id, | 129 static RenderWidget* Create(int32_t opener_id, |
126 CompositorDependencies* compositor_deps, | 130 CompositorDependencies* compositor_deps, |
127 blink::WebPopupType popup_type, | 131 blink::WebPopupType popup_type, |
128 const ScreenInfo& screen_info); | 132 const ScreenInfo& screen_info); |
129 | 133 |
130 // Creates a new RenderWidget that will be attached to a RenderFrame. | 134 // Creates a new RenderWidget that will be attached to a RenderFrame. |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 // TODO(ekaramad): The reference to the focused pepper plugin will be removed | 392 // TODO(ekaramad): The reference to the focused pepper plugin will be removed |
389 // from RenderWidget. The purpose of having the reference here was to make IME | 393 // from RenderWidget. The purpose of having the reference here was to make IME |
390 // work for OOPIF (https://crbug.com/643727). | 394 // work for OOPIF (https://crbug.com/643727). |
391 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) { | 395 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) { |
392 focused_pepper_plugin_ = plugin; | 396 focused_pepper_plugin_ = plugin; |
393 } | 397 } |
394 | 398 |
395 // When emulated, this returns original device scale factor. | 399 // When emulated, this returns original device scale factor. |
396 float GetOriginalDeviceScaleFactor() const; | 400 float GetOriginalDeviceScaleFactor() const; |
397 | 401 |
| 402 virtual void TransferActiveWheelFlingAnimation( |
| 403 const blink::WebActiveWheelFlingParameters& params) {} |
| 404 |
398 protected: | 405 protected: |
399 // Friend RefCounted so that the dtor can be non-public. Using this class | 406 // Friend RefCounted so that the dtor can be non-public. Using this class |
400 // without ref-counting is an error. | 407 // without ref-counting is an error. |
401 friend class base::RefCounted<RenderWidget>; | 408 friend class base::RefCounted<RenderWidget>; |
402 | 409 |
403 // For unit tests. | 410 // For unit tests. |
404 friend class RenderWidgetTest; | 411 friend class RenderWidgetTest; |
405 | 412 |
406 using CreateWidgetCallback = base::OnceCallback<bool()>; | 413 using CreateWidgetCallback = base::OnceCallback<bool()>; |
407 | 414 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 513 |
507 // Called by the browser process for every required IME acknowledgement. | 514 // Called by the browser process for every required IME acknowledgement. |
508 void OnImeEventAck(); | 515 void OnImeEventAck(); |
509 | 516 |
510 // Called by the browser process to update text input state. | 517 // Called by the browser process to update text input state. |
511 void OnRequestTextInputStateUpdate(); | 518 void OnRequestTextInputStateUpdate(); |
512 | 519 |
513 // Called by the browser process to begin (when |begin| is set) or end batch | 520 // Called by the browser process to begin (when |begin| is set) or end batch |
514 // edit mode. Note that text input state will not be updated in this mode. | 521 // edit mode. Note that text input state will not be updated in this mode. |
515 void OnImeBatchEdit(bool begin); | 522 void OnImeBatchEdit(bool begin); |
| 523 |
| 524 // Declared here to allow use of RenderWidget weak pointer. Overriden in |
| 525 // RenderViewImpl. |
| 526 virtual void LaunchAndroidContentIntent(const GURL& intent, |
| 527 size_t request_id, |
| 528 bool is_main_frame) {} |
| 529 |
| 530 // Utility function so LaunchAndroidContentIntent can remain protected. |
| 531 void scheduleContentIntentForRenderView(const blink::WebURL& intent, |
| 532 bool is_main_frame, |
| 533 size_t expected_content_intent_id); |
516 #endif | 534 #endif |
517 | 535 |
518 // Called by the browser process to update the cursor and composition | 536 // Called by the browser process to update the cursor and composition |
519 // information. | 537 // information. |
520 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request); | 538 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request); |
521 | 539 |
522 // Notify the compositor about a change in viewport size. This should be | 540 // Notify the compositor about a change in viewport size. This should be |
523 // used only with auto resize mode WebWidgets, as normal WebWidgets should | 541 // used only with auto resize mode WebWidgets, as normal WebWidgets should |
524 // go through OnResize. | 542 // go through OnResize. |
525 void AutoResizeCompositor(); | 543 void AutoResizeCompositor(); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 | 807 |
790 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState> | 808 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState> |
791 render_widget_scheduling_state_; | 809 render_widget_scheduling_state_; |
792 | 810 |
793 // Mouse Lock dispatcher attached to this view. | 811 // Mouse Lock dispatcher attached to this view. |
794 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; | 812 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; |
795 | 813 |
796 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. | 814 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. |
797 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; | 815 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; |
798 | 816 |
| 817 bool has_added_input_handler_; |
| 818 |
799 private: | 819 private: |
800 // Applies/Removes the DevTools device emulation transformation to/from a | 820 // Applies/Removes the DevTools device emulation transformation to/from a |
801 // window rect. | 821 // window rect. |
802 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; | 822 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; |
803 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; | 823 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; |
804 | 824 |
805 bool CreateWidget(int32_t opener_id, | 825 bool CreateWidget(int32_t opener_id, |
806 blink::WebPopupType popup_type, | 826 blink::WebPopupType popup_type, |
807 int32_t* routing_id); | 827 int32_t* routing_id); |
808 | 828 |
(...skipping 13 matching lines...) Expand all Loading... |
822 // Stores edit commands associated to the next key event. | 842 // Stores edit commands associated to the next key event. |
823 // Will be cleared as soon as the next key event is processed. | 843 // Will be cleared as soon as the next key event is processed. |
824 EditCommands edit_commands_; | 844 EditCommands edit_commands_; |
825 | 845 |
826 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 846 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
827 }; | 847 }; |
828 | 848 |
829 } // namespace content | 849 } // namespace content |
830 | 850 |
831 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 851 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |