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 { | |
jam
2012/11/08 20:37:06
nit: please move this to content/renderer/render_v
| |
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 13 matching lines...) Expand all Loading... | |
208 int32 routing_id, | 240 int32 routing_id, |
209 int32 surface_id, | 241 int32 surface_id, |
210 int64 session_storage_namespace_id, | 242 int64 session_storage_namespace_id, |
211 const string16& frame_name, | 243 const string16& frame_name, |
212 bool is_renderer_created, | 244 bool is_renderer_created, |
213 bool swapped_out, | 245 bool swapped_out, |
214 int32 next_page_id, | 246 int32 next_page_id, |
215 const WebKit::WebScreenInfo& screen_info, | 247 const WebKit::WebScreenInfo& screen_info, |
216 AccessibilityMode accessibility_mode); | 248 AccessibilityMode accessibility_mode); |
217 | 249 |
250 // Used by content_layouttest_support to hook into the creation of | |
251 // RenderViewImpls. | |
252 static void InstallCreateHook( | |
253 RenderViewImpl* (*create_render_view_impl)(RenderViewImplParams*)); | |
254 | |
218 // Returns the RenderViewImpl containing the given WebView. | 255 // Returns the RenderViewImpl containing the given WebView. |
219 CONTENT_EXPORT static RenderViewImpl* FromWebView(WebKit::WebView* webview); | 256 CONTENT_EXPORT static RenderViewImpl* FromWebView(WebKit::WebView* webview); |
220 | 257 |
221 // May return NULL when the view is closing. | 258 // May return NULL when the view is closing. |
222 CONTENT_EXPORT WebKit::WebView* webview() const; | 259 CONTENT_EXPORT WebKit::WebView* webview() const; |
223 | 260 |
224 // WebGraphicsContext3DSwapBuffersClient implementation. | 261 // WebGraphicsContext3DSwapBuffersClient implementation. |
225 | 262 |
226 // Called by a GraphicsContext associated with this view when swapbuffers | 263 // Called by a GraphicsContext associated with this view when swapbuffers |
227 // is posted, completes or is aborted. | 264 // is posted, completes or is aborted. |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 virtual void OnImeConfirmComposition( | 797 virtual void OnImeConfirmComposition( |
761 const string16& text, const ui::Range& replacement_range) OVERRIDE; | 798 const string16& text, const ui::Range& replacement_range) OVERRIDE; |
762 virtual void OnSetDeviceScaleFactor(float device_scale_factor) OVERRIDE; | 799 virtual void OnSetDeviceScaleFactor(float device_scale_factor) OVERRIDE; |
763 virtual ui::TextInputType GetTextInputType() OVERRIDE; | 800 virtual ui::TextInputType GetTextInputType() OVERRIDE; |
764 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE; | 801 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE; |
765 virtual void GetCompositionCharacterBounds( | 802 virtual void GetCompositionCharacterBounds( |
766 std::vector<gfx::Rect>* character_bounds) OVERRIDE; | 803 std::vector<gfx::Rect>* character_bounds) OVERRIDE; |
767 virtual bool CanComposeInline() OVERRIDE; | 804 virtual bool CanComposeInline() OVERRIDE; |
768 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE; | 805 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE; |
769 | 806 |
807 protected: | |
808 RenderViewImpl(RenderViewImplParams* params); | |
809 | |
810 // Do not delete directly. This class is reference counted. | |
811 virtual ~RenderViewImpl(); | |
812 | |
770 private: | 813 private: |
771 // For unit tests. | 814 // For unit tests. |
772 friend class ExternalPopupMenuTest; | 815 friend class ExternalPopupMenuTest; |
773 friend class PepperDeviceTest; | 816 friend class PepperDeviceTest; |
774 friend class RendererAccessibilityTest; | 817 friend class RendererAccessibilityTest; |
775 friend class WebIntentsHostTest; | 818 friend class WebIntentsHostTest; |
776 friend class RenderViewTest; | 819 friend class RenderViewTest; |
777 | 820 |
778 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); | 821 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); |
779 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); | 822 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); |
(...skipping 27 matching lines...) Expand all Loading... | |
807 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit); | 850 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit); |
808 | 851 |
809 typedef std::map<GURL, double> HostZoomLevels; | 852 typedef std::map<GURL, double> HostZoomLevels; |
810 | 853 |
811 enum ErrorPageType { | 854 enum ErrorPageType { |
812 DNS_ERROR, | 855 DNS_ERROR, |
813 HTTP_404, | 856 HTTP_404, |
814 CONNECTION_ERROR, | 857 CONNECTION_ERROR, |
815 }; | 858 }; |
816 | 859 |
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); | 860 void UpdateURL(WebKit::WebFrame* frame); |
835 void UpdateTitle(WebKit::WebFrame* frame, const string16& title, | 861 void UpdateTitle(WebKit::WebFrame* frame, const string16& title, |
836 WebKit::WebTextDirection title_direction); | 862 WebKit::WebTextDirection title_direction); |
837 void UpdateSessionHistory(WebKit::WebFrame* frame); | 863 void UpdateSessionHistory(WebKit::WebFrame* frame); |
838 void SendUpdateState(const WebKit::WebHistoryItem& item); | 864 void SendUpdateState(const WebKit::WebHistoryItem& item); |
839 | 865 |
840 // Update current main frame's encoding and send it to browser window. | 866 // 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 | 867 // Since we want to let users see the right encoding info from menu |
842 // before finishing loading, we call the UpdateEncoding in | 868 // before finishing loading, we call the UpdateEncoding in |
843 // a) function:DidCommitLoadForFrame. When this function is called, | 869 // 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 | 1581 // use the Observer interface to filter IPC messages and receive frame change |
1556 // notifications. | 1582 // notifications. |
1557 // --------------------------------------------------------------------------- | 1583 // --------------------------------------------------------------------------- |
1558 | 1584 |
1559 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); | 1585 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); |
1560 }; | 1586 }; |
1561 | 1587 |
1562 } // namespace content | 1588 } // namespace content |
1563 | 1589 |
1564 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 1590 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
OLD | NEW |