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