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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // When resumed from pause in debugger while handling mouse move, | 267 // When resumed from pause in debugger while handling mouse move, |
268 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger). | 268 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger). |
269 void IgnoreAckForMouseMoveFromDebugger(); | 269 void IgnoreAckForMouseMoveFromDebugger(); |
270 | 270 |
271 // ScreenMetricsEmulator class manages screen emulation inside a render | 271 // ScreenMetricsEmulator class manages screen emulation inside a render |
272 // widget. This includes resizing, placing view on the screen at desired | 272 // widget. This includes resizing, placing view on the screen at desired |
273 // position, changing device scale factor, and scaling down the whole | 273 // position, changing device scale factor, and scaling down the whole |
274 // widget if required to fit into the browser window. | 274 // widget if required to fit into the browser window. |
275 class ScreenMetricsEmulator; | 275 class ScreenMetricsEmulator; |
276 | 276 |
277 // Emulates screen and widget metrics. Supplied values override everything | |
278 // coming from host. | |
279 void EnableScreenMetricsEmulation( | |
280 const blink::WebDeviceEmulationParams& params); | |
281 void DisableScreenMetricsEmulation(); | |
282 void SetPopupOriginAdjustmentsForEmulation(ScreenMetricsEmulator* emulator); | 277 void SetPopupOriginAdjustmentsForEmulation(ScreenMetricsEmulator* emulator); |
283 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor); | 278 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor); |
284 | 279 |
285 void ScheduleCompositeWithForcedRedraw(); | 280 void ScheduleCompositeWithForcedRedraw(); |
286 | 281 |
287 // Called by the compositor in single-threaded mode when a swap is posted, | 282 // Called by the compositor in single-threaded mode when a swap is posted, |
288 // completes or is aborted. | 283 // completes or is aborted. |
289 void OnSwapBuffersPosted(); | 284 void OnSwapBuffersPosted(); |
290 void OnSwapBuffersComplete(); | 285 void OnSwapBuffersComplete(); |
291 void OnSwapBuffersAborted(); | 286 void OnSwapBuffersAborted(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 const gfx::Size& physical_backing_size, | 386 const gfx::Size& physical_backing_size, |
392 bool top_controls_shrink_blink_size, | 387 bool top_controls_shrink_blink_size, |
393 float top_controls_height, | 388 float top_controls_height, |
394 const gfx::Size& visible_viewport_size, | 389 const gfx::Size& visible_viewport_size, |
395 const gfx::Rect& resizer_rect, | 390 const gfx::Rect& resizer_rect, |
396 bool is_fullscreen, | 391 bool is_fullscreen, |
397 ResizeAck resize_ack); | 392 ResizeAck resize_ack); |
398 // Used to force the size of a window when running layout tests. | 393 // Used to force the size of a window when running layout tests. |
399 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect); | 394 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect); |
400 virtual void SetScreenMetricsEmulationParameters( | 395 virtual void SetScreenMetricsEmulationParameters( |
401 float device_scale_factor, | 396 bool enabled, |
402 const gfx::Point& root_layer_offset, | 397 const blink::WebDeviceEmulationParams& params); |
403 float root_layer_scale); | |
404 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 398 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
405 void SetExternalPopupOriginAdjustmentsForEmulation( | 399 void SetExternalPopupOriginAdjustmentsForEmulation( |
406 ExternalPopupMenu* popup, ScreenMetricsEmulator* emulator); | 400 ExternalPopupMenu* popup, ScreenMetricsEmulator* emulator); |
407 #endif | 401 #endif |
408 | 402 |
409 // RenderWidget IPC message handlers | 403 // RenderWidget IPC message handlers |
410 void OnHandleInputEvent(const blink::WebInputEvent* event, | 404 void OnHandleInputEvent(const blink::WebInputEvent* event, |
411 const ui::LatencyInfo& latency_info, | 405 const ui::LatencyInfo& latency_info, |
412 bool keyboard_shortcut); | 406 bool keyboard_shortcut); |
413 void OnCursorVisibilityChange(bool is_visible); | 407 void OnCursorVisibilityChange(bool is_visible); |
414 void OnMouseCaptureLost(); | 408 void OnMouseCaptureLost(); |
415 virtual void OnSetFocus(bool enable); | 409 virtual void OnSetFocus(bool enable); |
416 virtual void OnClose(); | 410 virtual void OnClose(); |
417 void OnCreatingNewAck(); | 411 void OnCreatingNewAck(); |
418 virtual void OnResize(const ViewMsg_Resize_Params& params); | 412 virtual void OnResize(const ViewMsg_Resize_Params& params); |
| 413 void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params); |
| 414 void OnDisableDeviceEmulation(); |
419 void OnColorProfile(const std::vector<char>& color_profile); | 415 void OnColorProfile(const std::vector<char>& color_profile); |
420 void OnChangeResizeRect(const gfx::Rect& resizer_rect); | 416 void OnChangeResizeRect(const gfx::Rect& resizer_rect); |
421 virtual void OnWasHidden(); | 417 virtual void OnWasHidden(); |
422 virtual void OnWasShown(bool needs_repainting, | 418 virtual void OnWasShown(bool needs_repainting, |
423 const ui::LatencyInfo& latency_info); | 419 const ui::LatencyInfo& latency_info); |
424 void OnCreateVideoAck(int32 video_id); | 420 void OnCreateVideoAck(int32 video_id); |
425 void OnUpdateVideoAck(int32 video_id); | 421 void OnUpdateVideoAck(int32 video_id); |
426 void OnRequestMoveAck(); | 422 void OnRequestMoveAck(); |
427 void OnSetInputMethodActive(bool is_active); | 423 void OnSetInputMethodActive(bool is_active); |
428 void OnCandidateWindowShown(); | 424 void OnCandidateWindowShown(); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 // The background color of the document body element. This is used as the | 773 // The background color of the document body element. This is used as the |
778 // default background color for filling the screen areas for which we don't | 774 // default background color for filling the screen areas for which we don't |
779 // have the actual content. | 775 // have the actual content. |
780 SkColor body_background_color_; | 776 SkColor body_background_color_; |
781 #endif | 777 #endif |
782 | 778 |
783 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_; | 779 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_; |
784 | 780 |
785 // Popups may be displaced when screen metrics emulation is enabled. | 781 // Popups may be displaced when screen metrics emulation is enabled. |
786 // These values are used to properly adjust popup position. | 782 // These values are used to properly adjust popup position. |
787 gfx::Point popup_view_origin_for_emulation_; | 783 gfx::PointF popup_view_origin_for_emulation_; |
788 gfx::Point popup_screen_origin_for_emulation_; | 784 gfx::PointF popup_screen_origin_for_emulation_; |
789 float popup_origin_scale_for_emulation_; | 785 float popup_origin_scale_for_emulation_; |
790 | 786 |
791 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; | 787 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
792 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; | 788 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; |
793 | 789 |
794 // Lists of RenderFrameProxy objects that need to be notified of | 790 // Lists of RenderFrameProxy objects that need to be notified of |
795 // compositing-related events (e.g. DidCommitCompositorFrame). | 791 // compositing-related events (e.g. DidCommitCompositorFrame). |
796 ObserverList<RenderFrameProxy> render_frame_proxies_; | 792 ObserverList<RenderFrameProxy> render_frame_proxies_; |
797 #if defined(VIDEO_HOLE) | 793 #if defined(VIDEO_HOLE) |
798 ObserverList<RenderFrameImpl> video_hole_frames_; | 794 ObserverList<RenderFrameImpl> video_hole_frames_; |
799 #endif // defined(VIDEO_HOLE) | 795 #endif // defined(VIDEO_HOLE) |
800 | 796 |
801 // A list of RenderFrames associated with this RenderWidget. Notifications | 797 // A list of RenderFrames associated with this RenderWidget. Notifications |
802 // are sent to each frame in the list for events such as changing | 798 // are sent to each frame in the list for events such as changing |
803 // visibility state for example. | 799 // visibility state for example. |
804 ObserverList<RenderFrameImpl> render_frames_; | 800 ObserverList<RenderFrameImpl> render_frames_; |
805 | 801 |
806 ui::MenuSourceType context_menu_source_type_; | 802 ui::MenuSourceType context_menu_source_type_; |
807 bool has_host_context_menu_location_; | 803 bool has_host_context_menu_location_; |
808 gfx::Point host_context_menu_location_; | 804 gfx::Point host_context_menu_location_; |
809 | 805 |
810 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 806 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
811 }; | 807 }; |
812 | 808 |
813 } // namespace content | 809 } // namespace content |
814 | 810 |
815 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 811 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |