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> |
11 #include <queue> | 11 #include <queue> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/id_map.h" | 18 #include "base/id_map.h" |
19 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
21 #include "base/observer_list.h" | 21 #include "base/observer_list.h" |
22 #include "base/timer.h" | 22 #include "base/timer.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "chrome/common/content_settings.h" | 24 #include "chrome/common/content_settings.h" |
25 #include "chrome/common/search_provider.h" | |
26 #include "chrome/common/view_types.h" | |
27 #include "content/renderer/renderer_webcookiejar_impl.h" | 25 #include "content/renderer/renderer_webcookiejar_impl.h" |
28 #include "content/common/edit_command.h" | 26 #include "content/common/edit_command.h" |
29 #include "content/common/navigation_gesture.h" | 27 #include "content/common/navigation_gesture.h" |
30 #include "content/common/page_zoom.h" | 28 #include "content/common/page_zoom.h" |
31 #include "content/common/renderer_preferences.h" | 29 #include "content/common/renderer_preferences.h" |
32 #include "content/renderer/pepper_plugin_delegate_impl.h" | 30 #include "content/renderer/pepper_plugin_delegate_impl.h" |
33 #include "content/renderer/render_widget.h" | 31 #include "content/renderer/render_widget.h" |
34 #include "ipc/ipc_platform_file.h" | 32 #include "ipc/ipc_platform_file.h" |
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotif
ication.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotif
ication.h" |
36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClie
nt.h" | |
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" |
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationType.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationType.h" |
44 #include "ui/gfx/surface/transport_dib.h" | 41 #include "ui/gfx/surface/transport_dib.h" |
45 #include "webkit/glue/webpreferences.h" | 42 #include "webkit/glue/webpreferences.h" |
46 #include "webkit/plugins/npapi/webplugin_page_delegate.h" | 43 #include "webkit/plugins/npapi/webplugin_page_delegate.h" |
47 | 44 |
48 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
49 // RenderView is a diamond-shaped hierarchy, with WebWidgetClient at the root. | 46 // RenderView is a diamond-shaped hierarchy, with WebWidgetClient at the root. |
50 // VS warns when we inherit the WebWidgetClient method implementations from | 47 // VS warns when we inherit the WebWidgetClient method implementations from |
51 // RenderWidget. It's safe to ignore that warning. | 48 // RenderWidget. It's safe to ignore that warning. |
52 #pragma warning(disable: 4250) | 49 #pragma warning(disable: 4250) |
53 #endif | 50 #endif |
54 | 51 |
55 class AudioMessageFilter; | 52 class AudioMessageFilter; |
56 class DeviceOrientationDispatcher; | 53 class DeviceOrientationDispatcher; |
57 class DomAutomationController; | |
58 class ExternalHostBindings; | |
59 class ExternalPopupMenu; | 54 class ExternalPopupMenu; |
60 class FilePath; | 55 class FilePath; |
61 class GeolocationDispatcher; | 56 class GeolocationDispatcher; |
62 class GURL; | 57 class GURL; |
63 class LoadProgressTracker; | 58 class LoadProgressTracker; |
64 class NavigationState; | 59 class NavigationState; |
65 class NotificationProvider; | 60 class NotificationProvider; |
66 class P2PSocketDispatcher; | 61 class P2PSocketDispatcher; |
67 class PepperDeviceTest; | 62 class PepperDeviceTest; |
68 class PrintWebViewHelper; | 63 class PrintWebViewHelper; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // scoped_refptr<int>. | 158 // scoped_refptr<int>. |
164 typedef base::RefCountedData<int> SharedRenderViewCounter; | 159 typedef base::RefCountedData<int> SharedRenderViewCounter; |
165 | 160 |
166 // | 161 // |
167 // RenderView is an object that manages a WebView object, and provides a | 162 // RenderView is an object that manages a WebView object, and provides a |
168 // communication interface with an embedding application process | 163 // communication interface with an embedding application process |
169 // | 164 // |
170 class RenderView : public RenderWidget, | 165 class RenderView : public RenderWidget, |
171 public WebKit::WebViewClient, | 166 public WebKit::WebViewClient, |
172 public WebKit::WebFrameClient, | 167 public WebKit::WebFrameClient, |
173 public WebKit::WebPageSerializerClient, | |
174 public webkit::npapi::WebPluginPageDelegate, | 168 public webkit::npapi::WebPluginPageDelegate, |
175 public base::SupportsWeakPtr<RenderView> { | 169 public base::SupportsWeakPtr<RenderView> { |
176 public: | 170 public: |
177 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the | 171 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the |
178 // parent of the WebView HWND that will be created. If this is a constrained | 172 // parent of the WebView HWND that will be created. If this is a constrained |
179 // popup or as a new tab, opener_id is the routing ID of the RenderView | 173 // popup or as a new tab, opener_id is the routing ID of the RenderView |
180 // responsible for creating this RenderView (corresponding to parent_hwnd). | 174 // responsible for creating this RenderView (corresponding to parent_hwnd). |
181 // |counter| is either a currently initialized counter, or NULL (in which case | 175 // |counter| is either a currently initialized counter, or NULL (in which case |
182 // we treat this RenderView as a top level window). | 176 // we treat this RenderView as a top level window). |
183 static RenderView* Create( | 177 static RenderView* Create( |
(...skipping 13 matching lines...) Expand all Loading... |
197 | 191 |
198 // Returns the RenderView containing the given WebView. | 192 // Returns the RenderView containing the given WebView. |
199 static RenderView* FromWebView(WebKit::WebView* webview); | 193 static RenderView* FromWebView(WebKit::WebView* webview); |
200 | 194 |
201 // Sets the "next page id" counter. | 195 // Sets the "next page id" counter. |
202 static void SetNextPageID(int32 next_page_id); | 196 static void SetNextPageID(int32 next_page_id); |
203 | 197 |
204 // May return NULL when the view is closing. | 198 // May return NULL when the view is closing. |
205 WebKit::WebView* webview() const; | 199 WebKit::WebView* webview() const; |
206 | 200 |
207 int browser_window_id() const { | 201 bool is_prerendering() const { return is_prerendering_; } |
208 return browser_window_id_; | 202 int page_id() const { return page_id_; } |
209 } | 203 PepperPluginDelegateImpl* pepper_delegate() { return &pepper_delegate_; } |
210 | |
211 ViewType::Type view_type() const { | |
212 return view_type_; | |
213 } | |
214 | |
215 int page_id() const { | |
216 return page_id_; | |
217 } | |
218 | 204 |
219 AudioMessageFilter* audio_message_filter() { | 205 AudioMessageFilter* audio_message_filter() { |
220 return audio_message_filter_; | 206 return audio_message_filter_; |
221 } | 207 } |
222 | 208 |
223 const WebPreferences& webkit_preferences() const { | 209 const WebPreferences& webkit_preferences() const { |
224 return webkit_preferences_; | 210 return webkit_preferences_; |
225 } | 211 } |
226 | 212 |
227 bool content_state_immediately() { return send_content_state_immediately_; } | 213 bool content_state_immediately() { return send_content_state_immediately_; } |
| 214 int enabled_bindings() const { return enabled_bindings_; } |
| 215 void set_enabled_bindings(int b) { enabled_bindings_ = b; } |
228 void set_send_content_state_immediately(bool value) { | 216 void set_send_content_state_immediately(bool value) { |
229 send_content_state_immediately_ = value; | 217 send_content_state_immediately_ = value; |
230 } | 218 } |
231 | 219 |
232 // Returns true if we should display scrollbars for the given view size and | 220 // Returns true if we should display scrollbars for the given view size and |
233 // false if the scrollbars should be hidden. | 221 // false if the scrollbars should be hidden. |
234 bool should_display_scrollbars(int width, int height) const { | 222 bool should_display_scrollbars(int width, int height) const { |
235 return (!send_preferred_size_changes_ || | 223 return (!send_preferred_size_changes_ || |
236 (disable_scrollbars_size_limit_.width() <= width || | 224 (disable_scrollbars_size_limit_.width() <= width || |
237 disable_scrollbars_size_limit_.height() <= height)); | 225 disable_scrollbars_size_limit_.height() <= height)); |
238 } | 226 } |
239 | 227 |
240 const WebKit::WebNode& context_menu_node() { return context_menu_node_; } | 228 const WebKit::WebNode& context_menu_node() { return context_menu_node_; } |
241 | 229 |
242 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. | 230 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. |
243 P2PSocketDispatcher* p2p_socket_dispatcher() { | 231 P2PSocketDispatcher* p2p_socket_dispatcher() { |
244 return p2p_socket_dispatcher_; | 232 return p2p_socket_dispatcher_; |
245 } | 233 } |
246 | 234 |
247 // Functions to add and remove observers for this object. | 235 // Functions to add and remove observers for this object. |
248 void AddObserver(RenderViewObserver* observer); | 236 void AddObserver(RenderViewObserver* observer); |
249 void RemoveObserver(RenderViewObserver* observer); | 237 void RemoveObserver(RenderViewObserver* observer); |
250 | 238 |
251 // Called from JavaScript window.external.AddSearchProvider() to add a | |
252 // keyword for a provider described in the given OpenSearch document. | |
253 void AddSearchProvider(const std::string& url, | |
254 search_provider::OSDDType provider_type); | |
255 | |
256 // Returns the install state for the given search provider url. | |
257 search_provider::InstallState GetSearchProviderInstallState( | |
258 WebKit::WebFrame* frame, | |
259 const std::string& url); | |
260 | |
261 // Evaluates a string of JavaScript in a particular frame. | 239 // Evaluates a string of JavaScript in a particular frame. |
262 void EvaluateScript(const string16& frame_xpath, | 240 void EvaluateScript(const string16& frame_xpath, |
263 const string16& jscript, | 241 const string16& jscript, |
264 int id, | 242 int id, |
265 bool notify_result); | 243 bool notify_result); |
266 | 244 |
267 // Adds the given file chooser request to the file_chooser_completion_ queue | 245 // Adds the given file chooser request to the file_chooser_completion_ queue |
268 // (see that var for more) and requests the chooser be displayed if there are | 246 // (see that var for more) and requests the chooser be displayed if there are |
269 // no other waiting items in the queue. | 247 // no other waiting items in the queue. |
270 // | 248 // |
271 // Returns true if the chooser was successfully scheduled. False means we | 249 // Returns true if the chooser was successfully scheduled. False means we |
272 // didn't schedule anything. | 250 // didn't schedule anything. |
273 bool ScheduleFileChooser(const ViewHostMsg_RunFileChooser_Params& params, | 251 bool ScheduleFileChooser(const ViewHostMsg_RunFileChooser_Params& params, |
274 WebKit::WebFileChooserCompletion* completion); | 252 WebKit::WebFileChooserCompletion* completion); |
275 | 253 |
276 // Sets the content settings that back allowScripts(), allowImages(), and | 254 // Sets the content settings that back allowScripts(), allowImages(), and |
277 // allowPlugins(). | 255 // allowPlugins(). |
278 void SetContentSettings(const ContentSettings& settings); | 256 void SetContentSettings(const ContentSettings& settings); |
279 | 257 |
280 // Notifies the browser that the given action has been performed. This is | |
281 // aggregated to the user metrics service. | |
282 void UserMetricsRecordAction(const std::string& action); | |
283 | |
284 // Sets whether the renderer should report load progress to the browser. | 258 // Sets whether the renderer should report load progress to the browser. |
285 void SetReportLoadProgressEnabled(bool enabled); | 259 void SetReportLoadProgressEnabled(bool enabled); |
286 | 260 |
287 // Gets the focused node. If no such node exists then the node will be isNull. | 261 // Gets the focused node. If no such node exists then the node will be isNull. |
288 WebKit::WebNode GetFocusedNode() const; | 262 WebKit::WebNode GetFocusedNode() const; |
289 | 263 |
290 // Returns true if the parameter node is a textfield, text area or a content | 264 // Returns true if the parameter node is a textfield, text area or a content |
291 // editable div. | 265 // editable div. |
292 bool IsEditableNode(const WebKit::WebNode& node); | 266 bool IsEditableNode(const WebKit::WebNode& node); |
293 | 267 |
| 268 void LoadNavigationErrorPage(WebKit::WebFrame* frame, |
| 269 const WebKit::WebURLRequest& failed_request, |
| 270 const WebKit::WebURLError& error, |
| 271 const std::string& html, |
| 272 bool replace); |
| 273 |
294 // Plugin-related functions -------------------------------------------------- | 274 // Plugin-related functions -------------------------------------------------- |
295 // (See also WebPluginPageDelegate implementation.) | 275 // (See also WebPluginPageDelegate implementation.) |
296 | 276 |
297 // Notification that the given plugin has crashed. | 277 // Notification that the given plugin has crashed. |
298 void PluginCrashed(const FilePath& plugin_path); | 278 void PluginCrashed(const FilePath& plugin_path); |
299 | 279 |
300 // Notification that the default plugin has done something about a missing | 280 // Notification that the default plugin has done something about a missing |
301 // plugin. See default_plugin_shared.h for possible values of |status|. | 281 // plugin. See default_plugin_shared.h for possible values of |status|. |
302 void OnMissingPluginStatus(WebPluginDelegateProxy* delegate, | 282 void OnMissingPluginStatus(WebPluginDelegateProxy* delegate, |
303 int status); | 283 int status); |
304 | 284 |
| 285 // Create a new NPAPI plugin. |
| 286 WebKit::WebPlugin* CreateNPAPIPlugin(WebKit::WebFrame* frame, |
| 287 const WebKit::WebPluginParams& params, |
| 288 const FilePath& path, |
| 289 const std::string& mime_type); |
| 290 |
| 291 // Create a new Pepper plugin. |
| 292 WebKit::WebPlugin* CreatePepperPlugin( |
| 293 WebKit::WebFrame* frame, |
| 294 const WebKit::WebPluginParams& params, |
| 295 const FilePath& path, |
| 296 webkit::ppapi::PluginModule* pepper_module); |
| 297 |
305 // Creates a fullscreen container for a pepper plugin instance. | 298 // Creates a fullscreen container for a pepper plugin instance. |
306 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer( | 299 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer( |
307 webkit::ppapi::PluginInstance* plugin); | 300 webkit::ppapi::PluginInstance* plugin); |
308 | 301 |
309 // Create a new plugin without checking the content settings. | 302 // Create a new plugin without checking the content settings. |
310 WebKit::WebPlugin* CreatePluginNoCheck(WebKit::WebFrame* frame, | 303 WebKit::WebPlugin* CreatePluginNoCheck(WebKit::WebFrame* frame, |
311 const WebKit::WebPluginParams& params); | 304 const WebKit::WebPluginParams& params); |
312 | 305 |
313 #if defined(OS_MACOSX) | 306 #if defined(OS_MACOSX) |
314 // Informs the render view that the given plugin has gained or lost focus. | 307 // Informs the render view that the given plugin has gained or lost focus. |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 WebKit::WebFrame* frame, | 571 WebKit::WebFrame* frame, |
579 WebKit::WebStorageQuotaType type, | 572 WebKit::WebStorageQuotaType type, |
580 WebKit::WebStorageQuotaCallbacks* callbacks); | 573 WebKit::WebStorageQuotaCallbacks* callbacks); |
581 | 574 |
582 virtual void requestStorageQuota( | 575 virtual void requestStorageQuota( |
583 WebKit::WebFrame* frame, | 576 WebKit::WebFrame* frame, |
584 WebKit::WebStorageQuotaType type, | 577 WebKit::WebStorageQuotaType type, |
585 unsigned long long requested_size, | 578 unsigned long long requested_size, |
586 WebKit::WebStorageQuotaCallbacks* callbacks); | 579 WebKit::WebStorageQuotaCallbacks* callbacks); |
587 | 580 |
588 // WebKit::WebPageSerializerClient implementation ---------------------------- | |
589 | |
590 virtual void didSerializeDataForFrame(const WebKit::WebURL& frame_url, | |
591 const WebKit::WebCString& data, | |
592 PageSerializationStatus status); | |
593 | |
594 // webkit_glue::WebPluginPageDelegate implementation ------------------------- | 581 // webkit_glue::WebPluginPageDelegate implementation ------------------------- |
595 | 582 |
596 virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate( | 583 virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate( |
597 const FilePath& file_path, | 584 const FilePath& file_path, |
598 const std::string& mime_type); | 585 const std::string& mime_type); |
599 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle); | 586 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle); |
600 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle); | 587 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle); |
601 virtual void DidMovePlugin(const webkit::npapi::WebPluginGeometry& move); | 588 virtual void DidMovePlugin(const webkit::npapi::WebPluginGeometry& move); |
602 virtual void DidStartLoadingForPlugin(); | 589 virtual void DidStartLoadingForPlugin(); |
603 virtual void DidStopLoadingForPlugin(); | 590 virtual void DidStopLoadingForPlugin(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 | 703 |
717 bool RunJavaScriptMessage(int type, | 704 bool RunJavaScriptMessage(int type, |
718 const std::wstring& message, | 705 const std::wstring& message, |
719 const std::wstring& default_value, | 706 const std::wstring& default_value, |
720 const GURL& frame_url, | 707 const GURL& frame_url, |
721 std::wstring* result); | 708 std::wstring* result); |
722 | 709 |
723 // Sends a message and runs a nested message loop. | 710 // Sends a message and runs a nested message loop. |
724 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message); | 711 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message); |
725 | 712 |
726 // Adds search provider from the given OpenSearch description URL as a | |
727 // keyword search. | |
728 void AddGURLSearchProvider(const GURL& osd_url, | |
729 search_provider::OSDDType provider_type); | |
730 | |
731 // Send queued accessibility notifications from the renderer to the browser. | 713 // Send queued accessibility notifications from the renderer to the browser. |
732 void SendPendingAccessibilityNotifications(); | 714 void SendPendingAccessibilityNotifications(); |
733 | 715 |
734 // IPC message handlers ------------------------------------------------------ | 716 // IPC message handlers ------------------------------------------------------ |
735 // | 717 // |
736 // The documentation for these functions should be in | 718 // The documentation for these functions should be in |
737 // render_messages_internal.h for the message that the function is handling. | 719 // render_messages_internal.h for the message that the function is handling. |
738 | 720 |
739 void OnAccessibilityDoDefaultAction(int acc_obj_id); | 721 void OnAccessibilityDoDefaultAction(int acc_obj_id); |
740 void OnAccessibilityNotificationsAck(); | 722 void OnAccessibilityNotificationsAck(); |
(...skipping 25 matching lines...) Expand all Loading... |
766 const std::string& css, | 748 const std::string& css, |
767 const std::string& id); | 749 const std::string& id); |
768 void OnCustomContextMenuAction( | 750 void OnCustomContextMenuAction( |
769 const webkit_glue::CustomContextMenuContext& custom_context, | 751 const webkit_glue::CustomContextMenuContext& custom_context, |
770 unsigned action); | 752 unsigned action); |
771 void OnDelete(); | 753 void OnDelete(); |
772 void OnDeterminePageLanguage(); | 754 void OnDeterminePageLanguage(); |
773 void OnDisableScrollbarsForSmallWindows( | 755 void OnDisableScrollbarsForSmallWindows( |
774 const gfx::Size& disable_scrollbars_size_limit); | 756 const gfx::Size& disable_scrollbars_size_limit); |
775 void OnDisassociateFromPopupCount(); | 757 void OnDisassociateFromPopupCount(); |
776 void OnDownloadFavicon(int id, const GURL& image_url, int image_size); | |
777 void OnDragSourceEndedOrMoved(const gfx::Point& client_point, | 758 void OnDragSourceEndedOrMoved(const gfx::Point& client_point, |
778 const gfx::Point& screen_point, | 759 const gfx::Point& screen_point, |
779 bool ended, | 760 bool ended, |
780 WebKit::WebDragOperation drag_operation); | 761 WebKit::WebDragOperation drag_operation); |
781 void OnDragSourceSystemDragEnded(); | 762 void OnDragSourceSystemDragEnded(); |
782 void OnDragTargetDrop(const gfx::Point& client_pt, | 763 void OnDragTargetDrop(const gfx::Point& client_pt, |
783 const gfx::Point& screen_pt); | 764 const gfx::Point& screen_pt); |
784 void OnDragTargetDragEnter(const WebDropData& drop_data, | 765 void OnDragTargetDragEnter(const WebDropData& drop_data, |
785 const gfx::Point& client_pt, | 766 const gfx::Point& client_pt, |
786 const gfx::Point& screen_pt, | 767 const gfx::Point& screen_pt, |
787 WebKit::WebDragOperationsMask operations_allowed); | 768 WebKit::WebDragOperationsMask operations_allowed); |
788 void OnDragTargetDragLeave(); | 769 void OnDragTargetDragLeave(); |
789 void OnDragTargetDragOver(const gfx::Point& client_pt, | 770 void OnDragTargetDragOver(const gfx::Point& client_pt, |
790 const gfx::Point& screen_pt, | 771 const gfx::Point& screen_pt, |
791 WebKit::WebDragOperationsMask operations_allowed); | 772 WebKit::WebDragOperationsMask operations_allowed); |
792 void OnEnablePreferredSizeChangedMode(int flags); | 773 void OnEnablePreferredSizeChangedMode(int flags); |
793 void OnEnableViewSourceMode(); | |
794 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths); | 774 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths); |
795 void OnExecuteEditCommand(const std::string& name, const std::string& value); | 775 void OnExecuteEditCommand(const std::string& name, const std::string& value); |
796 void OnFileChooserResponse(const std::vector<FilePath>& paths); | 776 void OnFileChooserResponse(const std::vector<FilePath>& paths); |
797 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&); | 777 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&); |
798 void OnFindReplyAck(); | 778 void OnFindReplyAck(); |
799 void OnEnableAccessibility(); | 779 void OnEnableAccessibility(); |
800 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url); | |
801 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( | |
802 const std::vector<GURL>& links, | |
803 const std::vector<FilePath>& local_paths, | |
804 const FilePath& local_directory_name); | |
805 void OnHandleMessageFromExternalHost(const std::string& message, | |
806 const std::string& origin, | |
807 const std::string& target); | |
808 void OnInstallMissingPlugin(); | 780 void OnInstallMissingPlugin(); |
809 void OnDisplayPrerenderedPage(); | 781 void OnDisplayPrerenderedPage(); |
810 void OnMediaPlayerActionAt(const gfx::Point& location, | 782 void OnMediaPlayerActionAt(const gfx::Point& location, |
811 const WebKit::WebMediaPlayerAction& action); | 783 const WebKit::WebMediaPlayerAction& action); |
812 void OnMoveOrResizeStarted(); | 784 void OnMoveOrResizeStarted(); |
813 void OnNavigate(const ViewMsg_Navigate_Params& params); | 785 void OnNavigate(const ViewMsg_Navigate_Params& params); |
814 void OnNetworkStateChanged(bool online); | 786 void OnNetworkStateChanged(bool online); |
815 void OnNotifyRendererViewType(ViewType::Type view_type); | |
816 void OnPaste(); | 787 void OnPaste(); |
817 #if defined(OS_MACOSX) | 788 #if defined(OS_MACOSX) |
818 void OnPluginImeCompositionCompleted(const string16& text, int plugin_id); | 789 void OnPluginImeCompositionCompleted(const string16& text, int plugin_id); |
819 #endif | 790 #endif |
820 void OnRedo(); | 791 void OnRedo(); |
821 void OnReloadFrame(); | 792 void OnReloadFrame(); |
822 void OnReplace(const string16& text); | 793 void OnReplace(const string16& text); |
823 void OnReservePageIDRange(int size_of_range); | 794 void OnReservePageIDRange(int size_of_range); |
824 void OnResetPageEncodingToDefault(); | 795 void OnResetPageEncodingToDefault(); |
825 void OnScriptEvalRequest(const string16& frame_xpath, | 796 void OnScriptEvalRequest(const string16& frame_xpath, |
(...skipping 17 matching lines...) Expand all Loading... |
843 #if defined(OS_MACOSX) | 814 #if defined(OS_MACOSX) |
844 void OnSetWindowVisibility(bool visible); | 815 void OnSetWindowVisibility(bool visible); |
845 #endif | 816 #endif |
846 void OnSetZoomLevel(double zoom_level); | 817 void OnSetZoomLevel(double zoom_level); |
847 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level); | 818 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level); |
848 void OnShouldClose(); | 819 void OnShouldClose(); |
849 void OnStop(); | 820 void OnStop(); |
850 void OnStopFinding(const ViewMsg_StopFinding_Params& params); | 821 void OnStopFinding(const ViewMsg_StopFinding_Params& params); |
851 void OnThemeChanged(); | 822 void OnThemeChanged(); |
852 void OnUndo(); | 823 void OnUndo(); |
853 void OnUpdateBrowserWindowId(int window_id); | |
854 void OnUpdateTargetURLAck(); | 824 void OnUpdateTargetURLAck(); |
855 void OnUpdateWebPreferences(const WebPreferences& prefs); | 825 void OnUpdateWebPreferences(const WebPreferences& prefs); |
856 #if defined(OS_MACOSX) | 826 #if defined(OS_MACOSX) |
857 void OnWindowFrameChanged(const gfx::Rect& window_frame, | 827 void OnWindowFrameChanged(const gfx::Rect& window_frame, |
858 const gfx::Rect& view_frame); | 828 const gfx::Rect& view_frame); |
859 void OnSelectPopupMenuItem(int selected_index); | 829 void OnSelectPopupMenuItem(int selected_index); |
860 #endif | 830 #endif |
861 void OnZoom(PageZoom::Function function); | 831 void OnZoom(PageZoom::Function function); |
862 void OnJavaScriptStressTestControl(int cmd, int param); | |
863 | 832 |
864 // Adding a new message handler? Please add it in alphabetical order above | 833 // Adding a new message handler? Please add it in alphabetical order above |
865 // and put it in the same position in the .cc file. | 834 // and put it in the same position in the .cc file. |
866 | 835 |
867 // Misc private functions ---------------------------------------------------- | 836 // Misc private functions ---------------------------------------------------- |
868 | 837 |
869 // Helper method that returns if the user wants to block content of type | 838 // Helper method that returns if the user wants to block content of type |
870 // |content_type|. | 839 // |content_type|. |
871 bool AllowContentType(ContentSettingsType settings_type); | 840 bool AllowContentType(ContentSettingsType settings_type); |
872 | 841 |
873 void AltErrorPageFinished(WebKit::WebFrame* frame, | 842 void AltErrorPageFinished(WebKit::WebFrame* frame, |
874 const WebKit::WebURLError& original_error, | 843 const WebKit::WebURLError& original_error, |
875 const std::string& html); | 844 const std::string& html); |
876 | 845 |
877 // Exposes the DOMAutomationController object that allows JS to send | |
878 // information to the browser process. | |
879 void BindDOMAutomationController(WebKit::WebFrame* webframe); | |
880 | |
881 // Check whether the preferred size has changed. This is called periodically | 846 // Check whether the preferred size has changed. This is called periodically |
882 // by preferred_size_change_timer_. | 847 // by preferred_size_change_timer_. |
883 void CheckPreferredSize(); | 848 void CheckPreferredSize(); |
884 | 849 |
885 // Resets the |content_blocked_| array. | 850 // Resets the |content_blocked_| array. |
886 void ClearBlockedContentSettings(); | 851 void ClearBlockedContentSettings(); |
887 | 852 |
888 // Create a new NPAPI plugin. | |
889 WebKit::WebPlugin* CreateNPAPIPlugin(WebKit::WebFrame* frame, | |
890 const WebKit::WebPluginParams& params, | |
891 const FilePath& path, | |
892 const std::string& mime_type); | |
893 | |
894 // Create a new Pepper plugin. | |
895 WebKit::WebPlugin* CreatePepperPlugin( | |
896 WebKit::WebFrame* frame, | |
897 const WebKit::WebPluginParams& params, | |
898 const FilePath& path, | |
899 webkit::ppapi::PluginModule* pepper_module); | |
900 | |
901 // Sends an IPC notification that the specified content type was blocked. | 853 // Sends an IPC notification that the specified content type was blocked. |
902 // If the content type requires it, |resource_identifier| names the specific | 854 // If the content type requires it, |resource_identifier| names the specific |
903 // resource that was blocked (the plugin path in the case of plugins), | 855 // resource that was blocked (the plugin path in the case of plugins), |
904 // otherwise it's the empty string. | 856 // otherwise it's the empty string. |
905 void DidBlockContentType(ContentSettingsType settings_type, | 857 void DidBlockContentType(ContentSettingsType settings_type, |
906 const std::string& resource_identifier); | 858 const std::string& resource_identifier); |
907 | 859 |
908 // This callback is triggered when DownloadFavicon completes, either | |
909 // succesfully or with a failure. See DownloadFavicon for more | |
910 // details. | |
911 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, | |
912 const SkBitmap& image); | |
913 | |
914 // Requests to download a favicon image. When done, the RenderView | |
915 // is notified by way of DidDownloadFavicon. Returns true if the | |
916 // request was successfully started, false otherwise. id is used to | |
917 // uniquely identify the request and passed back to the | |
918 // DidDownloadFavicon method. If the image has multiple frames, the | |
919 // frame whose size is image_size is returned. If the image doesn't | |
920 // have a frame at the specified size, the first is returned. | |
921 bool DownloadFavicon(int id, const GURL& image_url, int image_size); | |
922 | |
923 GURL GetAlternateErrorPageURL(const GURL& failed_url, | 860 GURL GetAlternateErrorPageURL(const GURL& failed_url, |
924 ErrorPageType error_type); | 861 ErrorPageType error_type); |
925 | 862 |
926 // Locates a sub frame with given xpath | 863 // Locates a sub frame with given xpath |
927 WebKit::WebFrame* GetChildFrame(const std::wstring& frame_xpath) const; | 864 WebKit::WebFrame* GetChildFrame(const std::wstring& frame_xpath) const; |
928 | 865 |
929 WebUIBindings* GetWebUIBindings(); | 866 WebUIBindings* GetWebUIBindings(); |
930 | 867 |
931 ExternalHostBindings* GetExternalHostBindings(); | |
932 | |
933 // Should only be called if this object wraps a PluginDocument. | 868 // Should only be called if this object wraps a PluginDocument. |
934 WebKit::WebPlugin* GetWebPluginFromPluginDocument(); | 869 WebKit::WebPlugin* GetWebPluginFromPluginDocument(); |
935 | 870 |
936 // Decodes a data: URL image or returns an empty image in case of failure. | |
937 SkBitmap ImageFromDataUrl(const GURL&) const; | |
938 | |
939 // Inserts a string of CSS in a particular frame. |id| can be specified to | 871 // Inserts a string of CSS in a particular frame. |id| can be specified to |
940 // give the CSS style element an id, and (if specified) will replace the | 872 // give the CSS style element an id, and (if specified) will replace the |
941 // element with the same id. | 873 // element with the same id. |
942 void InsertCSS(const std::wstring& frame_xpath, | 874 void InsertCSS(const std::wstring& frame_xpath, |
943 const std::string& css, | 875 const std::string& css, |
944 const std::string& id); | 876 const std::string& id); |
945 | 877 |
946 // Returns false unless this is a top-level navigation that crosses origins. | 878 // Returns false unless this is a top-level navigation that crosses origins. |
947 bool IsNonLocalTopLevelNavigation(const GURL& url, | 879 bool IsNonLocalTopLevelNavigation(const GURL& url, |
948 WebKit::WebFrame* frame, | 880 WebKit::WebFrame* frame, |
949 WebKit::WebNavigationType type); | 881 WebKit::WebNavigationType type); |
950 | 882 |
951 void LoadNavigationErrorPage(WebKit::WebFrame* frame, | |
952 const WebKit::WebURLRequest& failed_request, | |
953 const WebKit::WebURLError& error, | |
954 const std::string& html, | |
955 bool replace); | |
956 | |
957 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame, | 883 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame, |
958 const WebKit::WebURLError& error, | 884 const WebKit::WebURLError& error, |
959 bool replace); | 885 bool replace); |
960 | 886 |
961 // Starts nav_state_sync_timer_ if it isn't already running. | 887 // Starts nav_state_sync_timer_ if it isn't already running. |
962 void StartNavStateSyncTimerIfNecessary(); | 888 void StartNavStateSyncTimerIfNecessary(); |
963 | 889 |
964 // Dispatches the current navigation state to the browser. Called on a | 890 // Dispatches the current navigation state to the browser. Called on a |
965 // periodic timer so we don't send too many messages. | 891 // periodic timer so we don't send too many messages. |
966 void SyncNavigationState(); | 892 void SyncNavigationState(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 // scroll bars on windows smaller than this size. Used for windows that the | 936 // scroll bars on windows smaller than this size. Used for windows that the |
1011 // browser resizes to the size of the content, such as browser action popups. | 937 // browser resizes to the size of the content, such as browser action popups. |
1012 // If a render view is set to the minimum size of its content, webkit may add | 938 // If a render view is set to the minimum size of its content, webkit may add |
1013 // scroll bars. This makes sense for fixed sized windows, but it does not | 939 // scroll bars. This makes sense for fixed sized windows, but it does not |
1014 // make sense when the size of the view was chosen to fit the content. | 940 // make sense when the size of the view was chosen to fit the content. |
1015 // This setting ensures that no scroll bars are drawn. The size limit exists | 941 // This setting ensures that no scroll bars are drawn. The size limit exists |
1016 // because if the view grows beyond a size known to the browser, scroll bars | 942 // because if the view grows beyond a size known to the browser, scroll bars |
1017 // should be drawn. | 943 // should be drawn. |
1018 gfx::Size disable_scrollbars_size_limit_; | 944 gfx::Size disable_scrollbars_size_limit_; |
1019 | 945 |
1020 // We need to prevent windows from closing themselves with a window.close() | |
1021 // call while a blocked popup notification is being displayed. We cannot | |
1022 // synchronously query the Browser process. We cannot wait for the Browser | |
1023 // process to send a message to us saying that a blocked popup notification | |
1024 // is being displayed. We instead assume that when we create a window off | |
1025 // this RenderView, that it is going to be blocked until we get a message | |
1026 // from the Browser process telling us otherwise. | |
1027 bool script_can_close_; | |
1028 | |
1029 // Loading state ------------------------------------------------------------- | 946 // Loading state ------------------------------------------------------------- |
1030 | 947 |
1031 // True if the top level frame is currently being loaded. | 948 // True if the top level frame is currently being loaded. |
1032 bool is_loading_; | 949 bool is_loading_; |
1033 | 950 |
1034 // The gesture that initiated the current navigation. | 951 // The gesture that initiated the current navigation. |
1035 NavigationGesture navigation_gesture_; | 952 NavigationGesture navigation_gesture_; |
1036 | 953 |
1037 // Used for popups. | 954 // Used for popups. |
1038 bool opened_by_user_gesture_; | 955 bool opened_by_user_gesture_; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 GURL focus_url_; | 1044 GURL focus_url_; |
1128 | 1045 |
1129 // The next target URL we want to send to the browser. | 1046 // The next target URL we want to send to the browser. |
1130 GURL pending_target_url_; | 1047 GURL pending_target_url_; |
1131 | 1048 |
1132 // The text selection the last time DidChangeSelection got called. | 1049 // The text selection the last time DidChangeSelection got called. |
1133 std::string last_selection_; | 1050 std::string last_selection_; |
1134 | 1051 |
1135 // View ---------------------------------------------------------------------- | 1052 // View ---------------------------------------------------------------------- |
1136 | 1053 |
1137 // Type of view attached with RenderView. See view_types.h | |
1138 ViewType::Type view_type_; | |
1139 | |
1140 // Id number of browser window which RenderView is attached to. This is used | |
1141 // for extensions. | |
1142 int browser_window_id_; | |
1143 | |
1144 // Cache the preferred size of the page in order to prevent sending the IPC | 1054 // Cache the preferred size of the page in order to prevent sending the IPC |
1145 // when layout() recomputes but doesn't actually change sizes. | 1055 // when layout() recomputes but doesn't actually change sizes. |
1146 gfx::Size preferred_size_; | 1056 gfx::Size preferred_size_; |
1147 | 1057 |
1148 // Nasty hack. WebKit does not send us events when the preferred size changes, | 1058 // Nasty hack. WebKit does not send us events when the preferred size changes, |
1149 // so we must poll it. See also: | 1059 // so we must poll it. See also: |
1150 // https://bugs.webkit.org/show_bug.cgi?id=32807. | 1060 // https://bugs.webkit.org/show_bug.cgi?id=32807. |
1151 base::RepeatingTimer<RenderView> preferred_size_change_timer_; | 1061 base::RepeatingTimer<RenderView> preferred_size_change_timer_; |
1152 | 1062 |
1153 #if defined(OS_MACOSX) | 1063 #if defined(OS_MACOSX) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 // nonempty, the first item represents the currently running file chooser | 1125 // nonempty, the first item represents the currently running file chooser |
1216 // callback, and the remaining elements are the other file chooser completion | 1126 // callback, and the remaining elements are the other file chooser completion |
1217 // still waiting to be run (in order). | 1127 // still waiting to be run (in order). |
1218 struct PendingFileChooser; | 1128 struct PendingFileChooser; |
1219 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_; | 1129 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_; |
1220 | 1130 |
1221 // The current directory enumeration callback | 1131 // The current directory enumeration callback |
1222 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_; | 1132 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_; |
1223 int enumeration_completion_id_; | 1133 int enumeration_completion_id_; |
1224 | 1134 |
1225 // ImageResourceFetchers schedule via DownloadImage. | |
1226 ImageResourceFetcherList image_fetchers_; | |
1227 | |
1228 // The SessionStorage namespace that we're assigned to has an ID, and that ID | 1135 // The SessionStorage namespace that we're assigned to has an ID, and that ID |
1229 // is passed to us upon creation. WebKit asks for this ID upon first use and | 1136 // is passed to us upon creation. WebKit asks for this ID upon first use and |
1230 // uses it whenever asking the browser process to allocate new storage areas. | 1137 // uses it whenever asking the browser process to allocate new storage areas. |
1231 int64 session_storage_namespace_id_; | 1138 int64 session_storage_namespace_id_; |
1232 | 1139 |
1233 // The total number of unrequested popups that exist and can be followed back | 1140 // The total number of unrequested popups that exist and can be followed back |
1234 // to a common opener. This count is shared among all RenderViews created | 1141 // to a common opener. This count is shared among all RenderViews created |
1235 // with createView(). All popups are treated as unrequested until | 1142 // with createView(). All popups are treated as unrequested until |
1236 // specifically instructed otherwise by the Browser process. | 1143 // specifically instructed otherwise by the Browser process. |
1237 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_; | 1144 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_; |
1238 | 1145 |
1239 // Whether this is a top level window (instead of a popup). Top level windows | 1146 // Whether this is a top level window (instead of a popup). Top level windows |
1240 // shouldn't count against their own |shared_popup_counter_|. | 1147 // shouldn't count against their own |shared_popup_counter_|. |
1241 bool decrement_shared_popup_at_destruction_; | 1148 bool decrement_shared_popup_at_destruction_; |
1242 | 1149 |
1243 // If the browser hasn't sent us an ACK for the last FindReply we sent | 1150 // If the browser hasn't sent us an ACK for the last FindReply we sent |
1244 // to it, then we need to queue up the message (keeping only the most | 1151 // to it, then we need to queue up the message (keeping only the most |
1245 // recent message if new ones come in). | 1152 // recent message if new ones come in). |
1246 scoped_ptr<IPC::Message> queued_find_reply_message_; | 1153 scoped_ptr<IPC::Message> queued_find_reply_message_; |
1247 | 1154 |
1248 // Stores edit commands associated to the next key event. | 1155 // Stores edit commands associated to the next key event. |
1249 // Shall be cleared as soon as the next key event is processed. | 1156 // Shall be cleared as soon as the next key event is processed. |
1250 EditCommands edit_commands_; | 1157 EditCommands edit_commands_; |
1251 | 1158 |
1252 // Allows JS to access DOM automation. The JS object is only exposed when the | |
1253 // DOM automation bindings are enabled. | |
1254 scoped_ptr<DomAutomationController> dom_automation_controller_; | |
1255 | |
1256 // Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS | 1159 // Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS |
1257 // object is only exposed when Web UI bindings are enabled. | 1160 // object is only exposed when Web UI bindings are enabled. |
1258 scoped_ptr<WebUIBindings> web_ui_bindings_; | 1161 scoped_ptr<WebUIBindings> web_ui_bindings_; |
1259 | 1162 |
1260 // External host exposed through automation controller. | |
1261 scoped_ptr<ExternalHostBindings> external_host_bindings_; | |
1262 | |
1263 // The external popup for the currently showing select popup. | 1163 // The external popup for the currently showing select popup. |
1264 scoped_ptr<ExternalPopupMenu> external_popup_menu_; | 1164 scoped_ptr<ExternalPopupMenu> external_popup_menu_; |
1265 | 1165 |
1266 // The node that the context menu was pressed over. | 1166 // The node that the context menu was pressed over. |
1267 WebKit::WebNode context_menu_node_; | 1167 WebKit::WebNode context_menu_node_; |
1268 | 1168 |
1269 // Reports load progress to the browser. | 1169 // Reports load progress to the browser. |
1270 scoped_ptr<LoadProgressTracker> load_progress_tracker_; | 1170 scoped_ptr<LoadProgressTracker> load_progress_tracker_; |
1271 | 1171 |
1272 // All the registered observers. We expect this list to be small, so vector | 1172 // All the registered observers. We expect this list to be small, so vector |
1273 // is fine. | 1173 // is fine. |
1274 ObserverList<RenderViewObserver> observers_; | 1174 ObserverList<RenderViewObserver> observers_; |
1275 | 1175 |
1276 // --------------------------------------------------------------------------- | 1176 // --------------------------------------------------------------------------- |
1277 // ADDING NEW DATA? Please see if it fits appropriately in one of the above | 1177 // ADDING NEW DATA? Please see if it fits appropriately in one of the above |
1278 // sections rather than throwing it randomly at the end. If you're adding a | 1178 // sections rather than throwing it randomly at the end. If you're adding a |
1279 // bunch of stuff, you should probably create a helper class and put your | 1179 // bunch of stuff, you should probably create a helper class and put your |
1280 // data and methods on that to avoid bloating RenderView more. You can use | 1180 // data and methods on that to avoid bloating RenderView more. You can use |
1281 // the Observer interface to filter IPC messages and receive frame change | 1181 // the Observer interface to filter IPC messages and receive frame change |
1282 // notifications. | 1182 // notifications. |
1283 // --------------------------------------------------------------------------- | 1183 // --------------------------------------------------------------------------- |
1284 | 1184 |
1285 DISALLOW_COPY_AND_ASSIGN(RenderView); | 1185 DISALLOW_COPY_AND_ASSIGN(RenderView); |
1286 }; | 1186 }; |
1287 | 1187 |
1288 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ | 1188 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ |
OLD | NEW |