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 <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
16 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
18 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
19 #include "cc/debug/rendering_stats_instrumentation.h" | 20 #include "cc/debug/rendering_stats_instrumentation.h" |
20 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
21 #include "content/common/cursors/webcursor.h" | 22 #include "content/common/cursors/webcursor.h" |
22 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 23 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
23 #include "content/common/input/synthetic_gesture_params.h" | 24 #include "content/common/input/synthetic_gesture_params.h" |
| 25 #include "content/renderer/message_delivery_policy.h" |
24 #include "ipc/ipc_listener.h" | 26 #include "ipc/ipc_listener.h" |
25 #include "ipc/ipc_sender.h" | 27 #include "ipc/ipc_sender.h" |
26 #include "third_party/WebKit/public/platform/WebRect.h" | 28 #include "third_party/WebKit/public/platform/WebRect.h" |
27 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 29 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
28 #include "third_party/WebKit/public/web/WebInputEvent.h" | 30 #include "third_party/WebKit/public/web/WebInputEvent.h" |
29 #include "third_party/WebKit/public/web/WebPopupType.h" | 31 #include "third_party/WebKit/public/web/WebPopupType.h" |
30 #include "third_party/WebKit/public/web/WebTextDirection.h" | 32 #include "third_party/WebKit/public/web/WebTextDirection.h" |
31 #include "third_party/WebKit/public/web/WebTextInputInfo.h" | 33 #include "third_party/WebKit/public/web/WebTextInputInfo.h" |
32 #include "third_party/WebKit/public/web/WebTouchAction.h" | 34 #include "third_party/WebKit/public/web/WebTouchAction.h" |
33 #include "third_party/WebKit/public/web/WebWidget.h" | 35 #include "third_party/WebKit/public/web/WebWidget.h" |
34 #include "third_party/WebKit/public/web/WebWidgetClient.h" | 36 #include "third_party/WebKit/public/web/WebWidgetClient.h" |
35 #include "third_party/skia/include/core/SkBitmap.h" | 37 #include "third_party/skia/include/core/SkBitmap.h" |
36 #include "ui/base/ime/text_input_mode.h" | 38 #include "ui/base/ime/text_input_mode.h" |
37 #include "ui/base/ime/text_input_type.h" | 39 #include "ui/base/ime/text_input_type.h" |
38 #include "ui/base/ui_base_types.h" | 40 #include "ui/base/ui_base_types.h" |
39 #include "ui/gfx/native_widget_types.h" | 41 #include "ui/gfx/native_widget_types.h" |
40 #include "ui/gfx/range/range.h" | 42 #include "ui/gfx/range/range.h" |
41 #include "ui/gfx/rect.h" | 43 #include "ui/gfx/rect.h" |
42 #include "ui/gfx/vector2d.h" | 44 #include "ui/gfx/vector2d.h" |
43 #include "ui/gfx/vector2d_f.h" | 45 #include "ui/gfx/vector2d_f.h" |
44 #include "ui/surface/transport_dib.h" | 46 #include "ui/surface/transport_dib.h" |
45 | 47 |
46 struct ViewHostMsg_UpdateRect_Params; | 48 struct ViewHostMsg_UpdateRect_Params; |
47 struct ViewMsg_Resize_Params; | 49 struct ViewMsg_Resize_Params; |
48 class ViewHostMsg_UpdateRect; | 50 class ViewHostMsg_UpdateRect; |
49 | 51 |
50 namespace IPC { | 52 namespace IPC { |
51 class SyncMessage; | 53 class SyncMessage; |
| 54 class SyncMessageFilter; |
52 } | 55 } |
53 | 56 |
54 namespace blink { | 57 namespace blink { |
55 struct WebDeviceEmulationParams; | 58 struct WebDeviceEmulationParams; |
56 class WebGestureEvent; | 59 class WebGestureEvent; |
57 class WebKeyboardEvent; | 60 class WebKeyboardEvent; |
58 class WebMouseEvent; | 61 class WebMouseEvent; |
59 class WebTouchEvent; | 62 class WebTouchEvent; |
60 } | 63 } |
61 | 64 |
62 namespace cc { class OutputSurface; } | 65 namespace cc { |
| 66 class OutputSurface; |
| 67 class SwapPromise; |
| 68 } |
63 | 69 |
64 namespace gfx { | 70 namespace gfx { |
65 class Range; | 71 class Range; |
66 } | 72 } |
67 | 73 |
68 namespace content { | 74 namespace content { |
69 class ExternalPopupMenu; | 75 class ExternalPopupMenu; |
| 76 class FrameSwapMessageQueue; |
70 class PepperPluginInstanceImpl; | 77 class PepperPluginInstanceImpl; |
71 class RenderFrameImpl; | 78 class RenderFrameImpl; |
72 class RenderFrameProxy; | 79 class RenderFrameProxy; |
73 class RenderWidgetCompositor; | 80 class RenderWidgetCompositor; |
74 class RenderWidgetTest; | 81 class RenderWidgetTest; |
75 class ResizingModeSelector; | 82 class ResizingModeSelector; |
76 struct ContextMenuParams; | 83 struct ContextMenuParams; |
77 struct WebPluginGeometry; | 84 struct WebPluginGeometry; |
78 | 85 |
79 // RenderWidget provides a communication bridge between a WebWidget and | 86 // RenderWidget provides a communication bridge between a WebWidget and |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 void QueueSyntheticGesture( | 193 void QueueSyntheticGesture( |
187 scoped_ptr<SyntheticGestureParams> gesture_params, | 194 scoped_ptr<SyntheticGestureParams> gesture_params, |
188 const SyntheticGestureCompletionCallback& callback); | 195 const SyntheticGestureCompletionCallback& callback); |
189 | 196 |
190 // Close the underlying WebWidget. | 197 // Close the underlying WebWidget. |
191 virtual void Close(); | 198 virtual void Close(); |
192 | 199 |
193 // Notifies about a compositor frame commit operation having finished. | 200 // Notifies about a compositor frame commit operation having finished. |
194 virtual void DidCommitCompositorFrame(); | 201 virtual void DidCommitCompositorFrame(); |
195 | 202 |
| 203 // Deliveres |message| together with compositor state change updates. The |
| 204 // exact behavior depends on |policy|. |
| 205 // FIFO ordering is preserved between messages enqueued with the same |
| 206 // |policy|, the ordering between messages enqueued for different policies is |
| 207 // undefined. |
| 208 // |
| 209 // |msg| message to send, ownership of |msg| is transferred. |
| 210 // |policy| see the comment on MessageDeliveryPolicy. |
| 211 void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy); |
| 212 |
196 // Handle common setup/teardown for handling IME events. | 213 // Handle common setup/teardown for handling IME events. |
197 void StartHandlingImeEvent(); | 214 void StartHandlingImeEvent(); |
198 void FinishHandlingImeEvent(); | 215 void FinishHandlingImeEvent(); |
199 | 216 |
200 // Returns whether we currently should handle an IME event. | 217 // Returns whether we currently should handle an IME event. |
201 bool ShouldHandleImeEvent(); | 218 bool ShouldHandleImeEvent(); |
202 | 219 |
203 virtual void InstrumentWillBeginFrame(int frame_id) {} | 220 virtual void InstrumentWillBeginFrame(int frame_id) {} |
204 virtual void InstrumentDidBeginFrame() {} | 221 virtual void InstrumentDidBeginFrame() {} |
205 virtual void InstrumentDidCancelFrame() {} | 222 virtual void InstrumentDidCancelFrame() {} |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // state. | 430 // state. |
414 void SetHidden(bool hidden); | 431 void SetHidden(bool hidden); |
415 | 432 |
416 void WillToggleFullscreen(); | 433 void WillToggleFullscreen(); |
417 void DidToggleFullscreen(); | 434 void DidToggleFullscreen(); |
418 | 435 |
419 bool next_paint_is_resize_ack() const; | 436 bool next_paint_is_resize_ack() const; |
420 void set_next_paint_is_resize_ack(); | 437 void set_next_paint_is_resize_ack(); |
421 void set_next_paint_is_repaint_ack(); | 438 void set_next_paint_is_repaint_ack(); |
422 | 439 |
| 440 // QueueMessage implementation extracted into a static method for easy |
| 441 // testing. |
| 442 static scoped_ptr<cc::SwapPromise> QueueMessageImpl( |
| 443 IPC::Message* msg, |
| 444 MessageDeliveryPolicy policy, |
| 445 FrameSwapMessageQueue* frame_swap_message_queue, |
| 446 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter, |
| 447 bool commit_requested, |
| 448 int source_frame_number); |
| 449 |
423 // Override point to obtain that the current input method state and caret | 450 // Override point to obtain that the current input method state and caret |
424 // position. | 451 // position. |
425 virtual ui::TextInputType GetTextInputType(); | 452 virtual ui::TextInputType GetTextInputType(); |
426 virtual ui::TextInputType WebKitToUiTextInputType( | 453 virtual ui::TextInputType WebKitToUiTextInputType( |
427 blink::WebTextInputType type); | 454 blink::WebTextInputType type); |
428 | 455 |
429 #if defined(OS_MACOSX) || defined(USE_AURA) | 456 #if defined(OS_MACOSX) || defined(USE_AURA) |
430 // Override point to obtain that the current composition character bounds. | 457 // Override point to obtain that the current composition character bounds. |
431 // In the case of surrogate pairs, the character is treated as two characters: | 458 // In the case of surrogate pairs, the character is treated as two characters: |
432 // the bounds for first character is actual one, and the bounds for second | 459 // the bounds for first character is actual one, and the bounds for second |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 #endif | 712 #endif |
686 | 713 |
687 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_; | 714 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_; |
688 | 715 |
689 // Popups may be displaced when screen metrics emulation is enabled. | 716 // Popups may be displaced when screen metrics emulation is enabled. |
690 // These values are used to properly adjust popup position. | 717 // These values are used to properly adjust popup position. |
691 gfx::Point popup_view_origin_for_emulation_; | 718 gfx::Point popup_view_origin_for_emulation_; |
692 gfx::Point popup_screen_origin_for_emulation_; | 719 gfx::Point popup_screen_origin_for_emulation_; |
693 float popup_origin_scale_for_emulation_; | 720 float popup_origin_scale_for_emulation_; |
694 | 721 |
| 722 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
695 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; | 723 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; |
696 | 724 |
697 // Lists of RenderFrameProxy objects that need to be notified of | 725 // Lists of RenderFrameProxy objects that need to be notified of |
698 // compositing-related events (e.g. DidCommitCompositorFrame). | 726 // compositing-related events (e.g. DidCommitCompositorFrame). |
699 ObserverList<RenderFrameProxy> render_frame_proxies_; | 727 ObserverList<RenderFrameProxy> render_frame_proxies_; |
700 #if defined(VIDEO_HOLE) | 728 #if defined(VIDEO_HOLE) |
701 ObserverList<RenderFrameImpl> video_hole_frames_; | 729 ObserverList<RenderFrameImpl> video_hole_frames_; |
702 #endif // defined(VIDEO_HOLE) | 730 #endif // defined(VIDEO_HOLE) |
703 | 731 |
704 // A list of RenderFrames associated with this RenderWidget. Notifications | 732 // A list of RenderFrames associated with this RenderWidget. Notifications |
705 // are sent to each frame in the list for events such as changing | 733 // are sent to each frame in the list for events such as changing |
706 // visibility state for example. | 734 // visibility state for example. |
707 ObserverList<RenderFrameImpl> render_frames_; | 735 ObserverList<RenderFrameImpl> render_frames_; |
708 | 736 |
709 ui::MenuSourceType context_menu_source_type_; | 737 ui::MenuSourceType context_menu_source_type_; |
710 gfx::Point touch_editing_context_menu_location_; | 738 gfx::Point touch_editing_context_menu_location_; |
711 | 739 |
712 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 740 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
713 }; | 741 }; |
714 | 742 |
715 } // namespace content | 743 } // namespace content |
716 | 744 |
717 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 745 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |