Chromium Code Reviews| 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 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 namespace IPC { | 47 namespace IPC { |
| 48 class SyncMessage; | 48 class SyncMessage; |
| 49 } | 49 } |
| 50 | 50 |
| 51 namespace WebKit { | 51 namespace WebKit { |
| 52 class WebGestureEvent; | 52 class WebGestureEvent; |
| 53 class WebInputEvent; | 53 class WebInputEvent; |
| 54 class WebKeyboardEvent; | 54 class WebKeyboardEvent; |
| 55 class WebMouseEvent; | 55 class WebMouseEvent; |
| 56 class WebTouchEvent; | 56 class WebTouchEvent; |
| 57 class WebTouchPoint; | |
| 57 struct WebPoint; | 58 struct WebPoint; |
| 58 struct WebRenderingStatsImpl; | 59 struct WebRenderingStatsImpl; |
| 59 } | 60 } |
| 60 | 61 |
| 61 namespace cc { class OutputSurface; } | 62 namespace cc { class OutputSurface; } |
| 62 | 63 |
| 63 namespace ui { | 64 namespace ui { |
| 64 class Range; | 65 class Range; |
| 65 } | 66 } |
| 66 | 67 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 virtual void SetBackground(const SkBitmap& bitmap); | 275 virtual void SetBackground(const SkBitmap& bitmap); |
| 275 | 276 |
| 276 // Resizes the render widget. | 277 // Resizes the render widget. |
| 277 void Resize(const gfx::Size& new_size, | 278 void Resize(const gfx::Size& new_size, |
| 278 const gfx::Size& physical_backing_size, | 279 const gfx::Size& physical_backing_size, |
| 279 float overdraw_bottom_height, | 280 float overdraw_bottom_height, |
| 280 const gfx::Rect& resizer_rect, | 281 const gfx::Rect& resizer_rect, |
| 281 bool is_fullscreen, | 282 bool is_fullscreen, |
| 282 ResizeAck resize_ack); | 283 ResizeAck resize_ack); |
| 283 | 284 |
| 285 // Emulates device and widget metrics. Supplied values override everything | |
| 286 // coming from host. | |
| 287 void EmulateDevice(bool enabled, | |
| 288 const gfx::Size& device_size, | |
| 289 const gfx::Rect& widget_rect, | |
| 290 float device_scale_factor, | |
| 291 bool fit_to_view); | |
| 292 | |
| 284 // RenderWidget IPC message handlers | 293 // RenderWidget IPC message handlers |
| 285 void OnHandleInputEvent(const WebKit::WebInputEvent* event, | 294 void OnHandleInputEvent(const WebKit::WebInputEvent* event, |
| 286 const ui::LatencyInfo& latency_info, | 295 const ui::LatencyInfo& latency_info, |
| 287 bool keyboard_shortcut); | 296 bool keyboard_shortcut); |
| 288 void OnCursorVisibilityChange(bool is_visible); | 297 void OnCursorVisibilityChange(bool is_visible); |
| 289 void OnMouseCaptureLost(); | 298 void OnMouseCaptureLost(); |
| 290 virtual void OnSetFocus(bool enable); | 299 virtual void OnSetFocus(bool enable); |
| 291 void OnClose(); | 300 void OnClose(); |
| 292 void OnCreatingNewAck(); | 301 void OnCreatingNewAck(); |
| 293 virtual void OnResize(const ViewMsg_Resize_Params& params); | 302 virtual void OnResize(const ViewMsg_Resize_Params& params); |
| 294 void OnChangeResizeRect(const gfx::Rect& resizer_rect); | 303 void OnChangeResizeRect(const gfx::Rect& resizer_rect); |
| 295 virtual void OnWasHidden(); | 304 virtual void OnWasHidden(); |
| 296 virtual void OnWasShown(bool needs_repainting); | 305 virtual void OnWasShown(bool needs_repainting); |
| 297 virtual void OnWasSwappedOut(); | 306 virtual void OnWasSwappedOut(); |
| 307 void OnEmulateDeviceAck(bool enabled); | |
| 298 void OnUpdateRectAck(); | 308 void OnUpdateRectAck(); |
| 299 void OnCreateVideoAck(int32 video_id); | 309 void OnCreateVideoAck(int32 video_id); |
| 300 void OnUpdateVideoAck(int32 video_id); | 310 void OnUpdateVideoAck(int32 video_id); |
| 301 void OnRequestMoveAck(); | 311 void OnRequestMoveAck(); |
| 302 void OnSetInputMethodActive(bool is_active); | 312 void OnSetInputMethodActive(bool is_active); |
| 303 virtual void OnImeSetComposition( | 313 virtual void OnImeSetComposition( |
| 304 const string16& text, | 314 const string16& text, |
| 305 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 315 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 306 int selection_start, | 316 int selection_start, |
| 307 int selection_end); | 317 int selection_end); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 728 | 738 |
| 729 uint32 next_output_surface_id_; | 739 uint32 next_output_surface_id_; |
| 730 | 740 |
| 731 #if defined(OS_ANDROID) | 741 #if defined(OS_ANDROID) |
| 732 // A counter for number of outstanding messages from the renderer to the | 742 // A counter for number of outstanding messages from the renderer to the |
| 733 // browser regarding IME-type events that have not been acknowledged by the | 743 // browser regarding IME-type events that have not been acknowledged by the |
| 734 // browser. If this value is not 0 IME events will be dropped. | 744 // browser. If this value is not 0 IME events will be dropped. |
| 735 int outstanding_ime_acks_; | 745 int outstanding_ime_acks_; |
| 736 #endif | 746 #endif |
| 737 | 747 |
| 748 // Helper class which is managing device emulation. | |
| 749 // TODO(dgozman): fit to view is not supported yet. | |
| 750 class DeviceEmulationHelper { | |
|
jam
2013/09/11 02:59:47
nit: since this is a private class, just forward d
dgozman
2013/09/13 11:32:36
Unfortunately, this class is also used by RenderVi
| |
| 751 public: | |
| 752 DeviceEmulationHelper(const gfx::Size& device_size, | |
| 753 const gfx::Rect& widget_rect, | |
| 754 float device_scale_factor, | |
| 755 bool fit_to_view); | |
| 756 virtual ~DeviceEmulationHelper(); | |
| 757 | |
| 758 void BeginEmulation(RenderWidget* widget); | |
| 759 void ChangeEmulationParams(RenderWidget* widget, | |
| 760 DeviceEmulationHelper* params); | |
| 761 void EndEmulation(RenderWidget* widget); | |
| 762 | |
| 763 void OnResizeMessage(RenderWidget* widget, | |
| 764 const ViewMsg_Resize_Params& params); | |
| 765 void OnUpdateScreenRectsMessage(RenderWidget* widget, | |
| 766 const gfx::Rect view_screen_rect, | |
| 767 const gfx::Rect window_screen_rect); | |
| 768 WebKit::WebInputEvent* ConvertInputEventToEmulated( | |
| 769 RenderWidget* widget, const WebKit::WebInputEvent* event); | |
| 770 | |
| 771 void PopupCreated(RenderWidget* widget, RenderWidget* popup); | |
| 772 WebKit::WebRect ConvertPopupScreenRectFromEmulated( | |
| 773 RenderWidget* popup, const WebKit::WebRect& rect); | |
| 774 | |
| 775 private: | |
| 776 void Apply(RenderWidget* widget, float overdraw_bottom_height, | |
| 777 gfx::Rect resizer_rect, bool is_fullscreen); | |
| 778 void ConvertMouseEventToEmulated(WebKit::WebMouseEvent* event); | |
| 779 void ConvertTouchPointToEmulated(WebKit::WebTouchPoint* point); | |
| 780 | |
| 781 gfx::Size device_size_; | |
| 782 gfx::Rect widget_rect_; | |
| 783 float device_scale_factor_; | |
| 784 bool fit_to_view_; | |
| 785 | |
| 786 gfx::Size original_size_; | |
| 787 gfx::Size original_physical_backing_size_; | |
| 788 WebKit::WebScreenInfo original_screen_info_; | |
| 789 gfx::Rect original_view_screen_rect_; | |
| 790 gfx::Rect original_window_screen_rect_; | |
| 791 | |
| 792 base::WeakPtrFactory<DeviceEmulationHelper> weak_ptr_factory_; | |
| 793 | |
| 794 DISALLOW_COPY_AND_ASSIGN(DeviceEmulationHelper); | |
| 795 }; | |
| 796 | |
| 797 scoped_ptr<DeviceEmulationHelper> device_emulation_helper_; | |
| 798 | |
| 799 // Popup has a weak ptr to the device emulation helper of creator. | |
| 800 base::WeakPtr<DeviceEmulationHelper> popup_device_emulation_helper_; | |
| 801 | |
| 802 // While we send ViewMsg_EmulateDevice to the host, these store the requested | |
| 803 // emulation parameters. | |
| 804 scoped_ptr<DeviceEmulationHelper> pending_device_emulation_helper_; | |
| 805 bool pending_device_emulation_enabled_; | |
| 806 | |
| 738 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; | 807 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
| 739 | 808 |
| 740 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 809 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
| 741 }; | 810 }; |
| 742 | 811 |
| 743 } // namespace content | 812 } // namespace content |
| 744 | 813 |
| 745 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 814 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
| OLD | NEW |