[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CONTENT_RENDERER_RENDER_VIEW_H_ |
| 6 | #define CONTENT_RENDERER_RENDER_VIEW_H_ |
| 7 | #pragma once |
| 8 | |
| 9 | #include <deque> |
| 10 | #include <map> |
| 11 | #include <queue> |
| 12 | #include <set> |
| 13 | #include <string> |
| 14 | #include <vector> |
| 15 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 16 | #include "base/basictypes.h" |
| 17 | #include "base/gtest_prod_util.h" |
| 18 | #include "base/id_map.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 19 | #include "base/memory/linked_ptr.h" |
| 20 | #include "base/memory/weak_ptr.h" |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 21 | #include "base/observer_list.h" |
| 22 | #include "base/timer.h" |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 23 | #include "build/build_config.h" |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 24 | #include "content/renderer/renderer_webcookiejar_impl.h" |
[email protected] | 5572215 | 2011-03-22 01:33:53 | [diff] [blame] | 25 | #include "content/common/edit_command.h" |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 26 | #include "content/common/navigation_gesture.h" |
| 27 | #include "content/common/page_zoom.h" |
[email protected] | 6091604 | 2011-03-19 00:43:36 | [diff] [blame] | 28 | #include "content/common/renderer_preferences.h" |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 29 | #include "content/renderer/pepper_plugin_delegate_impl.h" |
| 30 | #include "content/renderer/render_widget.h" |
| 31 | #include "ipc/ipc_platform_file.h" |
| 32 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityNotification.h" |
| 33 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
| 34 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" |
| 35 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
[email protected] | 42054a25 | 2011-05-17 18:02:13 | [diff] [blame] | 36 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h" |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 37 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
[email protected] | 18d5be9 | 2011-07-25 18:00:19 | [diff] [blame] | 38 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClient.h" |
[email protected] | 94dec93 | 2011-05-26 20:04:21 | [diff] [blame] | 39 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageVisibilityState.h" |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 40 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" |
| 41 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" |
| 42 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationType.h" |
[email protected] | b9b751f2 | 2011-03-25 14:04:12 | [diff] [blame] | 43 | #include "ui/gfx/surface/transport_dib.h" |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 44 | #include "webkit/glue/webpreferences.h" |
| 45 | #include "webkit/plugins/npapi/webplugin_page_delegate.h" |
| 46 | |
| 47 | #if defined(OS_WIN) |
| 48 | // RenderView is a diamond-shaped hierarchy, with WebWidgetClient at the root. |
| 49 | // VS warns when we inherit the WebWidgetClient method implementations from |
| 50 | // RenderWidget. It's safe to ignore that warning. |
| 51 | #pragma warning(disable: 4250) |
| 52 | #endif |
| 53 | |
| 54 | class AudioMessageFilter; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 55 | class DeviceOrientationDispatcher; |
[email protected] | c5c1d6d | 2011-07-28 18:42:41 | [diff] [blame] | 56 | class DevToolsAgent; |
[email protected] | 5572215 | 2011-03-22 01:33:53 | [diff] [blame] | 57 | class ExternalPopupMenu; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 58 | class FilePath; |
| 59 | class GeolocationDispatcher; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 60 | class GURL; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 61 | class LoadProgressTracker; |
[email protected] | ab2c473 | 2011-07-20 19:57:40 | [diff] [blame] | 62 | class MediaStreamImpl; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 63 | class NavigationState; |
| 64 | class NotificationProvider; |
| 65 | class P2PSocketDispatcher; |
| 66 | class PepperDeviceTest; |
| 67 | class PrintWebViewHelper; |
| 68 | class RenderViewObserver; |
| 69 | class RenderViewVisitor; |
[email protected] | ea192e8 | 2011-04-11 19:16:02 | [diff] [blame] | 70 | class RenderWidgetFullscreenPepper; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 71 | class SkBitmap; |
| 72 | class SpeechInputDispatcher; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 73 | class WebPluginDelegatePepper; |
| 74 | class WebPluginDelegateProxy; |
[email protected] | 5572215 | 2011-03-22 01:33:53 | [diff] [blame] | 75 | class WebUIBindings; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 76 | struct ContextMenuMediaParams; |
| 77 | struct PP_Flash_NetAddress; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 78 | struct ViewHostMsg_RunFileChooser_Params; |
[email protected] | 992db4c | 2011-05-12 15:37:15 | [diff] [blame] | 79 | struct ViewMsg_SwapOut_Params; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 80 | struct ViewMsg_Navigate_Params; |
| 81 | struct ViewMsg_StopFinding_Params; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 82 | struct WebDropData; |
| 83 | |
| 84 | namespace base { |
| 85 | class WaitableEvent; |
| 86 | } |
| 87 | |
| 88 | namespace chrome { |
| 89 | class ChromeContentRendererClient; |
| 90 | } |
| 91 | |
| 92 | namespace gfx { |
| 93 | class Point; |
| 94 | class Rect; |
| 95 | } |
| 96 | |
| 97 | namespace webkit { |
| 98 | |
| 99 | namespace npapi { |
| 100 | class PluginGroup; |
| 101 | } // namespace npapi |
| 102 | |
| 103 | namespace ppapi { |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 104 | class PluginInstance; |
| 105 | class PluginModule; |
| 106 | } // namespace ppapi |
| 107 | |
| 108 | } // namespace webkit |
| 109 | |
| 110 | namespace webkit_glue { |
| 111 | struct CustomContextMenuContext; |
| 112 | class ImageResourceFetcher; |
| 113 | struct FileUploadData; |
| 114 | struct FormData; |
| 115 | struct PasswordFormFillData; |
| 116 | class ResourceFetcher; |
| 117 | } |
| 118 | |
| 119 | namespace WebKit { |
| 120 | class WebAccessibilityCache; |
| 121 | class WebAccessibilityObject; |
| 122 | class WebApplicationCacheHost; |
| 123 | class WebApplicationCacheHostClient; |
| 124 | class WebDataSource; |
| 125 | class WebDocument; |
| 126 | class WebDragData; |
| 127 | class WebFrame; |
| 128 | class WebGeolocationClient; |
| 129 | class WebGeolocationServiceInterface; |
[email protected] | 42054a25 | 2011-05-17 18:02:13 | [diff] [blame] | 130 | class WebIconURL; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 131 | class WebImage; |
| 132 | class WebInputElement; |
| 133 | class WebKeyboardEvent; |
| 134 | class WebMediaPlayer; |
| 135 | class WebMediaPlayerClient; |
| 136 | class WebMouseEvent; |
| 137 | class WebPlugin; |
| 138 | class WebSpeechInputController; |
| 139 | class WebSpeechInputListener; |
| 140 | class WebStorageNamespace; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 141 | class WebURLRequest; |
| 142 | class WebView; |
| 143 | struct WebContextMenuData; |
| 144 | struct WebFileChooserParams; |
| 145 | struct WebFindOptions; |
| 146 | struct WebMediaPlayerAction; |
| 147 | struct WebPluginParams; |
| 148 | struct WebPoint; |
| 149 | struct WebWindowFeatures; |
| 150 | } |
| 151 | |
| 152 | // We need to prevent a page from trying to create infinite popups. It is not |
| 153 | // as simple as keeping a count of the number of immediate children |
| 154 | // popups. Having an html file that window.open()s itself would create |
| 155 | // an unlimited chain of RenderViews who only have one RenderView child. |
| 156 | // |
| 157 | // Therefore, each new top level RenderView creates a new counter and shares it |
| 158 | // with all its children and grandchildren popup RenderViews created with |
| 159 | // createView() to have a sort of global limit for the page so no more than |
| 160 | // kMaximumNumberOfPopups popups are created. |
| 161 | // |
| 162 | // This is a RefCounted holder of an int because I can't say |
| 163 | // scoped_refptr<int>. |
| 164 | typedef base::RefCountedData<int> SharedRenderViewCounter; |
| 165 | |
| 166 | // |
| 167 | // RenderView is an object that manages a WebView object, and provides a |
| 168 | // communication interface with an embedding application process |
| 169 | // |
| 170 | class RenderView : public RenderWidget, |
| 171 | public WebKit::WebViewClient, |
| 172 | public WebKit::WebFrameClient, |
[email protected] | 18d5be9 | 2011-07-25 18:00:19 | [diff] [blame] | 173 | public WebKit::WebPageSerializerClient, |
[email protected] | 08bb1e72 | 2011-07-30 19:13:04 | [diff] [blame] | 174 | public webkit::npapi::WebPluginPageDelegate, |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 175 | public base::SupportsWeakPtr<RenderView> { |
| 176 | public: |
| 177 | // 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 |
| 179 | // 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). |
| 181 | // |counter| is either a currently initialized counter, or NULL (in which case |
| 182 | // we treat this RenderView as a top level window). |
| 183 | static RenderView* Create( |
| 184 | RenderThreadBase* render_thread, |
| 185 | gfx::NativeViewId parent_hwnd, |
| 186 | int32 opener_id, |
| 187 | const RendererPreferences& renderer_prefs, |
| 188 | const WebPreferences& webkit_prefs, |
| 189 | SharedRenderViewCounter* counter, |
| 190 | int32 routing_id, |
| 191 | int64 session_storage_namespace_id, |
| 192 | const string16& frame_name); |
| 193 | |
| 194 | // Visit all RenderViews with a live WebView (i.e., RenderViews that have |
| 195 | // been closed but not yet destroyed are excluded). |
| 196 | static void ForEach(RenderViewVisitor* visitor); |
| 197 | |
| 198 | // Returns the RenderView containing the given WebView. |
| 199 | static RenderView* FromWebView(WebKit::WebView* webview); |
| 200 | |
| 201 | // Sets the "next page id" counter. |
| 202 | static void SetNextPageID(int32 next_page_id); |
| 203 | |
| 204 | // May return NULL when the view is closing. |
| 205 | WebKit::WebView* webview() const; |
| 206 | |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 207 | // Called by a GraphicsContext associated with this view when swapbuffers |
[email protected] | 37a6f30 | 2011-07-11 23:43:08 | [diff] [blame] | 208 | // is posted, completes or is aborted. |
| 209 | void OnViewContextSwapBuffersPosted(); |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 210 | void OnViewContextSwapBuffersComplete(); |
| 211 | void OnViewContextSwapBuffersAborted(); |
| 212 | |
[email protected] | 9966325b | 2011-04-18 05:00:10 | [diff] [blame] | 213 | int page_id() const { return page_id_; } |
[email protected] | d466b8a | 2011-07-15 21:48:03 | [diff] [blame] | 214 | int history_list_offset() const { return history_list_offset_; } |
[email protected] | 9966325b | 2011-04-18 05:00:10 | [diff] [blame] | 215 | PepperPluginDelegateImpl* pepper_delegate() { return &pepper_delegate_; } |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 216 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 217 | const WebPreferences& webkit_preferences() const { |
| 218 | return webkit_preferences_; |
| 219 | } |
| 220 | |
[email protected] | 93b9d69 | 2011-04-13 00:44:31 | [diff] [blame] | 221 | bool content_state_immediately() { return send_content_state_immediately_; } |
[email protected] | 9966325b | 2011-04-18 05:00:10 | [diff] [blame] | 222 | int enabled_bindings() const { return enabled_bindings_; } |
| 223 | void set_enabled_bindings(int b) { enabled_bindings_ = b; } |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 224 | void set_send_content_state_immediately(bool value) { |
| 225 | send_content_state_immediately_ = value; |
| 226 | } |
| 227 | |
| 228 | // Returns true if we should display scrollbars for the given view size and |
| 229 | // false if the scrollbars should be hidden. |
| 230 | bool should_display_scrollbars(int width, int height) const { |
| 231 | return (!send_preferred_size_changes_ || |
| 232 | (disable_scrollbars_size_limit_.width() <= width || |
| 233 | disable_scrollbars_size_limit_.height() <= height)); |
| 234 | } |
| 235 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 236 | const WebKit::WebNode& context_menu_node() { return context_menu_node_; } |
| 237 | |
| 238 | // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. |
| 239 | P2PSocketDispatcher* p2p_socket_dispatcher() { |
| 240 | return p2p_socket_dispatcher_; |
| 241 | } |
| 242 | |
| 243 | // Functions to add and remove observers for this object. |
| 244 | void AddObserver(RenderViewObserver* observer); |
| 245 | void RemoveObserver(RenderViewObserver* observer); |
| 246 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 247 | // Evaluates a string of JavaScript in a particular frame. |
| 248 | void EvaluateScript(const string16& frame_xpath, |
| 249 | const string16& jscript, |
| 250 | int id, |
| 251 | bool notify_result); |
| 252 | |
| 253 | // Adds the given file chooser request to the file_chooser_completion_ queue |
| 254 | // (see that var for more) and requests the chooser be displayed if there are |
| 255 | // no other waiting items in the queue. |
| 256 | // |
| 257 | // Returns true if the chooser was successfully scheduled. False means we |
| 258 | // didn't schedule anything. |
| 259 | bool ScheduleFileChooser(const ViewHostMsg_RunFileChooser_Params& params, |
| 260 | WebKit::WebFileChooserCompletion* completion); |
| 261 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 262 | // Sets whether the renderer should report load progress to the browser. |
| 263 | void SetReportLoadProgressEnabled(bool enabled); |
| 264 | |
[email protected] | 38b59290 | 2011-04-16 02:08:42 | [diff] [blame] | 265 | // Gets the focused node. If no such node exists then the node will be isNull. |
| 266 | WebKit::WebNode GetFocusedNode() const; |
| 267 | |
| 268 | // Returns true if the parameter node is a textfield, text area or a content |
| 269 | // editable div. |
| 270 | bool IsEditableNode(const WebKit::WebNode& node); |
| 271 | |
[email protected] | 9966325b | 2011-04-18 05:00:10 | [diff] [blame] | 272 | void LoadNavigationErrorPage(WebKit::WebFrame* frame, |
| 273 | const WebKit::WebURLRequest& failed_request, |
| 274 | const WebKit::WebURLError& error, |
| 275 | const std::string& html, |
| 276 | bool replace); |
| 277 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 278 | // Plugin-related functions -------------------------------------------------- |
| 279 | // (See also WebPluginPageDelegate implementation.) |
| 280 | |
| 281 | // Notification that the given plugin has crashed. |
| 282 | void PluginCrashed(const FilePath& plugin_path); |
| 283 | |
| 284 | // Notification that the default plugin has done something about a missing |
| 285 | // plugin. See default_plugin_shared.h for possible values of |status|. |
| 286 | void OnMissingPluginStatus(WebPluginDelegateProxy* delegate, |
| 287 | int status); |
| 288 | |
[email protected] | 9966325b | 2011-04-18 05:00:10 | [diff] [blame] | 289 | // Create a new NPAPI plugin. |
| 290 | WebKit::WebPlugin* CreateNPAPIPlugin(WebKit::WebFrame* frame, |
| 291 | const WebKit::WebPluginParams& params, |
| 292 | const FilePath& path, |
| 293 | const std::string& mime_type); |
| 294 | |
| 295 | // Create a new Pepper plugin. |
| 296 | WebKit::WebPlugin* CreatePepperPlugin( |
| 297 | WebKit::WebFrame* frame, |
| 298 | const WebKit::WebPluginParams& params, |
| 299 | const FilePath& path, |
| 300 | webkit::ppapi::PluginModule* pepper_module); |
| 301 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 302 | // Creates a fullscreen container for a pepper plugin instance. |
[email protected] | ea192e8 | 2011-04-11 19:16:02 | [diff] [blame] | 303 | RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer( |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 304 | webkit::ppapi::PluginInstance* plugin); |
| 305 | |
| 306 | // Create a new plugin without checking the content settings. |
| 307 | WebKit::WebPlugin* CreatePluginNoCheck(WebKit::WebFrame* frame, |
| 308 | const WebKit::WebPluginParams& params); |
| 309 | |
[email protected] | 56ea1a6 | 2011-05-30 07:05:57 | [diff] [blame] | 310 | // Informs the render view that a PPAPI plugin has gained or lost focus. |
| 311 | void PpapiPluginFocusChanged(); |
| 312 | |
[email protected] | 08bb1e72 | 2011-07-30 19:13:04 | [diff] [blame] | 313 | // Request updated policy regarding firewall NAT traversal being enabled. |
| 314 | void RequestRemoteAccessClientFirewallTraversal(); |
| 315 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 316 | #if defined(OS_MACOSX) |
| 317 | // Informs the render view that the given plugin has gained or lost focus. |
| 318 | void PluginFocusChanged(bool focused, int plugin_id); |
| 319 | |
| 320 | // Starts plugin IME. |
| 321 | void StartPluginIme(); |
| 322 | |
| 323 | // Helper routines for accelerated plugin support. Used by the |
| 324 | // WebPluginDelegateProxy, which has a pointer to the RenderView. |
| 325 | gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque, |
| 326 | bool root); |
| 327 | void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle window); |
| 328 | void AcceleratedSurfaceSetIOSurface(gfx::PluginWindowHandle window, |
| 329 | int32 width, |
| 330 | int32 height, |
| 331 | uint64 io_surface_identifier); |
| 332 | TransportDIB::Handle AcceleratedSurfaceAllocTransportDIB(size_t size); |
| 333 | void AcceleratedSurfaceFreeTransportDIB(TransportDIB::Id dib_id); |
| 334 | void AcceleratedSurfaceSetTransportDIB(gfx::PluginWindowHandle window, |
| 335 | int32 width, |
| 336 | int32 height, |
| 337 | TransportDIB::Handle transport_dib); |
| 338 | void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window, |
| 339 | uint64 surface_id); |
| 340 | #endif |
| 341 | |
| 342 | void RegisterPluginDelegate(WebPluginDelegateProxy* delegate); |
| 343 | void UnregisterPluginDelegate(WebPluginDelegateProxy* delegate); |
| 344 | |
| 345 | // IPC::Channel::Listener implementation ------------------------------------- |
| 346 | |
| 347 | virtual bool OnMessageReceived(const IPC::Message& msg); |
| 348 | |
| 349 | // WebKit::WebWidgetClient implementation ------------------------------------ |
| 350 | |
| 351 | // Most methods are handled by RenderWidget. |
| 352 | virtual void didFocus(); |
| 353 | virtual void didBlur(); |
| 354 | virtual void show(WebKit::WebNavigationPolicy policy); |
| 355 | virtual void runModal(); |
| 356 | |
| 357 | // WebKit::WebViewClient implementation -------------------------------------- |
| 358 | |
| 359 | virtual WebKit::WebView* createView( |
| 360 | WebKit::WebFrame* creator, |
| 361 | const WebKit::WebURLRequest& request, |
| 362 | const WebKit::WebWindowFeatures& features, |
| 363 | const WebKit::WebString& frame_name); |
| 364 | virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type); |
| 365 | virtual WebKit::WebWidget* createPopupMenu( |
| 366 | const WebKit::WebPopupMenuInfo& info); |
| 367 | virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu( |
| 368 | const WebKit::WebPopupMenuInfo& popup_menu_info, |
| 369 | WebKit::WebExternalPopupMenuClient* popup_menu_client); |
| 370 | virtual WebKit::WebStorageNamespace* createSessionStorageNamespace( |
| 371 | unsigned quota); |
| 372 | virtual void didAddMessageToConsole( |
| 373 | const WebKit::WebConsoleMessage& message, |
| 374 | const WebKit::WebString& source_name, |
| 375 | unsigned source_line); |
| 376 | virtual void printPage(WebKit::WebFrame* frame); |
| 377 | virtual WebKit::WebNotificationPresenter* notificationPresenter(); |
[email protected] | 8a58c1c | 2011-04-19 18:40:12 | [diff] [blame] | 378 | virtual bool enumerateChosenDirectory( |
| 379 | const WebKit::WebString& path, |
| 380 | WebKit::WebFileChooserCompletion* chooser_completion); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 381 | virtual void didStartLoading(); |
| 382 | virtual void didStopLoading(); |
| 383 | virtual void didChangeLoadProgress(WebKit::WebFrame* frame, |
| 384 | double load_progress); |
| 385 | virtual bool isSmartInsertDeleteEnabled(); |
| 386 | virtual bool isSelectTrailingWhitespaceEnabled(); |
| 387 | virtual void didChangeSelection(bool is_selection_empty); |
| 388 | virtual void didExecuteCommand(const WebKit::WebString& command_name); |
| 389 | virtual bool handleCurrentKeyboardEvent(); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 390 | virtual bool runFileChooser( |
| 391 | const WebKit::WebFileChooserParams& params, |
| 392 | WebKit::WebFileChooserCompletion* chooser_completion); |
| 393 | virtual void runModalAlertDialog(WebKit::WebFrame* frame, |
| 394 | const WebKit::WebString& message); |
| 395 | virtual bool runModalConfirmDialog(WebKit::WebFrame* frame, |
| 396 | const WebKit::WebString& message); |
| 397 | virtual bool runModalPromptDialog(WebKit::WebFrame* frame, |
| 398 | const WebKit::WebString& message, |
| 399 | const WebKit::WebString& default_value, |
| 400 | WebKit::WebString* actual_value); |
| 401 | virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame* frame, |
| 402 | const WebKit::WebString& message); |
| 403 | virtual void showContextMenu(WebKit::WebFrame* frame, |
| 404 | const WebKit::WebContextMenuData& data); |
| 405 | virtual bool supportsFullscreen(); |
| 406 | virtual void enterFullscreenForNode(const WebKit::WebNode&); |
| 407 | virtual void exitFullscreenForNode(const WebKit::WebNode&); |
| 408 | virtual void setStatusText(const WebKit::WebString& text); |
| 409 | virtual void setMouseOverURL(const WebKit::WebURL& url); |
| 410 | virtual void setKeyboardFocusURL(const WebKit::WebURL& url); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 411 | virtual void startDragging(const WebKit::WebDragData& data, |
| 412 | WebKit::WebDragOperationsMask mask, |
| 413 | const WebKit::WebImage& image, |
| 414 | const WebKit::WebPoint& imageOffset); |
| 415 | virtual bool acceptsLoadDrops(); |
| 416 | virtual void focusNext(); |
| 417 | virtual void focusPrevious(); |
| 418 | virtual void focusedNodeChanged(const WebKit::WebNode& node); |
| 419 | virtual void navigateBackForwardSoon(int offset); |
| 420 | virtual int historyBackListCount(); |
| 421 | virtual int historyForwardListCount(); |
| 422 | virtual void postAccessibilityNotification( |
| 423 | const WebKit::WebAccessibilityObject& obj, |
| 424 | WebKit::WebAccessibilityNotification notification); |
| 425 | virtual void didUpdateInspectorSetting(const WebKit::WebString& key, |
| 426 | const WebKit::WebString& value); |
| 427 | virtual WebKit::WebGeolocationClient* geolocationClient(); |
| 428 | virtual WebKit::WebSpeechInputController* speechInputController( |
| 429 | WebKit::WebSpeechInputListener* listener); |
| 430 | virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient(); |
| 431 | virtual void zoomLimitsChanged(double minimum_level, double maximum_level); |
| 432 | virtual void zoomLevelChanged(); |
| 433 | virtual void registerProtocolHandler(const WebKit::WebString& scheme, |
| 434 | const WebKit::WebString& base_url, |
| 435 | const WebKit::WebString& url, |
| 436 | const WebKit::WebString& title); |
[email protected] | 62af76e | 2011-08-01 02:34:01 | [diff] [blame] | 437 | virtual void registerIntentHandler(const WebKit::WebString& action, |
| 438 | const WebKit::WebString& type, |
| 439 | const WebKit::WebString& href, |
| 440 | const WebKit::WebString& title); |
[email protected] | 94dec93 | 2011-05-26 20:04:21 | [diff] [blame] | 441 | virtual WebKit::WebPageVisibilityState visibilityState() const; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 442 | |
| 443 | // WebKit::WebFrameClient implementation ------------------------------------- |
| 444 | |
| 445 | virtual WebKit::WebPlugin* createPlugin( |
| 446 | WebKit::WebFrame* frame, |
| 447 | const WebKit::WebPluginParams& params); |
| 448 | virtual WebKit::WebWorker* createWorker(WebKit::WebFrame* frame, |
| 449 | WebKit::WebWorkerClient* client); |
| 450 | virtual WebKit::WebSharedWorker* createSharedWorker( |
| 451 | WebKit::WebFrame* frame, const WebKit::WebURL& url, |
| 452 | const WebKit::WebString& name, unsigned long long documentId); |
| 453 | virtual WebKit::WebMediaPlayer* createMediaPlayer( |
| 454 | WebKit::WebFrame* frame, |
| 455 | WebKit::WebMediaPlayerClient* client); |
| 456 | virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost( |
| 457 | WebKit::WebFrame* frame, |
| 458 | WebKit::WebApplicationCacheHostClient* client); |
| 459 | virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame); |
| 460 | virtual void frameDetached(WebKit::WebFrame* frame); |
| 461 | virtual void willClose(WebKit::WebFrame* frame); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 462 | virtual void loadURLExternally(WebKit::WebFrame* frame, |
| 463 | const WebKit::WebURLRequest& request, |
| 464 | WebKit::WebNavigationPolicy policy); |
[email protected] | 0622875ab | 2011-07-27 12:10:34 | [diff] [blame] | 465 | virtual void loadURLExternally(WebKit::WebFrame* frame, |
| 466 | const WebKit::WebURLRequest& request, |
| 467 | WebKit::WebNavigationPolicy policy, |
| 468 | const WebKit::WebString& suggested_name); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 469 | virtual WebKit::WebNavigationPolicy decidePolicyForNavigation( |
| 470 | WebKit::WebFrame* frame, |
| 471 | const WebKit::WebURLRequest& request, |
| 472 | WebKit::WebNavigationType type, |
| 473 | const WebKit::WebNode&, |
| 474 | WebKit::WebNavigationPolicy default_policy, |
| 475 | bool is_redirect); |
| 476 | virtual bool canHandleRequest(WebKit::WebFrame* frame, |
| 477 | const WebKit::WebURLRequest& request); |
| 478 | virtual WebKit::WebURLError cannotHandleRequestError( |
| 479 | WebKit::WebFrame* frame, |
| 480 | const WebKit::WebURLRequest& request); |
| 481 | virtual WebKit::WebURLError cancelledError( |
| 482 | WebKit::WebFrame* frame, |
| 483 | const WebKit::WebURLRequest& request); |
| 484 | virtual void unableToImplementPolicyWithError( |
| 485 | WebKit::WebFrame* frame, |
| 486 | const WebKit::WebURLError& error); |
| 487 | virtual void willSendSubmitEvent(WebKit::WebFrame* frame, |
| 488 | const WebKit::WebFormElement& form); |
| 489 | virtual void willSubmitForm(WebKit::WebFrame* frame, |
| 490 | const WebKit::WebFormElement& form); |
| 491 | virtual void willPerformClientRedirect(WebKit::WebFrame* frame, |
| 492 | const WebKit::WebURL& from, |
| 493 | const WebKit::WebURL& to, |
| 494 | double interval, |
| 495 | double fire_time); |
| 496 | virtual void didCancelClientRedirect(WebKit::WebFrame* frame); |
| 497 | virtual void didCompleteClientRedirect(WebKit::WebFrame* frame, |
| 498 | const WebKit::WebURL& from); |
| 499 | virtual void didCreateDataSource(WebKit::WebFrame* frame, |
| 500 | WebKit::WebDataSource* datasource); |
| 501 | virtual void didStartProvisionalLoad(WebKit::WebFrame* frame); |
| 502 | virtual void didReceiveServerRedirectForProvisionalLoad( |
| 503 | WebKit::WebFrame* frame); |
| 504 | virtual void didFailProvisionalLoad(WebKit::WebFrame* frame, |
| 505 | const WebKit::WebURLError& error); |
| 506 | virtual void didReceiveDocumentData(WebKit::WebFrame* frame, |
| 507 | const char* data, size_t length, |
| 508 | bool& prevent_default); |
| 509 | virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame, |
| 510 | bool is_new_navigation); |
| 511 | virtual void didClearWindowObject(WebKit::WebFrame* frame); |
| 512 | virtual void didCreateDocumentElement(WebKit::WebFrame* frame); |
| 513 | virtual void didReceiveTitle(WebKit::WebFrame* frame, |
[email protected] | a3bc4d1 | 2011-04-20 17:22:21 | [diff] [blame] | 514 | const WebKit::WebString& title, |
| 515 | WebKit::WebTextDirection direction); |
[email protected] | 42054a25 | 2011-05-17 18:02:13 | [diff] [blame] | 516 | virtual void didChangeIcon(WebKit::WebFrame*, |
| 517 | WebKit::WebIconURL::Type) OVERRIDE; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 518 | virtual void didFinishDocumentLoad(WebKit::WebFrame* frame); |
| 519 | virtual void didHandleOnloadEvents(WebKit::WebFrame* frame); |
| 520 | virtual void didFailLoad(WebKit::WebFrame* frame, |
| 521 | const WebKit::WebURLError& error); |
| 522 | virtual void didFinishLoad(WebKit::WebFrame* frame); |
| 523 | virtual void didNavigateWithinPage(WebKit::WebFrame* frame, |
| 524 | bool is_new_navigation); |
| 525 | virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame); |
| 526 | virtual void assignIdentifierToRequest(WebKit::WebFrame* frame, |
| 527 | unsigned identifier, |
| 528 | const WebKit::WebURLRequest& request); |
| 529 | virtual void willSendRequest(WebKit::WebFrame* frame, |
| 530 | unsigned identifier, |
| 531 | WebKit::WebURLRequest& request, |
| 532 | const WebKit::WebURLResponse& redirect_response); |
| 533 | virtual void didReceiveResponse(WebKit::WebFrame* frame, |
| 534 | unsigned identifier, |
| 535 | const WebKit::WebURLResponse& response); |
| 536 | virtual void didFinishResourceLoad(WebKit::WebFrame* frame, |
| 537 | unsigned identifier); |
| 538 | virtual void didFailResourceLoad(WebKit::WebFrame* frame, |
| 539 | unsigned identifier, |
| 540 | const WebKit::WebURLError& error); |
| 541 | virtual void didLoadResourceFromMemoryCache( |
| 542 | WebKit::WebFrame* frame, |
| 543 | const WebKit::WebURLRequest& request, |
| 544 | const WebKit::WebURLResponse&); |
| 545 | virtual void didDisplayInsecureContent(WebKit::WebFrame* frame); |
| 546 | virtual void didRunInsecureContent( |
| 547 | WebKit::WebFrame* frame, |
| 548 | const WebKit::WebSecurityOrigin& origin, |
| 549 | const WebKit::WebURL& target); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 550 | virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame* frame); |
| 551 | virtual void didCreateScriptContext(WebKit::WebFrame* frame); |
| 552 | virtual void didDestroyScriptContext(WebKit::WebFrame* frame); |
| 553 | virtual void didCreateIsolatedScriptContext(WebKit::WebFrame* frame); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 554 | virtual void logCrossFramePropertyAccess( |
| 555 | WebKit::WebFrame* frame, |
| 556 | WebKit::WebFrame* target, |
| 557 | bool cross_origin, |
| 558 | const WebKit::WebString& property_name, |
| 559 | unsigned long long event_id); |
[email protected] | d812fd1 | 2011-05-27 23:05:07 | [diff] [blame] | 560 | virtual void didUpdateLayout(WebKit::WebFrame* frame); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 561 | virtual void didChangeScrollOffset(WebKit::WebFrame* frame); |
| 562 | virtual void reportFindInPageMatchCount(int request_id, |
| 563 | int count, |
| 564 | bool final_update); |
| 565 | virtual void reportFindInPageSelection(int request_id, |
| 566 | int active_match_ordinal, |
| 567 | const WebKit::WebRect& sel); |
| 568 | |
| 569 | virtual void openFileSystem(WebKit::WebFrame* frame, |
| 570 | WebKit::WebFileSystem::Type type, |
| 571 | long long size, |
| 572 | bool create, |
| 573 | WebKit::WebFileSystemCallbacks* callbacks); |
| 574 | |
[email protected] | 10e5cf1 | 2011-04-13 04:10:40 | [diff] [blame] | 575 | virtual void queryStorageUsageAndQuota( |
| 576 | WebKit::WebFrame* frame, |
| 577 | WebKit::WebStorageQuotaType type, |
| 578 | WebKit::WebStorageQuotaCallbacks* callbacks); |
| 579 | |
| 580 | virtual void requestStorageQuota( |
| 581 | WebKit::WebFrame* frame, |
| 582 | WebKit::WebStorageQuotaType type, |
| 583 | unsigned long long requested_size, |
| 584 | WebKit::WebStorageQuotaCallbacks* callbacks); |
| 585 | |
[email protected] | 18d5be9 | 2011-07-25 18:00:19 | [diff] [blame] | 586 | // WebKit::WebPageSerializerClient implementation ---------------------------- |
| 587 | |
| 588 | virtual void didSerializeDataForFrame( |
| 589 | const WebKit::WebURL& frame_url, |
| 590 | const WebKit::WebCString& data, |
| 591 | PageSerializationStatus status) OVERRIDE; |
| 592 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 593 | // webkit_glue::WebPluginPageDelegate implementation ------------------------- |
| 594 | |
| 595 | virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate( |
| 596 | const FilePath& file_path, |
| 597 | const std::string& mime_type); |
| 598 | virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle); |
| 599 | virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle); |
| 600 | virtual void DidMovePlugin(const webkit::npapi::WebPluginGeometry& move); |
| 601 | virtual void DidStartLoadingForPlugin(); |
| 602 | virtual void DidStopLoadingForPlugin(); |
| 603 | virtual WebKit::WebCookieJar* GetCookieJar(); |
| 604 | |
| 605 | // Please do not add your stuff randomly to the end here. If there is an |
| 606 | // appropriate section, add it there. If not, there are some random functions |
| 607 | // nearer to the top you can add it to. |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 608 | virtual void DidFlushPaint(); |
| 609 | |
[email protected] | 38b59290 | 2011-04-16 02:08:42 | [diff] [blame] | 610 | // Cannot use std::set unfortunately since linked_ptr<> does not support |
| 611 | // operator<. |
| 612 | typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> > |
| 613 | ImageResourceFetcherList; |
| 614 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 615 | protected: |
| 616 | // RenderWidget overrides: |
| 617 | virtual void Close(); |
| 618 | virtual void OnResize(const gfx::Size& new_size, |
| 619 | const gfx::Rect& resizer_rect); |
| 620 | virtual void DidInitiatePaint(); |
| 621 | virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( |
| 622 | const gfx::Rect& paint_bounds, |
| 623 | TransportDIB** dib, |
| 624 | gfx::Rect* location, |
| 625 | gfx::Rect* clip); |
| 626 | virtual gfx::Point GetScrollOffset(); |
| 627 | virtual void DidHandleKeyEvent(); |
| 628 | virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event); |
| 629 | virtual void OnSetFocus(bool enable); |
| 630 | virtual void OnWasHidden(); |
| 631 | virtual void OnWasRestored(bool needs_repainting); |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 632 | virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE; |
[email protected] | 56ea1a6 | 2011-05-30 07:05:57 | [diff] [blame] | 633 | virtual void OnImeSetComposition( |
| 634 | const string16& text, |
| 635 | const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 636 | int selection_start, |
| 637 | int selection_end) OVERRIDE; |
| 638 | virtual void OnImeConfirmComposition(const string16& text) OVERRIDE; |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 639 | virtual ui::TextInputType GetTextInputType() OVERRIDE; |
| 640 | virtual bool CanComposeInline() OVERRIDE; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 641 | |
| 642 | private: |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 643 | // For unit tests. |
| 644 | friend class ExternalPopupMenuTest; |
| 645 | friend class PepperDeviceTest; |
| 646 | friend class RenderViewTest; |
| 647 | |
| 648 | FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); |
| 649 | FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); |
| 650 | FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 651 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, ImeComposition); |
| 652 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, InsertCharacters); |
| 653 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, JSBlockSentAfterPageLoad); |
| 654 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, LastCommittedUpdateState); |
| 655 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnHandleKeyboardEvent); |
| 656 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnImeStateChanged); |
| 657 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnNavStateChanged); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 658 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnSetTextDirection); |
[email protected] | d466b8a | 2011-07-15 21:48:03 | [diff] [blame] | 659 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, StaleNavigationsIgnored); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 660 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, UpdateTargetURLWithInvalidURL); |
| 661 | #if defined(OS_MACOSX) |
| 662 | FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); |
| 663 | #endif |
| 664 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 665 | typedef std::map<GURL, double> HostZoomLevels; |
| 666 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 667 | // Identifies an accessibility notification from webkit. |
| 668 | struct RendererAccessibilityNotification { |
| 669 | public: |
| 670 | bool ShouldIncludeChildren(); |
| 671 | |
| 672 | // The webkit glue id of the accessibility object. |
| 673 | int32 id; |
| 674 | |
| 675 | // The accessibility notification type. |
| 676 | WebKit::WebAccessibilityNotification type; |
| 677 | }; |
| 678 | |
| 679 | enum ErrorPageType { |
| 680 | DNS_ERROR, |
| 681 | HTTP_404, |
| 682 | CONNECTION_ERROR, |
| 683 | }; |
| 684 | |
| 685 | RenderView(RenderThreadBase* render_thread, |
| 686 | gfx::NativeViewId parent_hwnd, |
| 687 | int32 opener_id, |
| 688 | const RendererPreferences& renderer_prefs, |
| 689 | const WebPreferences& webkit_prefs, |
| 690 | SharedRenderViewCounter* counter, |
| 691 | int32 routing_id, |
| 692 | int64 session_storage_namespace_id, |
| 693 | const string16& frame_name); |
| 694 | |
| 695 | // Do not delete directly. This class is reference counted. |
| 696 | virtual ~RenderView(); |
| 697 | |
| 698 | void UpdateURL(WebKit::WebFrame* frame); |
[email protected] | a49e10b | 2011-08-01 23:57:46 | [diff] [blame] | 699 | void UpdateTitle(WebKit::WebFrame* frame, const string16& title, |
| 700 | WebKit::WebTextDirection title_direction); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 701 | void UpdateSessionHistory(WebKit::WebFrame* frame); |
| 702 | |
| 703 | // Update current main frame's encoding and send it to browser window. |
| 704 | // Since we want to let users see the right encoding info from menu |
| 705 | // before finishing loading, we call the UpdateEncoding in |
| 706 | // a) function:DidCommitLoadForFrame. When this function is called, |
| 707 | // that means we have got first data. In here we try to get encoding |
| 708 | // of page if it has been specified in http header. |
| 709 | // b) function:DidReceiveTitle. When this function is called, |
| 710 | // that means we have got specified title. Because in most of webpages, |
| 711 | // title tags will follow meta tags. In here we try to get encoding of |
| 712 | // page if it has been specified in meta tag. |
| 713 | // c) function:DidFinishDocumentLoadForFrame. When this function is |
| 714 | // called, that means we have got whole html page. In here we should |
| 715 | // finally get right encoding of page. |
| 716 | void UpdateEncoding(WebKit::WebFrame* frame, |
| 717 | const std::string& encoding_name); |
| 718 | |
| 719 | void OpenURL(const GURL& url, const GURL& referrer, |
| 720 | WebKit::WebNavigationPolicy policy); |
| 721 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 722 | bool RunJavaScriptMessage(int type, |
[email protected] | 4f5ce84 | 2011-05-27 19:34:41 | [diff] [blame] | 723 | const string16& message, |
| 724 | const string16& default_value, |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 725 | const GURL& frame_url, |
[email protected] | 4f5ce84 | 2011-05-27 19:34:41 | [diff] [blame] | 726 | string16* result); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 727 | |
| 728 | // Sends a message and runs a nested message loop. |
| 729 | bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message); |
| 730 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 731 | // Send queued accessibility notifications from the renderer to the browser. |
| 732 | void SendPendingAccessibilityNotifications(); |
| 733 | |
| 734 | // IPC message handlers ------------------------------------------------------ |
| 735 | // |
| 736 | // The documentation for these functions should be in |
| 737 | // render_messages_internal.h for the message that the function is handling. |
| 738 | |
| 739 | void OnAccessibilityDoDefaultAction(int acc_obj_id); |
| 740 | void OnAccessibilityNotificationsAck(); |
| 741 | void OnAllowBindings(int enabled_bindings_flags); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 742 | void OnAllowScriptToClose(bool script_can_close); |
| 743 | void OnAsyncFileOpened(base::PlatformFileError error_code, |
| 744 | IPC::PlatformFileForTransit file_for_transit, |
| 745 | int message_id); |
[email protected] | eb415bf0e | 2011-04-14 02:45:42 | [diff] [blame] | 746 | void OnPpapiBrokerChannelCreated(int request_id, |
[email protected] | 2b657fd | 2011-04-18 16:00:47 | [diff] [blame] | 747 | base::ProcessHandle broker_process_handle, |
[email protected] | d5430507 | 2011-06-22 20:58:43 | [diff] [blame] | 748 | const IPC::ChannelHandle& handle); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 749 | void OnCancelDownload(int32 download_id); |
| 750 | void OnClearFocusedNode(); |
[email protected] | 992db4c | 2011-05-12 15:37:15 | [diff] [blame] | 751 | void OnClosePage(); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 752 | #if defined(ENABLE_FLAPPER_HACKS) |
| 753 | void OnConnectTcpACK(int request_id, |
| 754 | IPC::PlatformFileForTransit socket_for_transit, |
| 755 | const PP_Flash_NetAddress& local_addr, |
| 756 | const PP_Flash_NetAddress& remote_addr); |
| 757 | #endif |
| 758 | void OnContextMenuClosed( |
| 759 | const webkit_glue::CustomContextMenuContext& custom_context); |
| 760 | void OnCopy(); |
| 761 | void OnCopyImageAt(int x, int y); |
| 762 | #if defined(OS_MACOSX) |
| 763 | void OnCopyToFindPboard(); |
| 764 | #endif |
| 765 | void OnCut(); |
[email protected] | 318bf580 | 2011-08-08 17:12:41 | [diff] [blame^] | 766 | void OnCSSInsertRequest(const string16& frame_xpath, |
[email protected] | 01cf589c | 2011-07-28 18:04:03 | [diff] [blame] | 767 | const std::string& css); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 768 | void OnCustomContextMenuAction( |
| 769 | const webkit_glue::CustomContextMenuContext& custom_context, |
| 770 | unsigned action); |
| 771 | void OnDelete(); |
| 772 | void OnDeterminePageLanguage(); |
| 773 | void OnDisableScrollbarsForSmallWindows( |
| 774 | const gfx::Size& disable_scrollbars_size_limit); |
| 775 | void OnDisassociateFromPopupCount(); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 776 | void OnDragSourceEndedOrMoved(const gfx::Point& client_point, |
| 777 | const gfx::Point& screen_point, |
| 778 | bool ended, |
| 779 | WebKit::WebDragOperation drag_operation); |
| 780 | void OnDragSourceSystemDragEnded(); |
| 781 | void OnDragTargetDrop(const gfx::Point& client_pt, |
| 782 | const gfx::Point& screen_pt); |
| 783 | void OnDragTargetDragEnter(const WebDropData& drop_data, |
| 784 | const gfx::Point& client_pt, |
| 785 | const gfx::Point& screen_pt, |
| 786 | WebKit::WebDragOperationsMask operations_allowed); |
| 787 | void OnDragTargetDragLeave(); |
| 788 | void OnDragTargetDragOver(const gfx::Point& client_pt, |
| 789 | const gfx::Point& screen_pt, |
| 790 | WebKit::WebDragOperationsMask operations_allowed); |
| 791 | void OnEnablePreferredSizeChangedMode(int flags); |
[email protected] | 600ea40 | 2011-04-12 00:01:51 | [diff] [blame] | 792 | void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 793 | void OnExecuteEditCommand(const std::string& name, const std::string& value); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 794 | void OnFileChooserResponse(const std::vector<FilePath>& paths); |
| 795 | void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&); |
| 796 | void OnFindReplyAck(); |
| 797 | void OnEnableAccessibility(); |
[email protected] | 18d5be9 | 2011-07-25 18:00:19 | [diff] [blame] | 798 | void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url); |
| 799 | void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( |
| 800 | const std::vector<GURL>& links, |
| 801 | const std::vector<FilePath>& local_paths, |
| 802 | const FilePath& local_directory_name); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 803 | void OnInstallMissingPlugin(); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 804 | void OnMediaPlayerActionAt(const gfx::Point& location, |
| 805 | const WebKit::WebMediaPlayerAction& action); |
| 806 | void OnMoveOrResizeStarted(); |
| 807 | void OnNavigate(const ViewMsg_Navigate_Params& params); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 808 | void OnPaste(); |
| 809 | #if defined(OS_MACOSX) |
| 810 | void OnPluginImeCompositionCompleted(const string16& text, int plugin_id); |
| 811 | #endif |
| 812 | void OnRedo(); |
| 813 | void OnReloadFrame(); |
| 814 | void OnReplace(const string16& text); |
| 815 | void OnReservePageIDRange(int size_of_range); |
| 816 | void OnResetPageEncodingToDefault(); |
| 817 | void OnScriptEvalRequest(const string16& frame_xpath, |
| 818 | const string16& jscript, |
| 819 | int id, |
| 820 | bool notify_result); |
| 821 | void OnSelectAll(); |
| 822 | void OnSetAccessibilityFocus(int acc_obj_id); |
| 823 | void OnSetActive(bool active); |
| 824 | void OnSetAltErrorPageURL(const GURL& gurl); |
| 825 | void OnSetBackground(const SkBitmap& background); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 826 | void OnSetWebUIProperty(const std::string& name, const std::string& value); |
| 827 | void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands); |
| 828 | void OnSetInitialFocus(bool reverse); |
[email protected] | 54ca3ca89 | 2011-06-07 21:14:54 | [diff] [blame] | 829 | #if defined(OS_MACOSX) |
| 830 | void OnSetInLiveResize(bool in_live_resize); |
| 831 | #endif |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 832 | void OnScrollFocusedEditableNodeIntoView(); |
| 833 | void OnSetPageEncoding(const std::string& encoding_name); |
| 834 | void OnSetRendererPrefs(const RendererPreferences& renderer_prefs); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 835 | #if defined(OS_MACOSX) |
| 836 | void OnSetWindowVisibility(bool visible); |
| 837 | #endif |
| 838 | void OnSetZoomLevel(double zoom_level); |
| 839 | void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level); |
| 840 | void OnShouldClose(); |
| 841 | void OnStop(); |
| 842 | void OnStopFinding(const ViewMsg_StopFinding_Params& params); |
[email protected] | 992db4c | 2011-05-12 15:37:15 | [diff] [blame] | 843 | void OnSwapOut(const ViewMsg_SwapOut_Params& params); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 844 | void OnThemeChanged(); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 845 | void OnUndo(); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 846 | void OnUpdateTargetURLAck(); |
| 847 | void OnUpdateWebPreferences(const WebPreferences& prefs); |
[email protected] | 08bb1e72 | 2011-07-30 19:13:04 | [diff] [blame] | 848 | void OnUpdateRemoteAccessClientFirewallTraversal(const std::string& policy); |
| 849 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 850 | #if defined(OS_MACOSX) |
| 851 | void OnWindowFrameChanged(const gfx::Rect& window_frame, |
| 852 | const gfx::Rect& view_frame); |
| 853 | void OnSelectPopupMenuItem(int selected_index); |
| 854 | #endif |
| 855 | void OnZoom(PageZoom::Function function); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 856 | |
| 857 | // Adding a new message handler? Please add it in alphabetical order above |
| 858 | // and put it in the same position in the .cc file. |
| 859 | |
| 860 | // Misc private functions ---------------------------------------------------- |
| 861 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 862 | void AltErrorPageFinished(WebKit::WebFrame* frame, |
| 863 | const WebKit::WebURLError& original_error, |
| 864 | const std::string& html); |
| 865 | |
[email protected] | d812fd1 | 2011-05-27 23:05:07 | [diff] [blame] | 866 | // Check whether the preferred size has changed. |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 867 | void CheckPreferredSize(); |
| 868 | |
[email protected] | 5e56df8 | 2011-04-18 17:00:15 | [diff] [blame] | 869 | // This callback is triggered when DownloadFavicon completes, either |
| 870 | // succesfully or with a failure. See DownloadFavicon for more |
| 871 | // details. |
| 872 | void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, |
| 873 | const SkBitmap& image); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 874 | |
[email protected] | 5e56df8 | 2011-04-18 17:00:15 | [diff] [blame] | 875 | // Requests to download a favicon image. When done, the RenderView |
| 876 | // is notified by way of DidDownloadFavicon. Returns true if the |
| 877 | // request was successfully started, false otherwise. id is used to |
| 878 | // uniquely identify the request and passed back to the |
| 879 | // DidDownloadFavicon method. If the image has multiple frames, the |
| 880 | // frame whose size is image_size is returned. If the image doesn't |
| 881 | // have a frame at the specified size, the first is returned. |
| 882 | bool DownloadFavicon(int id, const GURL& image_url, int image_size); |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 883 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 884 | GURL GetAlternateErrorPageURL(const GURL& failed_url, |
| 885 | ErrorPageType error_type); |
| 886 | |
| 887 | // Locates a sub frame with given xpath |
[email protected] | 318bf580 | 2011-08-08 17:12:41 | [diff] [blame^] | 888 | WebKit::WebFrame* GetChildFrame(const string16& frame_xpath) const; |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 889 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 890 | WebUIBindings* GetWebUIBindings(); |
| 891 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 892 | // Should only be called if this object wraps a PluginDocument. |
| 893 | WebKit::WebPlugin* GetWebPluginFromPluginDocument(); |
| 894 | |
[email protected] | d466b8a | 2011-07-15 21:48:03 | [diff] [blame] | 895 | // Returns true if the |params| navigation is to an entry that has been |
| 896 | // cropped due to a recent navigation the browser did not know about. |
| 897 | bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params, |
| 898 | bool is_reload); |
| 899 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 900 | // Returns false unless this is a top-level navigation that crosses origins. |
| 901 | bool IsNonLocalTopLevelNavigation(const GURL& url, |
| 902 | WebKit::WebFrame* frame, |
| 903 | WebKit::WebNavigationType type); |
| 904 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 905 | bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame, |
| 906 | const WebKit::WebURLError& error, |
| 907 | bool replace); |
| 908 | |
| 909 | // Starts nav_state_sync_timer_ if it isn't already running. |
| 910 | void StartNavStateSyncTimerIfNecessary(); |
| 911 | |
| 912 | // Dispatches the current navigation state to the browser. Called on a |
| 913 | // periodic timer so we don't send too many messages. |
| 914 | void SyncNavigationState(); |
| 915 | |
[email protected] | e63c4d7 | 2011-05-31 22:38:29 | [diff] [blame] | 916 | #if defined(OS_POSIX) && !defined(OS_MACOSX) |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 917 | void UpdateFontRenderingFromRendererPrefs(); |
| 918 | #else |
| 919 | void UpdateFontRenderingFromRendererPrefs() {} |
| 920 | #endif |
| 921 | |
| 922 | // Update the target url and tell the browser that the target URL has changed. |
| 923 | // If |url| is empty, show |fallback_url|. |
| 924 | void UpdateTargetURL(const GURL& url, const GURL& fallback_url); |
| 925 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 926 | // --------------------------------------------------------------------------- |
| 927 | // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put |
| 928 | // it in the same order in the .cc file as it was in the header. |
| 929 | // --------------------------------------------------------------------------- |
| 930 | |
| 931 | // Settings ------------------------------------------------------------------ |
| 932 | |
| 933 | WebPreferences webkit_preferences_; |
| 934 | RendererPreferences renderer_preferences_; |
| 935 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 936 | HostZoomLevels host_zoom_levels_; |
| 937 | |
| 938 | // Whether content state (such as form state, scroll position and page |
| 939 | // contents) should be sent to the browser immediately. This is normally |
| 940 | // false, but set to true by some tests. |
| 941 | bool send_content_state_immediately_; |
| 942 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 943 | // Bitwise-ORed set of extra bindings that have been enabled. See |
| 944 | // BindingsPolicy for details. |
| 945 | int enabled_bindings_; |
| 946 | |
| 947 | // The alternate error page URL, if one exists. |
| 948 | GURL alternate_error_page_url_; |
| 949 | |
| 950 | // If true, we send IPC messages when |preferred_size_| changes. |
| 951 | bool send_preferred_size_changes_; |
| 952 | |
| 953 | // If non-empty, and |send_preferred_size_changes_| is true, disable drawing |
| 954 | // scroll bars on windows smaller than this size. Used for windows that the |
| 955 | // browser resizes to the size of the content, such as browser action popups. |
| 956 | // If a render view is set to the minimum size of its content, webkit may add |
| 957 | // scroll bars. This makes sense for fixed sized windows, but it does not |
| 958 | // make sense when the size of the view was chosen to fit the content. |
| 959 | // This setting ensures that no scroll bars are drawn. The size limit exists |
| 960 | // because if the view grows beyond a size known to the browser, scroll bars |
| 961 | // should be drawn. |
| 962 | gfx::Size disable_scrollbars_size_limit_; |
| 963 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 964 | // Loading state ------------------------------------------------------------- |
| 965 | |
| 966 | // True if the top level frame is currently being loaded. |
| 967 | bool is_loading_; |
| 968 | |
| 969 | // The gesture that initiated the current navigation. |
| 970 | NavigationGesture navigation_gesture_; |
| 971 | |
| 972 | // Used for popups. |
| 973 | bool opened_by_user_gesture_; |
| 974 | GURL creator_url_; |
| 975 | |
| 976 | // Whether this RenderView was created by a frame that was suppressing its |
| 977 | // opener. If so, we may want to load pages in a separate process. See |
| 978 | // decidePolicyForNavigation for details. |
| 979 | bool opener_suppressed_; |
| 980 | |
| 981 | // If we are handling a top-level client-side redirect, this tracks the URL |
| 982 | // of the page that initiated it. Specifically, when a load is committed this |
| 983 | // is used to determine if that load originated from a client-side redirect. |
| 984 | // It is empty if there is no top-level client-side redirect. |
| 985 | GURL completed_client_redirect_src_; |
| 986 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 987 | // Holds state pertaining to a navigation that we initiated. This is held by |
| 988 | // the WebDataSource::ExtraData attribute. We use pending_navigation_state_ |
| 989 | // as a temporary holder for the state until the WebDataSource corresponding |
| 990 | // to the new navigation is created. See DidCreateDataSource. |
| 991 | scoped_ptr<NavigationState> pending_navigation_state_; |
| 992 | |
| 993 | // Timer used to delay the updating of nav state (see SyncNavigationState). |
| 994 | base::OneShotTimer<RenderView> nav_state_sync_timer_; |
| 995 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 996 | // Page IDs ------------------------------------------------------------------ |
| 997 | // |
| 998 | // Page IDs allow the browser to identify pages in each renderer process for |
| 999 | // keeping back/forward history in sync. |
| 1000 | |
| 1001 | // ID of the current page. Note that this is NOT updated for every main |
| 1002 | // frame navigation, only for "regular" navigations that go into session |
| 1003 | // history. In particular, client redirects, like the page cycler uses |
| 1004 | // (document.location.href="foo") do not count as regular navigations and do |
| 1005 | // not increment the page id. |
| 1006 | int32 page_id_; |
| 1007 | |
| 1008 | // Indicates the ID of the last page that we sent a FrameNavigate to the |
| 1009 | // browser for. This is used to determine if the most recent transition |
| 1010 | // generated a history entry (less than page_id_), or not (equal to or |
| 1011 | // greater than). Note that this will be greater than page_id_ if the user |
| 1012 | // goes back. |
| 1013 | int32 last_page_id_sent_to_browser_; |
| 1014 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1015 | // The next available page ID to use. This ensures that the page IDs are |
| 1016 | // globally unique in the renderer. |
| 1017 | static int32 next_page_id_; |
| 1018 | |
[email protected] | d466b8a | 2011-07-15 21:48:03 | [diff] [blame] | 1019 | // The offset of the current item in the history list. |
| 1020 | int history_list_offset_; |
| 1021 | |
| 1022 | // The RenderView's current impression of the history length. This includes |
| 1023 | // any items that have committed in this process, but because of cross-process |
| 1024 | // navigations, the history may have some entries that were committed in other |
| 1025 | // processes. We won't know about them until the next navigation in this |
| 1026 | // process. |
| 1027 | int history_list_length_; |
| 1028 | |
| 1029 | // The list of page IDs for each history item this RenderView knows about. |
| 1030 | // Some entries may be -1 if they were rendered by other processes or were |
| 1031 | // restored from a previous session. This lets us detect attempts to |
| 1032 | // navigate to stale entries that have been cropped from our history. |
| 1033 | std::vector<int32> history_page_ids_; |
| 1034 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1035 | // Page info ----------------------------------------------------------------- |
| 1036 | |
| 1037 | // The last gotten main frame's encoding. |
| 1038 | std::string last_encoding_name_; |
| 1039 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1040 | // UI state ------------------------------------------------------------------ |
| 1041 | |
| 1042 | // The state of our target_url transmissions. When we receive a request to |
| 1043 | // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK |
| 1044 | // comes back - if a new request comes in before the ACK, we store the new |
| 1045 | // URL in pending_target_url_ and set the status to TARGET_PENDING. If an |
| 1046 | // ACK comes back and we are in TARGET_PENDING, we send the stored URL and |
| 1047 | // revert to TARGET_INFLIGHT. |
| 1048 | // |
| 1049 | // We don't need a queue of URLs to send, as only the latest is useful. |
| 1050 | enum { |
| 1051 | TARGET_NONE, |
| 1052 | TARGET_INFLIGHT, // We have a request in-flight, waiting for an ACK |
| 1053 | TARGET_PENDING // INFLIGHT + we have a URL waiting to be sent |
| 1054 | } target_url_status_; |
| 1055 | |
| 1056 | // The URL we show the user in the status bar. We use this to determine if we |
| 1057 | // want to send a new one (we do not need to send duplicates). It will be |
| 1058 | // equal to either |mouse_over_url_| or |focus_url_|, depending on which was |
| 1059 | // updated last. |
| 1060 | GURL target_url_; |
| 1061 | |
| 1062 | // The URL the user's mouse is hovering over. |
| 1063 | GURL mouse_over_url_; |
| 1064 | |
| 1065 | // The URL that has keyboard focus. |
| 1066 | GURL focus_url_; |
| 1067 | |
| 1068 | // The next target URL we want to send to the browser. |
| 1069 | GURL pending_target_url_; |
| 1070 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1071 | // The text selection the last time DidChangeSelection got called. |
| 1072 | std::string last_selection_; |
| 1073 | |
| 1074 | // View ---------------------------------------------------------------------- |
| 1075 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1076 | // Cache the preferred size of the page in order to prevent sending the IPC |
| 1077 | // when layout() recomputes but doesn't actually change sizes. |
| 1078 | gfx::Size preferred_size_; |
| 1079 | |
[email protected] | 1e0c8e0 | 2011-05-25 07:49:37 | [diff] [blame] | 1080 | // Used to delay determining the preferred size (to avoid intermediate |
| 1081 | // states for the sizes). |
| 1082 | base::OneShotTimer<RenderView> check_preferred_size_timer_; |
| 1083 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1084 | #if defined(OS_MACOSX) |
| 1085 | // Track the fake plugin window handles allocated on the browser side for |
| 1086 | // the accelerated compositor and (currently) accelerated plugins so that |
| 1087 | // we can discard them when the view goes away. |
| 1088 | std::set<gfx::PluginWindowHandle> fake_plugin_window_handles_; |
| 1089 | #endif |
| 1090 | |
| 1091 | // Plugins ------------------------------------------------------------------- |
| 1092 | |
| 1093 | // Remember the first uninstalled plugin, so that we can ask the plugin |
| 1094 | // to install itself when user clicks on the info bar. |
| 1095 | base::WeakPtr<webkit::npapi::WebPluginDelegate> first_default_plugin_; |
| 1096 | |
| 1097 | PepperPluginDelegateImpl pepper_delegate_; |
| 1098 | |
| 1099 | // All the currently active plugin delegates for this RenderView; kept so that |
| 1100 | // we can enumerate them to send updates about things like window location |
| 1101 | // or tab focus and visibily. These are non-owning references. |
| 1102 | std::set<WebPluginDelegateProxy*> plugin_delegates_; |
| 1103 | |
| 1104 | // Helper objects ------------------------------------------------------------ |
| 1105 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1106 | ScopedRunnableMethodFactory<RenderView> accessibility_method_factory_; |
| 1107 | |
| 1108 | RendererWebCookieJarImpl cookie_jar_; |
| 1109 | |
| 1110 | // The next group of objects all implement RenderViewObserver, so are deleted |
| 1111 | // along with the RenderView automatically. This is why we just store weak |
| 1112 | // references. |
| 1113 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1114 | // Holds a reference to the service which provides desktop notifications. |
| 1115 | NotificationProvider* notification_provider_; |
| 1116 | |
| 1117 | // The geolocation dispatcher attached to this view, lazily initialized. |
| 1118 | GeolocationDispatcher* geolocation_dispatcher_; |
| 1119 | |
| 1120 | // The speech dispatcher attached to this view, lazily initialized. |
| 1121 | SpeechInputDispatcher* speech_input_dispatcher_; |
| 1122 | |
| 1123 | // Device orientation dispatcher attached to this view; lazily initialized. |
| 1124 | DeviceOrientationDispatcher* device_orientation_dispatcher_; |
| 1125 | |
[email protected] | ab2c473 | 2011-07-20 19:57:40 | [diff] [blame] | 1126 | // MediaStreamImpl attached to this view; lazily initialized. |
| 1127 | scoped_refptr<MediaStreamImpl> media_stream_impl_; |
| 1128 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1129 | // Handles accessibility requests into the renderer side, as well as |
| 1130 | // maintains the cache and other features of the accessibility tree. |
| 1131 | scoped_ptr<WebKit::WebAccessibilityCache> accessibility_; |
| 1132 | |
| 1133 | // Collect renderer accessibility notifications until they are ready to be |
| 1134 | // sent to the browser. |
| 1135 | std::vector<RendererAccessibilityNotification> |
| 1136 | pending_accessibility_notifications_; |
| 1137 | |
| 1138 | // Set if we are waiting for a accessibility notification ack. |
| 1139 | bool accessibility_ack_pending_; |
| 1140 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1141 | // Dispatches all P2P socket used by the renderer. |
| 1142 | P2PSocketDispatcher* p2p_socket_dispatcher_; |
| 1143 | |
[email protected] | c5c1d6d | 2011-07-28 18:42:41 | [diff] [blame] | 1144 | DevToolsAgent* devtools_agent_; |
| 1145 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1146 | // Misc ---------------------------------------------------------------------- |
| 1147 | |
| 1148 | // The current and pending file chooser completion objects. If the queue is |
| 1149 | // nonempty, the first item represents the currently running file chooser |
| 1150 | // callback, and the remaining elements are the other file chooser completion |
| 1151 | // still waiting to be run (in order). |
| 1152 | struct PendingFileChooser; |
| 1153 | std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_; |
| 1154 | |
[email protected] | 600ea40 | 2011-04-12 00:01:51 | [diff] [blame] | 1155 | // The current directory enumeration callback |
| 1156 | std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_; |
| 1157 | int enumeration_completion_id_; |
| 1158 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1159 | // The SessionStorage namespace that we're assigned to has an ID, and that ID |
| 1160 | // is passed to us upon creation. WebKit asks for this ID upon first use and |
| 1161 | // uses it whenever asking the browser process to allocate new storage areas. |
| 1162 | int64 session_storage_namespace_id_; |
| 1163 | |
| 1164 | // The total number of unrequested popups that exist and can be followed back |
| 1165 | // to a common opener. This count is shared among all RenderViews created |
| 1166 | // with createView(). All popups are treated as unrequested until |
| 1167 | // specifically instructed otherwise by the Browser process. |
| 1168 | scoped_refptr<SharedRenderViewCounter> shared_popup_counter_; |
| 1169 | |
| 1170 | // Whether this is a top level window (instead of a popup). Top level windows |
| 1171 | // shouldn't count against their own |shared_popup_counter_|. |
| 1172 | bool decrement_shared_popup_at_destruction_; |
| 1173 | |
| 1174 | // If the browser hasn't sent us an ACK for the last FindReply we sent |
| 1175 | // to it, then we need to queue up the message (keeping only the most |
| 1176 | // recent message if new ones come in). |
| 1177 | scoped_ptr<IPC::Message> queued_find_reply_message_; |
| 1178 | |
| 1179 | // Stores edit commands associated to the next key event. |
| 1180 | // Shall be cleared as soon as the next key event is processed. |
| 1181 | EditCommands edit_commands_; |
| 1182 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1183 | // Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS |
| 1184 | // object is only exposed when Web UI bindings are enabled. |
| 1185 | scoped_ptr<WebUIBindings> web_ui_bindings_; |
| 1186 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1187 | // The external popup for the currently showing select popup. |
| 1188 | scoped_ptr<ExternalPopupMenu> external_popup_menu_; |
| 1189 | |
| 1190 | // The node that the context menu was pressed over. |
| 1191 | WebKit::WebNode context_menu_node_; |
| 1192 | |
| 1193 | // Reports load progress to the browser. |
| 1194 | scoped_ptr<LoadProgressTracker> load_progress_tracker_; |
| 1195 | |
| 1196 | // All the registered observers. We expect this list to be small, so vector |
| 1197 | // is fine. |
| 1198 | ObserverList<RenderViewObserver> observers_; |
| 1199 | |
[email protected] | 6e24cf1 | 2011-03-18 19:57:02 | [diff] [blame] | 1200 | // --------------------------------------------------------------------------- |
| 1201 | // ADDING NEW DATA? Please see if it fits appropriately in one of the above |
| 1202 | // sections rather than throwing it randomly at the end. If you're adding a |
| 1203 | // bunch of stuff, you should probably create a helper class and put your |
| 1204 | // data and methods on that to avoid bloating RenderView more. You can use |
| 1205 | // the Observer interface to filter IPC messages and receive frame change |
| 1206 | // notifications. |
| 1207 | // --------------------------------------------------------------------------- |
| 1208 | |
| 1209 | DISALLOW_COPY_AND_ASSIGN(RenderView); |
| 1210 | }; |
| 1211 | |
| 1212 | #endif // CONTENT_RENDERER_RENDER_VIEW_H_ |