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_VIEW_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // | 175 // |
176 // Therefore, each new top level RenderView creates a new counter and shares it | 176 // Therefore, each new top level RenderView creates a new counter and shares it |
177 // with all its children and grandchildren popup RenderViewImpls created with | 177 // with all its children and grandchildren popup RenderViewImpls created with |
178 // createView() to have a sort of global limit for the page so no more than | 178 // createView() to have a sort of global limit for the page so no more than |
179 // kMaximumNumberOfPopups popups are created. | 179 // kMaximumNumberOfPopups popups are created. |
180 // | 180 // |
181 // This is a RefCounted holder of an int because I can't say | 181 // This is a RefCounted holder of an int because I can't say |
182 // scoped_refptr<int>. | 182 // scoped_refptr<int>. |
183 typedef base::RefCountedData<int> SharedRenderViewCounter; | 183 typedef base::RefCountedData<int> SharedRenderViewCounter; |
184 | 184 |
| 185 // Container for all parameters passed to RenderViewImpl's constructor. |
| 186 struct RenderViewImplParams { |
| 187 RenderViewImplParams(int32 opener_id, |
| 188 const RendererPreferences& renderer_prefs, |
| 189 const webkit_glue::WebPreferences& webkit_prefs, |
| 190 SharedRenderViewCounter* counter, |
| 191 int32 routing_id, |
| 192 int32 surface_id, |
| 193 int64 session_storage_namespace_id, |
| 194 const string16& frame_name, |
| 195 bool is_renderer_created, |
| 196 bool swapped_out, |
| 197 int32 next_page_id, |
| 198 const WebKit::WebScreenInfo& screen_info, |
| 199 AccessibilityMode accessibility_mode); |
| 200 ~RenderViewImplParams(); |
| 201 |
| 202 int32 opener_id; |
| 203 const RendererPreferences& renderer_prefs; |
| 204 const webkit_glue::WebPreferences& webkit_prefs; |
| 205 SharedRenderViewCounter* counter; |
| 206 int32 routing_id; |
| 207 int32 surface_id; |
| 208 int64 session_storage_namespace_id; |
| 209 const string16& frame_name; |
| 210 bool is_renderer_created; |
| 211 bool swapped_out; |
| 212 int32 next_page_id; |
| 213 const WebKit::WebScreenInfo& screen_info; |
| 214 AccessibilityMode accessibility_mode; |
| 215 }; |
| 216 |
185 // | 217 // |
186 // RenderView is an object that manages a WebView object, and provides a | 218 // RenderView is an object that manages a WebView object, and provides a |
187 // communication interface with an embedding application process | 219 // communication interface with an embedding application process |
188 // | 220 // |
189 class RenderViewImpl : public RenderWidget, | 221 class RenderViewImpl : public RenderWidget, |
190 public WebKit::WebViewClient, | 222 public WebKit::WebViewClient, |
191 public WebKit::WebFrameClient, | 223 public WebKit::WebFrameClient, |
192 public WebKit::WebPageSerializerClient, | 224 public WebKit::WebPageSerializerClient, |
193 public RenderView, | 225 public RenderView, |
194 public webkit::npapi::WebPluginPageDelegate, | 226 public webkit::npapi::WebPluginPageDelegate, |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 virtual void OnImeConfirmComposition( | 792 virtual void OnImeConfirmComposition( |
761 const string16& text, const ui::Range& replacement_range) OVERRIDE; | 793 const string16& text, const ui::Range& replacement_range) OVERRIDE; |
762 virtual void OnSetDeviceScaleFactor(float device_scale_factor) OVERRIDE; | 794 virtual void OnSetDeviceScaleFactor(float device_scale_factor) OVERRIDE; |
763 virtual ui::TextInputType GetTextInputType() OVERRIDE; | 795 virtual ui::TextInputType GetTextInputType() OVERRIDE; |
764 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE; | 796 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE; |
765 virtual void GetCompositionCharacterBounds( | 797 virtual void GetCompositionCharacterBounds( |
766 std::vector<gfx::Rect>* character_bounds) OVERRIDE; | 798 std::vector<gfx::Rect>* character_bounds) OVERRIDE; |
767 virtual bool CanComposeInline() OVERRIDE; | 799 virtual bool CanComposeInline() OVERRIDE; |
768 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE; | 800 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE; |
769 | 801 |
| 802 protected: |
| 803 RenderViewImpl(RenderViewImplParams* params); |
| 804 |
| 805 // Do not delete directly. This class is reference counted. |
| 806 virtual ~RenderViewImpl(); |
| 807 |
770 private: | 808 private: |
771 // For unit tests. | 809 // For unit tests. |
772 friend class ExternalPopupMenuTest; | 810 friend class ExternalPopupMenuTest; |
773 friend class PepperDeviceTest; | 811 friend class PepperDeviceTest; |
774 friend class RendererAccessibilityTest; | 812 friend class RendererAccessibilityTest; |
775 friend class WebIntentsHostTest; | 813 friend class WebIntentsHostTest; |
776 friend class RenderViewTest; | 814 friend class RenderViewTest; |
777 | 815 |
778 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); | 816 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); |
779 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); | 817 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); |
(...skipping 27 matching lines...) Expand all Loading... |
807 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit); | 845 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit); |
808 | 846 |
809 typedef std::map<GURL, double> HostZoomLevels; | 847 typedef std::map<GURL, double> HostZoomLevels; |
810 | 848 |
811 enum ErrorPageType { | 849 enum ErrorPageType { |
812 DNS_ERROR, | 850 DNS_ERROR, |
813 HTTP_404, | 851 HTTP_404, |
814 CONNECTION_ERROR, | 852 CONNECTION_ERROR, |
815 }; | 853 }; |
816 | 854 |
817 RenderViewImpl(int32 opener_id, | |
818 const RendererPreferences& renderer_prefs, | |
819 const webkit_glue::WebPreferences& webkit_prefs, | |
820 SharedRenderViewCounter* counter, | |
821 int32 routing_id, | |
822 int32 surface_id, | |
823 int64 session_storage_namespace_id, | |
824 const string16& frame_name, | |
825 bool is_renderer_created, | |
826 bool swapped_out, | |
827 int32 next_page_id, | |
828 const WebKit::WebScreenInfo& screen_info, | |
829 AccessibilityMode accessibility_mode); | |
830 | |
831 // Do not delete directly. This class is reference counted. | |
832 virtual ~RenderViewImpl(); | |
833 | |
834 void UpdateURL(WebKit::WebFrame* frame); | 855 void UpdateURL(WebKit::WebFrame* frame); |
835 void UpdateTitle(WebKit::WebFrame* frame, const string16& title, | 856 void UpdateTitle(WebKit::WebFrame* frame, const string16& title, |
836 WebKit::WebTextDirection title_direction); | 857 WebKit::WebTextDirection title_direction); |
837 void UpdateSessionHistory(WebKit::WebFrame* frame); | 858 void UpdateSessionHistory(WebKit::WebFrame* frame); |
838 void SendUpdateState(const WebKit::WebHistoryItem& item); | 859 void SendUpdateState(const WebKit::WebHistoryItem& item); |
839 | 860 |
840 // Update current main frame's encoding and send it to browser window. | 861 // Update current main frame's encoding and send it to browser window. |
841 // Since we want to let users see the right encoding info from menu | 862 // Since we want to let users see the right encoding info from menu |
842 // before finishing loading, we call the UpdateEncoding in | 863 // before finishing loading, we call the UpdateEncoding in |
843 // a) function:DidCommitLoadForFrame. When this function is called, | 864 // a) function:DidCommitLoadForFrame. When this function is called, |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 // use the Observer interface to filter IPC messages and receive frame change | 1576 // use the Observer interface to filter IPC messages and receive frame change |
1556 // notifications. | 1577 // notifications. |
1557 // --------------------------------------------------------------------------- | 1578 // --------------------------------------------------------------------------- |
1558 | 1579 |
1559 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); | 1580 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); |
1560 }; | 1581 }; |
1561 | 1582 |
1562 } // namespace content | 1583 } // namespace content |
1563 | 1584 |
1564 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 1585 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
OLD | NEW |