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>, | |
dcheng
2016/11/04 21:00:02
Let's embed a WeakPtrFactory instead.
wjmaclean
2016/11/07 15:57:27
Done.
| |
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 | 508 |
502 #if defined(OS_ANDROID) | 509 #if defined(OS_ANDROID) |
503 // Called when we send IME event that expects an ACK. | 510 // Called when we send IME event that expects an ACK. |
504 void OnImeEventSentForAck(const blink::WebTextInputInfo& info); | 511 void OnImeEventSentForAck(const blink::WebTextInputInfo& info); |
505 | 512 |
506 // Called by the browser process for every required IME acknowledgement. | 513 // Called by the browser process for every required IME acknowledgement. |
507 void OnImeEventAck(); | 514 void OnImeEventAck(); |
508 | 515 |
509 // Called by the browser process to update text input state. | 516 // Called by the browser process to update text input state. |
510 void OnRequestTextInputStateUpdate(); | 517 void OnRequestTextInputStateUpdate(); |
518 | |
519 // Declared here to allow use of RenderWidget weak pointer. Overriden in | |
520 // RenderViewImpl. | |
521 virtual void LaunchAndroidContentIntent(const GURL& intent, | |
522 size_t request_id, | |
523 bool is_main_frame) {} | |
524 | |
525 // Utility function so LaunchAndroidContentIntent can remain protected. | |
526 void scheduleContentIntentForRenderView(const blink::WebURL& intent, | |
527 bool is_main_frame, | |
528 size_t expected_content_intent_id); | |
511 #endif | 529 #endif |
512 | 530 |
513 // Called by the browser process to update the cursor and composition | 531 // Called by the browser process to update the cursor and composition |
514 // information. | 532 // information. |
515 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request); | 533 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request); |
516 | 534 |
517 // Notify the compositor about a change in viewport size. This should be | 535 // Notify the compositor about a change in viewport size. This should be |
518 // used only with auto resize mode WebWidgets, as normal WebWidgets should | 536 // used only with auto resize mode WebWidgets, as normal WebWidgets should |
519 // go through OnResize. | 537 // go through OnResize. |
520 void AutoResizeCompositor(); | 538 void AutoResizeCompositor(); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 | 798 |
781 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState> | 799 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState> |
782 render_widget_scheduling_state_; | 800 render_widget_scheduling_state_; |
783 | 801 |
784 // Mouse Lock dispatcher attached to this view. | 802 // Mouse Lock dispatcher attached to this view. |
785 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; | 803 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; |
786 | 804 |
787 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. | 805 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. |
788 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; | 806 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; |
789 | 807 |
808 bool has_added_input_handler_; | |
809 | |
790 private: | 810 private: |
791 // Applies/Removes the DevTools device emulation transformation to/from a | 811 // Applies/Removes the DevTools device emulation transformation to/from a |
792 // window rect. | 812 // window rect. |
793 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; | 813 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; |
794 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; | 814 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; |
795 | 815 |
796 bool CreateWidget(int32_t opener_id, | 816 bool CreateWidget(int32_t opener_id, |
797 blink::WebPopupType popup_type, | 817 blink::WebPopupType popup_type, |
798 int32_t* routing_id); | 818 int32_t* routing_id); |
799 | 819 |
(...skipping 13 matching lines...) Expand all Loading... | |
813 // Stores edit commands associated to the next key event. | 833 // Stores edit commands associated to the next key event. |
814 // Will be cleared as soon as the next key event is processed. | 834 // Will be cleared as soon as the next key event is processed. |
815 EditCommands edit_commands_; | 835 EditCommands edit_commands_; |
816 | 836 |
817 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 837 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
818 }; | 838 }; |
819 | 839 |
820 } // namespace content | 840 } // namespace content |
821 | 841 |
822 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 842 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |