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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 // TODO(ekaramad): The reference to the focused pepper plugin will be removed | 391 // 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 | 392 // from RenderWidget. The purpose of having the reference here was to make IME |
390 // work for OOPIF (https://crbug.com/643727). | 393 // work for OOPIF (https://crbug.com/643727). |
391 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) { | 394 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) { |
392 focused_pepper_plugin_ = plugin; | 395 focused_pepper_plugin_ = plugin; |
393 } | 396 } |
394 | 397 |
395 // When emulated, this returns original device scale factor. | 398 // When emulated, this returns original device scale factor. |
396 float GetOriginalDeviceScaleFactor() const; | 399 float GetOriginalDeviceScaleFactor() const; |
397 | 400 |
| 401 virtual void TransferActiveWheelFlingAnimation( |
| 402 const blink::WebActiveWheelFlingParameters& params) {} |
| 403 |
398 protected: | 404 protected: |
399 // Friend RefCounted so that the dtor can be non-public. Using this class | 405 // Friend RefCounted so that the dtor can be non-public. Using this class |
400 // without ref-counting is an error. | 406 // without ref-counting is an error. |
401 friend class base::RefCounted<RenderWidget>; | 407 friend class base::RefCounted<RenderWidget>; |
402 | 408 |
403 // For unit tests. | 409 // For unit tests. |
404 friend class RenderWidgetTest; | 410 friend class RenderWidgetTest; |
405 | 411 |
406 using CreateWidgetCallback = base::OnceCallback<bool()>; | 412 using CreateWidgetCallback = base::OnceCallback<bool()>; |
407 | 413 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 507 |
502 #if defined(OS_ANDROID) | 508 #if defined(OS_ANDROID) |
503 // Called when we send IME event that expects an ACK. | 509 // Called when we send IME event that expects an ACK. |
504 void OnImeEventSentForAck(const blink::WebTextInputInfo& info); | 510 void OnImeEventSentForAck(const blink::WebTextInputInfo& info); |
505 | 511 |
506 // Called by the browser process for every required IME acknowledgement. | 512 // Called by the browser process for every required IME acknowledgement. |
507 void OnImeEventAck(); | 513 void OnImeEventAck(); |
508 | 514 |
509 // Called by the browser process to update text input state. | 515 // Called by the browser process to update text input state. |
510 void OnRequestTextInputStateUpdate(); | 516 void OnRequestTextInputStateUpdate(); |
| 517 |
| 518 // Declared here to allow use of RenderWidget weak pointer. Overriden in |
| 519 // RenderViewImpl. |
| 520 virtual void LaunchAndroidContentIntent(const GURL& intent, |
| 521 size_t request_id, |
| 522 bool is_main_frame) {} |
| 523 |
| 524 // Utility function so LaunchAndroidContentIntent can remain protected. |
| 525 void scheduleContentIntentForRenderView(const blink::WebURL& intent, |
| 526 bool is_main_frame, |
| 527 size_t expected_content_intent_id); |
511 #endif | 528 #endif |
512 | 529 |
513 // Called by the browser process to update the cursor and composition | 530 // Called by the browser process to update the cursor and composition |
514 // information. | 531 // information. |
515 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request); | 532 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request); |
516 | 533 |
517 // Notify the compositor about a change in viewport size. This should be | 534 // Notify the compositor about a change in viewport size. This should be |
518 // used only with auto resize mode WebWidgets, as normal WebWidgets should | 535 // used only with auto resize mode WebWidgets, as normal WebWidgets should |
519 // go through OnResize. | 536 // go through OnResize. |
520 void AutoResizeCompositor(); | 537 void AutoResizeCompositor(); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 | 797 |
781 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState> | 798 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState> |
782 render_widget_scheduling_state_; | 799 render_widget_scheduling_state_; |
783 | 800 |
784 // Mouse Lock dispatcher attached to this view. | 801 // Mouse Lock dispatcher attached to this view. |
785 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; | 802 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; |
786 | 803 |
787 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. | 804 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. |
788 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; | 805 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; |
789 | 806 |
| 807 bool has_added_input_handler_; |
| 808 |
790 private: | 809 private: |
791 // Applies/Removes the DevTools device emulation transformation to/from a | 810 // Applies/Removes the DevTools device emulation transformation to/from a |
792 // window rect. | 811 // window rect. |
793 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; | 812 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; |
794 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; | 813 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; |
795 | 814 |
796 bool CreateWidget(int32_t opener_id, | 815 bool CreateWidget(int32_t opener_id, |
797 blink::WebPopupType popup_type, | 816 blink::WebPopupType popup_type, |
798 int32_t* routing_id); | 817 int32_t* routing_id); |
799 | 818 |
800 // Indicates whether this widget has focus. | 819 // Indicates whether this widget has focus. |
801 bool has_focus_; | 820 bool has_focus_; |
802 | 821 |
803 #if defined(OS_MACOSX) | 822 #if defined(OS_MACOSX) |
804 // Responds to IPCs from TextInputClientMac regarding getting string at given | 823 // Responds to IPCs from TextInputClientMac regarding getting string at given |
805 // position or range as well as finding character index at a given position. | 824 // position or range as well as finding character index at a given position. |
806 std::unique_ptr<TextInputClientObserver> text_input_client_observer_; | 825 std::unique_ptr<TextInputClientObserver> text_input_client_observer_; |
807 #endif | 826 #endif |
808 | 827 |
809 // This reference is set by the RenderFrame and is used to query the IME- | 828 // This reference is set by the RenderFrame and is used to query the IME- |
810 // related state from the plugin to later send to the browser. | 829 // related state from the plugin to later send to the browser. |
811 PepperPluginInstanceImpl* focused_pepper_plugin_; | 830 PepperPluginInstanceImpl* focused_pepper_plugin_; |
812 | 831 |
813 // Stores edit commands associated to the next key event. | 832 // Stores edit commands associated to the next key event. |
814 // Will be cleared as soon as the next key event is processed. | 833 // Will be cleared as soon as the next key event is processed. |
815 EditCommands edit_commands_; | 834 EditCommands edit_commands_; |
816 | 835 |
| 836 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
| 837 |
817 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 838 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
818 }; | 839 }; |
819 | 840 |
820 } // namespace content | 841 } // namespace content |
821 | 842 |
822 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 843 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |