| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_H_ |
| 6 #define CONTENT_RENDERER_RENDER_VIEW_H_ | 6 #define CONTENT_RENDERER_RENDER_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 class ExternalHostBindings; | 61 class ExternalHostBindings; |
| 62 class ExternalPopupMenu; | 62 class ExternalPopupMenu; |
| 63 class FilePath; | 63 class FilePath; |
| 64 class GeolocationDispatcher; | 64 class GeolocationDispatcher; |
| 65 class GURL; | 65 class GURL; |
| 66 class LoadProgressTracker; | 66 class LoadProgressTracker; |
| 67 class NavigationState; | 67 class NavigationState; |
| 68 class NotificationProvider; | 68 class NotificationProvider; |
| 69 class P2PSocketDispatcher; | 69 class P2PSocketDispatcher; |
| 70 class PepperDeviceTest; | 70 class PepperDeviceTest; |
| 71 class PrintWebViewHelper; | |
| 72 class RenderViewObserver; | 71 class RenderViewObserver; |
| 73 class RenderViewVisitor; | 72 class RenderViewVisitor; |
| 74 class SearchBox; | 73 class SearchBox; |
| 75 class SkBitmap; | 74 class SkBitmap; |
| 76 class SpeechInputDispatcher; | 75 class SpeechInputDispatcher; |
| 77 class SpellCheckProvider; | |
| 78 class WebPluginDelegatePepper; | 76 class WebPluginDelegatePepper; |
| 79 class WebPluginDelegateProxy; | 77 class WebPluginDelegateProxy; |
| 80 class WebUIBindings; | 78 class WebUIBindings; |
| 81 struct ContextMenuMediaParams; | 79 struct ContextMenuMediaParams; |
| 82 struct ExtensionMsg_ExecuteCode_Params; | 80 struct ExtensionMsg_ExecuteCode_Params; |
| 83 struct PP_Flash_NetAddress; | 81 struct PP_Flash_NetAddress; |
| 84 struct ThumbnailScore; | 82 struct ThumbnailScore; |
| 85 struct ViewHostMsg_GetSearchProviderInstallState_Params; | 83 struct ViewHostMsg_GetSearchProviderInstallState_Params; |
| 86 struct ViewHostMsg_PageHasOSDD_Type; | 84 struct ViewHostMsg_PageHasOSDD_Type; |
| 87 struct ViewHostMsg_RunFileChooser_Params; | 85 struct ViewHostMsg_RunFileChooser_Params; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 struct FormData; | 123 struct FormData; |
| 126 struct PasswordFormFillData; | 124 struct PasswordFormFillData; |
| 127 class ResourceFetcher; | 125 class ResourceFetcher; |
| 128 } | 126 } |
| 129 | 127 |
| 130 namespace WebKit { | 128 namespace WebKit { |
| 131 class WebAccessibilityCache; | 129 class WebAccessibilityCache; |
| 132 class WebAccessibilityObject; | 130 class WebAccessibilityObject; |
| 133 class WebApplicationCacheHost; | 131 class WebApplicationCacheHost; |
| 134 class WebApplicationCacheHostClient; | 132 class WebApplicationCacheHostClient; |
| 133 class WebAutoFillClient; |
| 135 class WebDataSource; | 134 class WebDataSource; |
| 135 class WebDevToolsAgentClient; |
| 136 class WebDocument; | 136 class WebDocument; |
| 137 class WebDragData; | 137 class WebDragData; |
| 138 class WebFrame; | 138 class WebFrame; |
| 139 class WebGeolocationClient; | 139 class WebGeolocationClient; |
| 140 class WebGeolocationServiceInterface; | 140 class WebGeolocationServiceInterface; |
| 141 class WebImage; | 141 class WebImage; |
| 142 class WebInputElement; | 142 class WebInputElement; |
| 143 class WebKeyboardEvent; | 143 class WebKeyboardEvent; |
| 144 class WebMediaPlayer; | 144 class WebMediaPlayer; |
| 145 class WebMediaPlayerClient; | 145 class WebMediaPlayerClient; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 public WebKit::WebPageSerializerClient, | 184 public WebKit::WebPageSerializerClient, |
| 185 public webkit::npapi::WebPluginPageDelegate, | 185 public webkit::npapi::WebPluginPageDelegate, |
| 186 public base::SupportsWeakPtr<RenderView> { | 186 public base::SupportsWeakPtr<RenderView> { |
| 187 public: | 187 public: |
| 188 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the | 188 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the |
| 189 // parent of the WebView HWND that will be created. If this is a constrained | 189 // parent of the WebView HWND that will be created. If this is a constrained |
| 190 // popup or as a new tab, opener_id is the routing ID of the RenderView | 190 // popup or as a new tab, opener_id is the routing ID of the RenderView |
| 191 // responsible for creating this RenderView (corresponding to parent_hwnd). | 191 // responsible for creating this RenderView (corresponding to parent_hwnd). |
| 192 // |counter| is either a currently initialized counter, or NULL (in which case | 192 // |counter| is either a currently initialized counter, or NULL (in which case |
| 193 // we treat this RenderView as a top level window). | 193 // we treat this RenderView as a top level window). |
| 194 static RenderView* Create( | 194 static RenderView* Create(RenderThreadBase* render_thread, |
| 195 RenderThreadBase* render_thread, | 195 const WebPreferences& webkit_prefs, |
| 196 gfx::NativeViewId parent_hwnd, | 196 SharedRenderViewCounter* counter, |
| 197 int32 opener_id, | 197 int32 routing_id, |
| 198 const RendererPreferences& renderer_prefs, | 198 int64 session_storage_namespace_id); |
| 199 const WebPreferences& webkit_prefs, | |
| 200 SharedRenderViewCounter* counter, | |
| 201 int32 routing_id, | |
| 202 int64 session_storage_namespace_id, | |
| 203 const string16& frame_name); | |
| 204 | 199 |
| 205 // Visit all RenderViews with a live WebView (i.e., RenderViews that have | 200 // Visit all RenderViews with a live WebView (i.e., RenderViews that have |
| 206 // been closed but not yet destroyed are excluded). | 201 // been closed but not yet destroyed are excluded). |
| 207 static void ForEach(RenderViewVisitor* visitor); | 202 static void ForEach(RenderViewVisitor* visitor); |
| 208 | 203 |
| 209 // Returns the RenderView containing the given WebView. | 204 // Returns the RenderView containing the given WebView. |
| 210 static RenderView* FromWebView(WebKit::WebView* webview); | 205 static RenderView* FromWebView(WebKit::WebView* webview); |
| 211 | 206 |
| 212 // Sets the "next page id" counter. | 207 // Sets the "next page id" counter. |
| 213 static void SetNextPageID(int32 next_page_id); | 208 static void SetNextPageID(int32 next_page_id); |
| 214 | 209 |
| 210 void Init(gfx::NativeViewId parent_hwnd, |
| 211 int32 opener_id, |
| 212 const RendererPreferences& renderer_prefs, |
| 213 const string16& frame_name, |
| 214 WebKit::WebAutoFillClient* autofill_agent, |
| 215 WebKit::WebDevToolsAgentClient* devtools_agent); |
| 216 |
| 215 // May return NULL when the view is closing. | 217 // May return NULL when the view is closing. |
| 216 WebKit::WebView* webview() const; | 218 WebKit::WebView* webview() const; |
| 217 | 219 |
| 218 int browser_window_id() const { | 220 int browser_window_id() const { |
| 219 return browser_window_id_; | 221 return browser_window_id_; |
| 220 } | 222 } |
| 221 | 223 |
| 222 ViewType::Type view_type() const { | 224 ViewType::Type view_type() const { |
| 223 return view_type_; | 225 return view_type_; |
| 224 } | 226 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 240 } | 242 } |
| 241 | 243 |
| 242 // Returns true if we should display scrollbars for the given view size and | 244 // Returns true if we should display scrollbars for the given view size and |
| 243 // false if the scrollbars should be hidden. | 245 // false if the scrollbars should be hidden. |
| 244 bool should_display_scrollbars(int width, int height) const { | 246 bool should_display_scrollbars(int width, int height) const { |
| 245 return (!send_preferred_size_changes_ || | 247 return (!send_preferred_size_changes_ || |
| 246 (disable_scrollbars_size_limit_.width() <= width || | 248 (disable_scrollbars_size_limit_.width() <= width || |
| 247 disable_scrollbars_size_limit_.height() <= height)); | 249 disable_scrollbars_size_limit_.height() <= height)); |
| 248 } | 250 } |
| 249 | 251 |
| 250 SearchBox* searchbox() const { return searchbox_; } | |
| 251 | |
| 252 const WebKit::WebNode& context_menu_node() { return context_menu_node_; } | 252 const WebKit::WebNode& context_menu_node() { return context_menu_node_; } |
| 253 | 253 |
| 254 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. | 254 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. |
| 255 P2PSocketDispatcher* p2p_socket_dispatcher() { | 255 P2PSocketDispatcher* p2p_socket_dispatcher() { |
| 256 return p2p_socket_dispatcher_; | 256 return p2p_socket_dispatcher_; |
| 257 } | 257 } |
| 258 | 258 |
| 259 // Functions to add and remove observers for this object. | 259 // Functions to add and remove observers for this object. |
| 260 void AddObserver(RenderViewObserver* observer); | 260 void AddObserver(RenderViewObserver* observer); |
| 261 void RemoveObserver(RenderViewObserver* observer); | 261 void RemoveObserver(RenderViewObserver* observer); |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 friend class chrome::ChromeContentRendererClient; | 654 friend class chrome::ChromeContentRendererClient; |
| 655 | 655 |
| 656 // For unit tests. | 656 // For unit tests. |
| 657 friend class ExternalPopupMenuTest; | 657 friend class ExternalPopupMenuTest; |
| 658 friend class PepperDeviceTest; | 658 friend class PepperDeviceTest; |
| 659 friend class RenderViewTest; | 659 friend class RenderViewTest; |
| 660 | 660 |
| 661 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); | 661 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); |
| 662 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); | 662 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); |
| 663 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate); | 663 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate); |
| 664 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, BlockScriptInitiatedPrinting); | |
| 665 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, ImeComposition); | 664 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, ImeComposition); |
| 666 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, InsertCharacters); | 665 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, InsertCharacters); |
| 667 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, JSBlockSentAfterPageLoad); | 666 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, JSBlockSentAfterPageLoad); |
| 668 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, LastCommittedUpdateState); | 667 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, LastCommittedUpdateState); |
| 669 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnHandleKeyboardEvent); | 668 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnHandleKeyboardEvent); |
| 670 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnImeStateChanged); | 669 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnImeStateChanged); |
| 671 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnNavStateChanged); | 670 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnNavStateChanged); |
| 672 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnPrintPages); | |
| 673 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnSetTextDirection); | 671 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnSetTextDirection); |
| 674 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, PrintLayoutTest); | |
| 675 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, PrintWithIframe); | |
| 676 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, UpdateTargetURLWithInvalidURL); | 672 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, UpdateTargetURLWithInvalidURL); |
| 677 #if defined(OS_MACOSX) | 673 #if defined(OS_MACOSX) |
| 678 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); | 674 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); |
| 679 #endif | 675 #endif |
| 680 | 676 |
| 681 typedef std::map<GURL, ContentSettings> HostContentSettings; | 677 typedef std::map<GURL, ContentSettings> HostContentSettings; |
| 682 typedef std::map<GURL, double> HostZoomLevels; | 678 typedef std::map<GURL, double> HostZoomLevels; |
| 683 | 679 |
| 684 // Cannot use std::set unfortunately since linked_ptr<> does not support | 680 // Cannot use std::set unfortunately since linked_ptr<> does not support |
| 685 // operator<. | 681 // operator<. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 698 WebKit::WebAccessibilityNotification type; | 694 WebKit::WebAccessibilityNotification type; |
| 699 }; | 695 }; |
| 700 | 696 |
| 701 enum ErrorPageType { | 697 enum ErrorPageType { |
| 702 DNS_ERROR, | 698 DNS_ERROR, |
| 703 HTTP_404, | 699 HTTP_404, |
| 704 CONNECTION_ERROR, | 700 CONNECTION_ERROR, |
| 705 }; | 701 }; |
| 706 | 702 |
| 707 RenderView(RenderThreadBase* render_thread, | 703 RenderView(RenderThreadBase* render_thread, |
| 708 gfx::NativeViewId parent_hwnd, | |
| 709 int32 opener_id, | |
| 710 const RendererPreferences& renderer_prefs, | |
| 711 const WebPreferences& webkit_prefs, | 704 const WebPreferences& webkit_prefs, |
| 712 SharedRenderViewCounter* counter, | 705 SharedRenderViewCounter* counter, |
| 713 int32 routing_id, | 706 int32 routing_id, |
| 714 int64 session_storage_namespace_id, | 707 int64 session_storage_namespace_id); |
| 715 const string16& frame_name); | |
| 716 | 708 |
| 717 // Do not delete directly. This class is reference counted. | 709 // Do not delete directly. This class is reference counted. |
| 718 virtual ~RenderView(); | 710 virtual ~RenderView(); |
| 719 | 711 |
| 720 void UpdateURL(WebKit::WebFrame* frame); | 712 void UpdateURL(WebKit::WebFrame* frame); |
| 721 void UpdateTitle(WebKit::WebFrame* frame, const string16& title); | 713 void UpdateTitle(WebKit::WebFrame* frame, const string16& title); |
| 722 void UpdateSessionHistory(WebKit::WebFrame* frame); | 714 void UpdateSessionHistory(WebKit::WebFrame* frame); |
| 723 | 715 |
| 724 // Update current main frame's encoding and send it to browser window. | 716 // Update current main frame's encoding and send it to browser window. |
| 725 // Since we want to let users see the right encoding info from menu | 717 // Since we want to let users see the right encoding info from menu |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 | 1264 |
| 1273 ScopedRunnableMethodFactory<RenderView> page_info_method_factory_; | 1265 ScopedRunnableMethodFactory<RenderView> page_info_method_factory_; |
| 1274 ScopedRunnableMethodFactory<RenderView> accessibility_method_factory_; | 1266 ScopedRunnableMethodFactory<RenderView> accessibility_method_factory_; |
| 1275 | 1267 |
| 1276 RendererWebCookieJarImpl cookie_jar_; | 1268 RendererWebCookieJarImpl cookie_jar_; |
| 1277 | 1269 |
| 1278 // The next group of objects all implement RenderViewObserver, so are deleted | 1270 // The next group of objects all implement RenderViewObserver, so are deleted |
| 1279 // along with the RenderView automatically. This is why we just store weak | 1271 // along with the RenderView automatically. This is why we just store weak |
| 1280 // references. | 1272 // references. |
| 1281 | 1273 |
| 1282 // Provides access to this renderer from the remote Inspector UI. | |
| 1283 DevToolsAgent* devtools_agent_; | |
| 1284 | |
| 1285 // DevToolsClient for renderer hosting developer tools UI. It's NULL for other | 1274 // DevToolsClient for renderer hosting developer tools UI. It's NULL for other |
| 1286 // render views. | 1275 // render views. |
| 1287 DevToolsClient* devtools_client_; | 1276 DevToolsClient* devtools_client_; |
| 1288 | 1277 |
| 1289 // Holds a reference to the service which provides desktop notifications. | 1278 // Holds a reference to the service which provides desktop notifications. |
| 1290 NotificationProvider* notification_provider_; | 1279 NotificationProvider* notification_provider_; |
| 1291 | 1280 |
| 1292 // The geolocation dispatcher attached to this view, lazily initialized. | 1281 // The geolocation dispatcher attached to this view, lazily initialized. |
| 1293 GeolocationDispatcher* geolocation_dispatcher_; | 1282 GeolocationDispatcher* geolocation_dispatcher_; |
| 1294 | 1283 |
| 1295 // The speech dispatcher attached to this view, lazily initialized. | 1284 // The speech dispatcher attached to this view, lazily initialized. |
| 1296 SpeechInputDispatcher* speech_input_dispatcher_; | 1285 SpeechInputDispatcher* speech_input_dispatcher_; |
| 1297 | 1286 |
| 1298 // Device orientation dispatcher attached to this view; lazily initialized. | 1287 // Device orientation dispatcher attached to this view; lazily initialized. |
| 1299 DeviceOrientationDispatcher* device_orientation_dispatcher_; | 1288 DeviceOrientationDispatcher* device_orientation_dispatcher_; |
| 1300 | 1289 |
| 1301 // PrintWebViewHelper handles printing. Weak pointer since it implements | |
| 1302 // RenderViewObserver interface. | |
| 1303 PrintWebViewHelper* print_helper_; | |
| 1304 | |
| 1305 // Weak pointer since it implements RenderViewObserver interface. | |
| 1306 SearchBox* searchbox_; | |
| 1307 | |
| 1308 // spellcheck provider which is registered as a view observer. | |
| 1309 // Note that RenderViewObserver subclasses like this will be deleted | |
| 1310 // automatically during RenderView destruction. | |
| 1311 SpellCheckProvider* spellcheck_provider_; | |
| 1312 | |
| 1313 scoped_refptr<AudioMessageFilter> audio_message_filter_; | 1290 scoped_refptr<AudioMessageFilter> audio_message_filter_; |
| 1314 | 1291 |
| 1315 // Handles accessibility requests into the renderer side, as well as | 1292 // Handles accessibility requests into the renderer side, as well as |
| 1316 // maintains the cache and other features of the accessibility tree. | 1293 // maintains the cache and other features of the accessibility tree. |
| 1317 scoped_ptr<WebKit::WebAccessibilityCache> accessibility_; | 1294 scoped_ptr<WebKit::WebAccessibilityCache> accessibility_; |
| 1318 | 1295 |
| 1319 // Collect renderer accessibility notifications until they are ready to be | 1296 // Collect renderer accessibility notifications until they are ready to be |
| 1320 // sent to the browser. | 1297 // sent to the browser. |
| 1321 std::vector<RendererAccessibilityNotification> | 1298 std::vector<RendererAccessibilityNotification> |
| 1322 pending_accessibility_notifications_; | 1299 pending_accessibility_notifications_; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 // bunch of stuff, you should probably create a helper class and put your | 1391 // bunch of stuff, you should probably create a helper class and put your |
| 1415 // data and methods on that to avoid bloating RenderView more. You can use | 1392 // data and methods on that to avoid bloating RenderView more. You can use |
| 1416 // the Observer interface to filter IPC messages and receive frame change | 1393 // the Observer interface to filter IPC messages and receive frame change |
| 1417 // notifications. | 1394 // notifications. |
| 1418 // --------------------------------------------------------------------------- | 1395 // --------------------------------------------------------------------------- |
| 1419 | 1396 |
| 1420 DISALLOW_COPY_AND_ASSIGN(RenderView); | 1397 DISALLOW_COPY_AND_ASSIGN(RenderView); |
| 1421 }; | 1398 }; |
| 1422 | 1399 |
| 1423 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ | 1400 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ |
| OLD | NEW |