| 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_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "ui/base/ime/text_input_mode.h" | 39 #include "ui/base/ime/text_input_mode.h" |
| 40 #include "ui/base/ime/text_input_type.h" | 40 #include "ui/base/ime/text_input_type.h" |
| 41 #include "ui/events/latency_info.h" | 41 #include "ui/events/latency_info.h" |
| 42 #include "ui/gfx/native_widget_types.h" | 42 #include "ui/gfx/native_widget_types.h" |
| 43 | 43 |
| 44 struct AcceleratedSurfaceMsg_BufferPresented_Params; | 44 struct AcceleratedSurfaceMsg_BufferPresented_Params; |
| 45 struct ViewHostMsg_BeginSmoothScroll_Params; | 45 struct ViewHostMsg_BeginSmoothScroll_Params; |
| 46 struct ViewHostMsg_SelectionBounds_Params; | 46 struct ViewHostMsg_SelectionBounds_Params; |
| 47 struct ViewHostMsg_TextInputState_Params; | 47 struct ViewHostMsg_TextInputState_Params; |
| 48 struct ViewHostMsg_UpdateRect_Params; | 48 struct ViewHostMsg_UpdateRect_Params; |
| 49 struct ViewMsg_Resize_Params; |
| 49 | 50 |
| 50 namespace base { | 51 namespace base { |
| 51 class TimeTicks; | 52 class TimeTicks; |
| 52 } | 53 } |
| 53 | 54 |
| 54 namespace cc { | 55 namespace cc { |
| 55 class CompositorFrame; | 56 class CompositorFrame; |
| 56 class CompositorFrameAck; | 57 class CompositorFrameAck; |
| 57 } | 58 } |
| 58 | 59 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 void SuppressNextCharEvents(); | 429 void SuppressNextCharEvents(); |
| 429 | 430 |
| 430 // Called by RenderWidgetHostView in response to OnSetNeedsFlushInput. | 431 // Called by RenderWidgetHostView in response to OnSetNeedsFlushInput. |
| 431 void FlushInput(); | 432 void FlushInput(); |
| 432 | 433 |
| 433 // InputRouterClient | 434 // InputRouterClient |
| 434 void SetNeedsFlush() override; | 435 void SetNeedsFlush() override; |
| 435 | 436 |
| 436 // Indicates whether the renderer drives the RenderWidgetHosts's size or the | 437 // Indicates whether the renderer drives the RenderWidgetHosts's size or the |
| 437 // other way around. | 438 // other way around. |
| 438 bool should_auto_resize() { return should_auto_resize_; } | 439 bool auto_resize_enabled() { return auto_resize_enabled_; } |
| 440 |
| 441 // The minimum size of this renderer when auto-resize is enabled. |
| 442 const gfx::Size& min_size_for_auto_resize() const { |
| 443 return min_size_for_auto_resize_; |
| 444 } |
| 445 |
| 446 // The maximum size of this renderer when auto-resize is enabled. |
| 447 const gfx::Size& max_size_for_auto_resize() const { |
| 448 return max_size_for_auto_resize_; |
| 449 } |
| 439 | 450 |
| 440 void FrameSwapped(const ui::LatencyInfo& latency_info); | 451 void FrameSwapped(const ui::LatencyInfo& latency_info); |
| 441 void DidReceiveRendererFrame(); | 452 void DidReceiveRendererFrame(); |
| 442 | 453 |
| 443 // Returns the ID that uniquely describes this component to the latency | 454 // Returns the ID that uniquely describes this component to the latency |
| 444 // subsystem. | 455 // subsystem. |
| 445 int64 GetLatencyComponentId() const; | 456 int64 GetLatencyComponentId() const; |
| 446 | 457 |
| 447 static void CompositorFrameDrawn( | 458 static void CompositorFrameDrawn( |
| 448 const std::vector<ui::LatencyInfo>& latency_info); | 459 const std::vector<ui::LatencyInfo>& latency_info); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 bool last_unlocked_by_target); | 547 bool last_unlocked_by_target); |
| 537 | 548 |
| 538 void RejectMouseLockOrUnlockIfNecessary(); | 549 void RejectMouseLockOrUnlockIfNecessary(); |
| 539 bool IsMouseLocked() const; | 550 bool IsMouseLocked() const; |
| 540 | 551 |
| 541 // RenderViewHost overrides this method to report when in fullscreen mode. | 552 // RenderViewHost overrides this method to report when in fullscreen mode. |
| 542 virtual bool IsFullscreen() const; | 553 virtual bool IsFullscreen() const; |
| 543 | 554 |
| 544 // Indicates if the render widget host should track the render widget's size | 555 // Indicates if the render widget host should track the render widget's size |
| 545 // as opposed to visa versa. | 556 // as opposed to visa versa. |
| 546 void SetShouldAutoResize(bool enable); | 557 void SetAutoResize(bool enable, |
| 558 const gfx::Size& min_size, |
| 559 const gfx::Size& max_size); |
| 560 |
| 561 // Fills in the |resize_params| struct. |
| 562 void GetResizeParams(ViewMsg_Resize_Params* resize_params); |
| 563 |
| 564 // Sets the |resize_params| that were sent to the renderer bundled with the |
| 565 // request to create a new RenderWidget. |
| 566 void SetInitialRenderSizeParams(const ViewMsg_Resize_Params& resize_params); |
| 547 | 567 |
| 548 // Expose increment/decrement of the in-flight event count, so | 568 // Expose increment/decrement of the in-flight event count, so |
| 549 // RenderViewHostImpl can account for in-flight beforeunload/unload events. | 569 // RenderViewHostImpl can account for in-flight beforeunload/unload events. |
| 550 int increment_in_flight_event_count() { return ++in_flight_event_count_; } | 570 int increment_in_flight_event_count() { return ++in_flight_event_count_; } |
| 551 int decrement_in_flight_event_count() { return --in_flight_event_count_; } | 571 int decrement_in_flight_event_count() { return --in_flight_event_count_; } |
| 552 | 572 |
| 553 // The View associated with the RenderViewHost. The lifetime of this object | 573 // The View associated with the RenderViewHost. The lifetime of this object |
| 554 // is associated with the lifetime of the Render process. If the Renderer | 574 // is associated with the lifetime of the Render process. If the Renderer |
| 555 // crashes, its View is destroyed and this pointer becomes NULL, even though | 575 // crashes, its View is destroyed and this pointer becomes NULL, even though |
| 556 // render_view_host_ lives on to load another URL (creating a new View while | 576 // render_view_host_ lives on to load another URL (creating a new View while |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 // The ID of the surface corresponding to this render widget. | 715 // The ID of the surface corresponding to this render widget. |
| 696 int surface_id_; | 716 int surface_id_; |
| 697 | 717 |
| 698 // Indicates whether a page is loading or not. | 718 // Indicates whether a page is loading or not. |
| 699 bool is_loading_; | 719 bool is_loading_; |
| 700 | 720 |
| 701 // Indicates whether a page is hidden or not. It has to stay in sync with the | 721 // Indicates whether a page is hidden or not. It has to stay in sync with the |
| 702 // most recent call to process_->WidgetRestored() / WidgetHidden(). | 722 // most recent call to process_->WidgetRestored() / WidgetHidden(). |
| 703 bool is_hidden_; | 723 bool is_hidden_; |
| 704 | 724 |
| 705 // Indicates whether a page is fullscreen or not. | |
| 706 bool is_fullscreen_; | |
| 707 | |
| 708 // Set if we are waiting for a repaint ack for the view. | 725 // Set if we are waiting for a repaint ack for the view. |
| 709 bool repaint_ack_pending_; | 726 bool repaint_ack_pending_; |
| 710 | 727 |
| 711 // True when waiting for RESIZE_ACK. | 728 // True when waiting for RESIZE_ACK. |
| 712 bool resize_ack_pending_; | 729 bool resize_ack_pending_; |
| 713 | 730 |
| 714 // Cached copy of the screen info so that it doesn't need to be updated every | 731 // Cached copy of the screen info so that it doesn't need to be updated every |
| 715 // time the window is resized. | 732 // time the window is resized. |
| 716 scoped_ptr<blink::WebScreenInfo> screen_info_; | 733 scoped_ptr<blink::WebScreenInfo> screen_info_; |
| 717 | 734 |
| 718 // Set if screen_info_ may have changed and should be recomputed and force a | 735 // Set if screen_info_ may have changed and should be recomputed and force a |
| 719 // resize message. | 736 // resize message. |
| 720 bool screen_info_out_of_date_; | 737 bool screen_info_out_of_date_; |
| 721 | 738 |
| 722 // The current size of the RenderWidget. | 739 // The current size of the RenderWidget. |
| 723 gfx::Size current_size_; | 740 gfx::Size current_size_; |
| 724 | 741 |
| 725 // The size of the view's backing surface in non-DPI-adjusted pixels. | 742 // Resize information that was previously sent to the renderer. |
| 726 gfx::Size physical_backing_size_; | 743 scoped_ptr<ViewMsg_Resize_Params> old_resize_params_; |
| 727 | |
| 728 // The amount that the viewport size given to Blink was shrunk by the URL-bar | |
| 729 // (always 0 on platforms where URL-bar hiding isn't supported). | |
| 730 float top_controls_layout_height_; | |
| 731 | |
| 732 // The size of the visible viewport, which may be smaller than the view if the | |
| 733 // view is partially occluded (e.g. by a virtual keyboard). The size is in | |
| 734 // DPI-adjusted pixels. | |
| 735 gfx::Size visible_viewport_size_; | |
| 736 | |
| 737 // The size we last sent as requested size to the renderer. |current_size_| | |
| 738 // is only updated once the resize message has been ack'd. This on the other | |
| 739 // hand is updated when the resize message is sent. This is very similar to | |
| 740 // |resize_ack_pending_|, but the latter is not set if the new size has width | |
| 741 // or height zero, which is why we need this too. | |
| 742 gfx::Size last_requested_size_; | |
| 743 | 744 |
| 744 // The next auto resize to send. | 745 // The next auto resize to send. |
| 745 gfx::Size new_auto_size_; | 746 gfx::Size new_auto_size_; |
| 746 | 747 |
| 747 // True if the render widget host should track the render widget's size as | 748 // True if the render widget host should track the render widget's size as |
| 748 // opposed to visa versa. | 749 // opposed to visa versa. |
| 749 bool should_auto_resize_; | 750 bool auto_resize_enabled_; |
| 751 |
| 752 // The minimum size for the render widget if auto-resize is enabled. |
| 753 gfx::Size min_size_for_auto_resize_; |
| 754 |
| 755 // The maximum size for the render widget if auto-resize is enabled. |
| 756 gfx::Size max_size_for_auto_resize_; |
| 750 | 757 |
| 751 bool waiting_for_screen_rects_ack_; | 758 bool waiting_for_screen_rects_ack_; |
| 752 gfx::Rect last_view_screen_rect_; | 759 gfx::Rect last_view_screen_rect_; |
| 753 gfx::Rect last_window_screen_rect_; | 760 gfx::Rect last_window_screen_rect_; |
| 754 | 761 |
| 755 // Keyboard event listeners. | 762 // Keyboard event listeners. |
| 756 std::vector<KeyPressEventCallback> key_press_event_callbacks_; | 763 std::vector<KeyPressEventCallback> key_press_event_callbacks_; |
| 757 | 764 |
| 758 // Mouse event callbacks. | 765 // Mouse event callbacks. |
| 759 std::vector<MouseEventCallback> mouse_event_callbacks_; | 766 std::vector<MouseEventCallback> mouse_event_callbacks_; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 cc::RollingTimeDeltaHistory browser_composite_latency_history_; | 853 cc::RollingTimeDeltaHistory browser_composite_latency_history_; |
| 847 | 854 |
| 848 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 855 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
| 849 | 856 |
| 850 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 857 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
| 851 }; | 858 }; |
| 852 | 859 |
| 853 } // namespace content | 860 } // namespace content |
| 854 | 861 |
| 855 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 862 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| OLD | NEW |