blob: fc77452a7ee3333b7bb8360bb05d07778dae55e9 [file] [log] [blame]
[email protected]81375e872012-01-11 21:40:361// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]6e24cf12011-03-18 19:57:022// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]310ebd6302011-10-10 19:06:285#ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
6#define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
[email protected]6e24cf12011-03-18 19:57:027#pragma once
8
9#include <deque>
10#include <map>
[email protected]6e24cf12011-03-18 19:57:0211#include <set>
12#include <string>
13#include <vector>
14
[email protected]6e24cf12011-03-18 19:57:0215#include "base/basictypes.h"
16#include "base/gtest_prod_util.h"
17#include "base/id_map.h"
[email protected]3b63f8f42011-03-28 01:54:1518#include "base/memory/linked_ptr.h"
19#include "base/memory/weak_ptr.h"
[email protected]6e24cf12011-03-18 19:57:0220#include "base/observer_list.h"
21#include "base/timer.h"
[email protected]6e24cf12011-03-18 19:57:0222#include "build/build_config.h"
[email protected]8d128d62011-09-13 22:11:5723#include "content/common/content_export.h"
[email protected]55722152011-03-22 01:33:5324#include "content/common/edit_command.h"
[email protected]c26ad882012-02-07 06:41:2025#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
[email protected]6e24cf12011-03-18 19:57:0226#include "content/common/navigation_gesture.h"
[email protected]3e3c4522012-04-13 21:16:2927#include "content/common/view_message_enums.h"
[email protected]54087fe2011-10-28 22:02:4828#include "content/public/common/page_zoom.h"
[email protected]445e1042011-12-03 21:03:1529#include "content/public/common/referrer.h"
[email protected]daf82f82011-10-31 22:35:3130#include "content/public/common/renderer_preferences.h"
[email protected]815dd9872011-11-23 18:40:3031#include "content/public/common/stop_find_action.h"
[email protected]a2ef54c2011-10-10 16:20:3132#include "content/public/renderer/render_view.h"
[email protected]1e7e3572012-02-22 00:25:0833#include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
[email protected]1e7e3572012-02-22 00:25:0834#include "content/renderer/render_view_selection.h"
[email protected]6e24cf12011-03-18 19:57:0235#include "content/renderer/render_widget.h"
[email protected]d353541f2012-05-03 22:45:4136#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]6e24cf12011-03-18 19:57:0237#include "ipc/ipc_platform_file.h"
[email protected]1e7e3572012-02-22 00:25:0838#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
[email protected]6e24cf12011-03-18 19:57:0239#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h"
[email protected]6459800a2012-03-27 23:57:0540#include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h"
[email protected]42054a252011-05-17 18:02:1341#include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h"
[email protected]d353541f2012-05-03 22:45:4142#include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationType.h"
[email protected]6e24cf12011-03-18 19:57:0243#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
[email protected]18d5be92011-07-25 18:00:1944#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClient.h"
[email protected]94dec932011-05-26 20:04:2145#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageVisibilityState.h"
[email protected]f546640b2012-05-15 00:03:4946#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
[email protected]6e24cf12011-03-18 19:57:0247#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h"
48#include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h"
[email protected]d353541f2012-05-03 22:45:4149#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h"
[email protected]7e8b4d12012-01-20 23:39:5150#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h"
[email protected]269f86d2011-12-07 02:43:4751#include "ui/base/javascript_message_type.h"
[email protected]d353541f2012-05-03 22:45:4152#include "ui/surface/transport_dib.h"
[email protected]6e24cf12011-03-18 19:57:0253#include "webkit/glue/webpreferences.h"
[email protected]a9288f52011-11-17 05:18:1654#include "webkit/media/webmediaplayer_delegate.h"
[email protected]6e24cf12011-03-18 19:57:0255#include "webkit/plugins/npapi/webplugin_page_delegate.h"
56
[email protected]9f76c1e2012-03-05 15:15:5857#if defined(COMPILER_MSVC)
[email protected]310ebd6302011-10-10 19:06:2858// RenderViewImpl is a diamond-shaped hierarchy, with WebWidgetClient at the
59// root. VS warns when we inherit the WebWidgetClient method implementations
60// from RenderWidget. It's safe to ignore that warning.
[email protected]6e24cf12011-03-18 19:57:0261#pragma warning(disable: 4250)
62#endif
63
[email protected]5b52cd2f712012-03-28 02:12:4864class CommandLine;
[email protected]6e24cf12011-03-18 19:57:0265class DeviceOrientationDispatcher;
[email protected]c5c1d6d2011-07-28 18:42:4166class DevToolsAgent;
[email protected]766a7082012-02-03 23:39:1567class DomAutomationController;
[email protected]55722152011-03-22 01:33:5368class ExternalPopupMenu;
[email protected]6e24cf12011-03-18 19:57:0269class GeolocationDispatcher;
[email protected]6e24cf12011-03-18 19:57:0270class GURL;
[email protected]7f3c7af2011-10-20 22:52:5171class JavaBridgeDispatcher;
[email protected]6e24cf12011-03-18 19:57:0272class LoadProgressTracker;
[email protected]273558fb2012-01-12 15:03:5173class MediaStreamDispatcher;
[email protected]ab2c4732011-07-20 19:57:4074class MediaStreamImpl;
[email protected]217690d2012-01-27 07:33:1175class MouseLockDispatcher;
[email protected]6e24cf12011-03-18 19:57:0276class NotificationProvider;
[email protected]6e24cf12011-03-18 19:57:0277class PepperDeviceTest;
[email protected]83f93d32011-11-11 00:43:3078struct PP_NetAddress_Private;
[email protected]ea192e82011-04-11 19:16:0279class RenderWidgetFullscreenPepper;
[email protected]063afcb2011-09-29 07:54:3280class RendererAccessibility;
[email protected]da8543762012-03-20 08:52:2081class RendererWebColorChooserImpl;
[email protected]6e24cf12011-03-18 19:57:0282class SkBitmap;
[email protected]c52b2892012-03-07 11:01:0283class InputTagSpeechDispatcher;
[email protected]6e24cf12011-03-18 19:57:0284struct ViewMsg_Navigate_Params;
[email protected]f546640b2012-05-15 00:03:4985struct ViewMsg_PostMessage_Params;
[email protected]6e24cf12011-03-18 19:57:0286struct ViewMsg_StopFinding_Params;
[email protected]83f93d32011-11-11 00:43:3087struct ViewMsg_SwapOut_Params;
[email protected]6e24cf12011-03-18 19:57:0288struct WebDropData;
[email protected]0d9989d2011-12-21 20:26:0089class WebIntentsHost;
[email protected]83f93d32011-11-11 00:43:3090class WebPluginDelegateProxy;
91class WebUIBindings;
[email protected]b3f8f9722011-08-25 20:56:0792
93namespace content {
[email protected]007733c2011-11-17 00:34:0794class DocumentState;
[email protected]45d83a12012-04-06 22:57:5795class NavigationState;
[email protected]b3f8f9722011-08-25 20:56:0796class P2PSocketDispatcher;
[email protected]3a034ebb2011-10-03 19:19:4497class RenderViewObserver;
[email protected]007733c2011-11-17 00:34:0798class RenderViewTest;
[email protected]35be7ec2012-02-12 20:42:5199struct CustomContextMenuContext;
[email protected]8caadeb2011-11-22 02:45:23100struct FileChooserParams;
[email protected]fb11b6a42012-03-14 07:25:12101struct SelectedFileInfo;
[email protected]b3f8f9722011-08-25 20:56:07102} // namespace content
[email protected]6e24cf12011-03-18 19:57:02103
[email protected]6e24cf12011-03-18 19:57:02104namespace gfx {
105class Point;
106class Rect;
[email protected]b3f8f9722011-08-25 20:56:07107} // namespace gfx
[email protected]6e24cf12011-03-18 19:57:02108
109namespace webkit {
110
[email protected]6e24cf12011-03-18 19:57:02111namespace ppapi {
[email protected]6e24cf12011-03-18 19:57:02112class PluginInstance;
[email protected]6e24cf12011-03-18 19:57:02113} // namespace ppapi
114
115} // namespace webkit
116
117namespace webkit_glue {
[email protected]6e24cf12011-03-18 19:57:02118class ImageResourceFetcher;
[email protected]6e24cf12011-03-18 19:57:02119class ResourceFetcher;
120}
121
122namespace WebKit {
[email protected]6e24cf12011-03-18 19:57:02123class WebApplicationCacheHost;
124class WebApplicationCacheHostClient;
[email protected]f546640b2012-05-15 00:03:49125class WebDOMMessageEvent;
[email protected]6e24cf12011-03-18 19:57:02126class WebDataSource;
[email protected]6e24cf12011-03-18 19:57:02127class WebDragData;
[email protected]6e24cf12011-03-18 19:57:02128class WebGeolocationClient;
[email protected]42054a252011-05-17 18:02:13129class WebIconURL;
[email protected]6e24cf12011-03-18 19:57:02130class WebImage;
[email protected]50da23d02012-04-13 17:47:48131class WebPeerConnection00Handler;
132class WebPeerConnection00HandlerClient;
[email protected]6e24cf12011-03-18 19:57:02133class WebMediaPlayer;
134class WebMediaPlayerClient;
135class WebMouseEvent;
[email protected]273558fb2012-01-12 15:03:51136class WebPeerConnectionHandler;
137class WebPeerConnectionHandlerClient;
[email protected]5fa3a062012-03-21 15:39:34138class WebSocketStreamHandle;
[email protected]6e24cf12011-03-18 19:57:02139class WebSpeechInputController;
140class WebSpeechInputListener;
141class WebStorageNamespace;
[email protected]2d0f2e92011-10-03 09:02:24142class WebTouchEvent;
[email protected]b00ba702011-08-17 01:41:03143class WebURLLoader;
[email protected]6e24cf12011-03-18 19:57:02144class WebURLRequest;
[email protected]273558fb2012-01-12 15:03:51145class WebUserMediaClient;
[email protected]7a1ec28a2012-03-28 21:10:24146struct WebActiveWheelFlingParameters;
[email protected]6e24cf12011-03-18 19:57:02147struct WebFileChooserParams;
148struct WebFindOptions;
149struct WebMediaPlayerAction;
[email protected]81375e872012-01-11 21:40:36150struct WebPluginAction;
[email protected]6e24cf12011-03-18 19:57:02151struct WebPoint;
152struct WebWindowFeatures;
153}
154
155// We need to prevent a page from trying to create infinite popups. It is not
156// as simple as keeping a count of the number of immediate children
157// popups. Having an html file that window.open()s itself would create
158// an unlimited chain of RenderViews who only have one RenderView child.
159//
160// Therefore, each new top level RenderView creates a new counter and shares it
[email protected]310ebd6302011-10-10 19:06:28161// with all its children and grandchildren popup RenderViewImpls created with
[email protected]6e24cf12011-03-18 19:57:02162// createView() to have a sort of global limit for the page so no more than
163// kMaximumNumberOfPopups popups are created.
164//
165// This is a RefCounted holder of an int because I can't say
166// scoped_refptr<int>.
167typedef base::RefCountedData<int> SharedRenderViewCounter;
168
169//
170// RenderView is an object that manages a WebView object, and provides a
171// communication interface with an embedding application process
172//
[email protected]310ebd6302011-10-10 19:06:28173class RenderViewImpl : public RenderWidget,
174 public WebKit::WebViewClient,
175 public WebKit::WebFrameClient,
176 public WebKit::WebPageSerializerClient,
177 public content::RenderView,
178 public webkit::npapi::WebPluginPageDelegate,
[email protected]a9288f52011-11-17 05:18:16179 public webkit_media::WebMediaPlayerDelegate,
[email protected]b3e83de2012-02-07 03:33:28180 public WebGraphicsContext3DSwapBuffersClient,
[email protected]310ebd6302011-10-10 19:06:28181 public base::SupportsWeakPtr<RenderViewImpl> {
[email protected]6e24cf12011-03-18 19:57:02182 public:
183 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the
[email protected]5f9de5882011-09-30 23:36:28184 // parent of the WebView HWND that will be created. If this is a blocked
[email protected]6e24cf12011-03-18 19:57:02185 // popup or as a new tab, opener_id is the routing ID of the RenderView
186 // responsible for creating this RenderView (corresponding to parent_hwnd).
187 // |counter| is either a currently initialized counter, or NULL (in which case
188 // we treat this RenderView as a top level window).
[email protected]310ebd6302011-10-10 19:06:28189 CONTENT_EXPORT static RenderViewImpl* Create(
[email protected]6e24cf12011-03-18 19:57:02190 gfx::NativeViewId parent_hwnd,
191 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31192 const content::RendererPreferences& renderer_prefs,
[email protected]6717bf272012-05-11 23:31:25193 const webkit_glue::WebPreferences& webkit_prefs,
[email protected]6e24cf12011-03-18 19:57:02194 SharedRenderViewCounter* counter,
195 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56196 int32 surface_id,
[email protected]6e24cf12011-03-18 19:57:02197 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46198 const string16& frame_name,
[email protected]14392a52012-05-02 20:28:44199 bool is_renderer_created,
200 bool swapped_out,
[email protected]6fd35b72012-03-01 19:46:41201 int32 next_page_id,
[email protected]8cca3da2012-03-20 08:26:34202 const WebKit::WebScreenInfo& screen_info,
[email protected]3e3c4522012-04-13 21:16:29203 bool guest,
204 AccessibilityMode accessibility_mode);
[email protected]6e24cf12011-03-18 19:57:02205
[email protected]310ebd6302011-10-10 19:06:28206 // Returns the RenderViewImpl containing the given WebView.
207 CONTENT_EXPORT static RenderViewImpl* FromWebView(WebKit::WebView* webview);
[email protected]6e24cf12011-03-18 19:57:02208
[email protected]6e24cf12011-03-18 19:57:02209 // May return NULL when the view is closing.
[email protected]8d128d62011-09-13 22:11:57210 CONTENT_EXPORT WebKit::WebView* webview() const;
[email protected]6e24cf12011-03-18 19:57:02211
[email protected]b3e83de2012-02-07 03:33:28212 // WebGraphicsContext3DSwapBuffersClient implementation.
213
[email protected]65225772011-05-12 21:10:24214 // Called by a GraphicsContext associated with this view when swapbuffers
[email protected]37a6f302011-07-11 23:43:08215 // is posted, completes or is aborted.
[email protected]b3e83de2012-02-07 03:33:28216 virtual void OnViewContextSwapBuffersPosted() OVERRIDE;
217 virtual void OnViewContextSwapBuffersComplete() OVERRIDE;
218 virtual void OnViewContextSwapBuffersAborted() OVERRIDE;
[email protected]65225772011-05-12 21:10:24219
[email protected]d466b8a2011-07-15 21:48:03220 int history_list_offset() const { return history_list_offset_; }
[email protected]6e24cf12011-03-18 19:57:02221
[email protected]6717bf272012-05-11 23:31:25222 const webkit_glue::WebPreferences& webkit_preferences() const {
[email protected]6e24cf12011-03-18 19:57:02223 return webkit_preferences_;
224 }
225
226 void set_send_content_state_immediately(bool value) {
227 send_content_state_immediately_ = value;
228 }
229
[email protected]273558fb2012-01-12 15:03:51230 MediaStreamDispatcher* media_stream_dispatcher() {
231 return media_stream_dispatcher_;
232 }
233
[email protected]6e24cf12011-03-18 19:57:02234 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled.
[email protected]b3f8f9722011-08-25 20:56:07235 content::P2PSocketDispatcher* p2p_socket_dispatcher() {
[email protected]6e24cf12011-03-18 19:57:02236 return p2p_socket_dispatcher_;
237 }
238
[email protected]217690d2012-01-27 07:33:11239 MouseLockDispatcher* mouse_lock_dispatcher() {
240 return mouse_lock_dispatcher_;
241 }
242
[email protected]273558fb2012-01-12 15:03:51243 WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler(
244 WebKit::WebPeerConnectionHandlerClient* client);
[email protected]50da23d02012-04-13 17:47:48245 WebKit::WebPeerConnection00Handler* CreatePeerConnectionHandlerJsep(
246 WebKit::WebPeerConnection00HandlerClient* client);
[email protected]273558fb2012-01-12 15:03:51247
[email protected]6e24cf12011-03-18 19:57:02248 // Functions to add and remove observers for this object.
[email protected]3a034ebb2011-10-03 19:19:44249 void AddObserver(content::RenderViewObserver* observer);
250 void RemoveObserver(content::RenderViewObserver* observer);
[email protected]6e24cf12011-03-18 19:57:02251
[email protected]6e24cf12011-03-18 19:57:02252 // Adds the given file chooser request to the file_chooser_completion_ queue
253 // (see that var for more) and requests the chooser be displayed if there are
254 // no other waiting items in the queue.
255 //
256 // Returns true if the chooser was successfully scheduled. False means we
257 // didn't schedule anything.
[email protected]8caadeb2011-11-22 02:45:23258 bool ScheduleFileChooser(const content::FileChooserParams& params,
[email protected]6e24cf12011-03-18 19:57:02259 WebKit::WebFileChooserCompletion* completion);
260
[email protected]6e24cf12011-03-18 19:57:02261 // Sets whether the renderer should report load progress to the browser.
262 void SetReportLoadProgressEnabled(bool enabled);
263
[email protected]2ac2be8b2012-03-21 23:11:28264 bool guest() const { return guest_; }
265
[email protected]a2ef54c2011-10-10 16:20:31266 void LoadNavigationErrorPage(
[email protected]8d128d62011-09-13 22:11:57267 WebKit::WebFrame* frame,
268 const WebKit::WebURLRequest& failed_request,
269 const WebKit::WebURLError& error,
270 const std::string& html,
271 bool replace);
[email protected]9966325b2011-04-18 05:00:10272
[email protected]6e24cf12011-03-18 19:57:02273 // Plugin-related functions --------------------------------------------------
274 // (See also WebPluginPageDelegate implementation.)
275
276 // Notification that the given plugin has crashed.
277 void PluginCrashed(const FilePath& plugin_path);
278
[email protected]6e24cf12011-03-18 19:57:02279 // Creates a fullscreen container for a pepper plugin instance.
[email protected]ea192e82011-04-11 19:16:02280 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
[email protected]6e24cf12011-03-18 19:57:02281 webkit::ppapi::PluginInstance* plugin);
282
[email protected]56ea1a62011-05-30 07:05:57283 // Informs the render view that a PPAPI plugin has gained or lost focus.
284 void PpapiPluginFocusChanged();
285
[email protected]73bf95812011-10-12 11:38:32286 // Informs the render view that a PPAPI plugin has changed text input status.
287 void PpapiPluginTextInputTypeChanged();
[email protected]3f783362011-10-21 22:40:50288 void PpapiPluginCaretPositionChanged();
[email protected]73bf95812011-10-12 11:38:32289
290 // Cancels current composition.
291 void PpapiPluginCancelComposition();
292
[email protected]3c8c74c2012-03-15 07:34:52293 // Informs the render view that a PPAPI plugin has changed selection.
294 void PpapiPluginSelectionChanged();
295
[email protected]b25b3ee2012-01-13 05:19:54296 // Retrieves the current caret position if a PPAPI plugin has focus.
297 bool GetPpapiPluginCaretBounds(gfx::Rect* rect);
298
[email protected]e6ae0f6c2011-10-04 10:39:23299#if defined(OS_MACOSX) || defined(OS_WIN)
[email protected]6e24cf12011-03-18 19:57:02300 // Informs the render view that the given plugin has gained or lost focus.
301 void PluginFocusChanged(bool focused, int plugin_id);
[email protected]e6ae0f6c2011-10-04 10:39:23302#endif
[email protected]6e24cf12011-03-18 19:57:02303
[email protected]e6ae0f6c2011-10-04 10:39:23304#if defined(OS_MACOSX)
[email protected]6e24cf12011-03-18 19:57:02305 // Starts plugin IME.
306 void StartPluginIme();
307
308 // Helper routines for accelerated plugin support. Used by the
309 // WebPluginDelegateProxy, which has a pointer to the RenderView.
310 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque,
311 bool root);
312 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle window);
313 void AcceleratedSurfaceSetIOSurface(gfx::PluginWindowHandle window,
314 int32 width,
315 int32 height,
316 uint64 io_surface_identifier);
317 TransportDIB::Handle AcceleratedSurfaceAllocTransportDIB(size_t size);
318 void AcceleratedSurfaceFreeTransportDIB(TransportDIB::Id dib_id);
319 void AcceleratedSurfaceSetTransportDIB(gfx::PluginWindowHandle window,
320 int32 width,
321 int32 height,
322 TransportDIB::Handle transport_dib);
323 void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
324 uint64 surface_id);
325#endif
326
327 void RegisterPluginDelegate(WebPluginDelegateProxy* delegate);
328 void UnregisterPluginDelegate(WebPluginDelegateProxy* delegate);
329
[email protected]4a7d6392011-09-19 20:55:08330 // Helper function to retrieve information about a plugin for a URL and mime
331 // type. Returns false if no plugin was found.
332 // |actual_mime_type| is the actual mime type supported by the
333 // plugin found that match the URL given (one for each item in
334 // |info|).
[email protected]84c13c032011-09-23 00:12:22335 CONTENT_EXPORT bool GetPluginInfo(const GURL& url,
336 const GURL& page_url,
337 const std::string& mime_type,
338 webkit::WebPluginInfo* plugin_info,
339 std::string* actual_mime_type);
[email protected]4a7d6392011-09-19 20:55:08340
[email protected]7a1ec28a2012-03-28 21:10:24341 void TransferActiveWheelFlingAnimation(
342 const WebKit::WebActiveWheelFlingParameters& params);
343
[email protected]6e24cf12011-03-18 19:57:02344 // IPC::Channel::Listener implementation -------------------------------------
345
[email protected]edc64de2011-11-17 20:07:38346 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02347
348 // WebKit::WebWidgetClient implementation ------------------------------------
349
350 // Most methods are handled by RenderWidget.
351 virtual void didFocus();
352 virtual void didBlur();
353 virtual void show(WebKit::WebNavigationPolicy policy);
354 virtual void runModal();
[email protected]2b624c562011-10-27 22:58:26355 virtual bool enterFullScreen();
356 virtual void exitFullScreen();
[email protected]217690d2012-01-27 07:33:11357 virtual bool requestPointerLock();
358 virtual void requestPointerUnlock();
359 virtual bool isPointerLocked();
[email protected]7a1ec28a2012-03-28 21:10:24360 virtual void didActivateCompositor(int input_handler_identifier);
[email protected]6e24cf12011-03-18 19:57:02361
362 // WebKit::WebViewClient implementation --------------------------------------
363
364 virtual WebKit::WebView* createView(
365 WebKit::WebFrame* creator,
366 const WebKit::WebURLRequest& request,
367 const WebKit::WebWindowFeatures& features,
[email protected]916dfb62012-03-05 03:39:37368 const WebKit::WebString& frame_name,
369 WebKit::WebNavigationPolicy policy);
[email protected]6e24cf12011-03-18 19:57:02370 virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
[email protected]6e24cf12011-03-18 19:57:02371 virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
372 const WebKit::WebPopupMenuInfo& popup_menu_info,
373 WebKit::WebExternalPopupMenuClient* popup_menu_client);
374 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
375 unsigned quota);
[email protected]7e8b4d12012-01-20 23:39:51376 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(
[email protected]40ec0c12012-03-08 12:34:40377 const WebKit::WebGraphicsContext3D::Attributes& attributes);
[email protected]6e24cf12011-03-18 19:57:02378 virtual void didAddMessageToConsole(
379 const WebKit::WebConsoleMessage& message,
380 const WebKit::WebString& source_name,
381 unsigned source_line);
382 virtual void printPage(WebKit::WebFrame* frame);
383 virtual WebKit::WebNotificationPresenter* notificationPresenter();
[email protected]8a58c1c2011-04-19 18:40:12384 virtual bool enumerateChosenDirectory(
385 const WebKit::WebString& path,
386 WebKit::WebFileChooserCompletion* chooser_completion);
[email protected]6e24cf12011-03-18 19:57:02387 virtual void didStartLoading();
388 virtual void didStopLoading();
389 virtual void didChangeLoadProgress(WebKit::WebFrame* frame,
390 double load_progress);
391 virtual bool isSmartInsertDeleteEnabled();
392 virtual bool isSelectTrailingWhitespaceEnabled();
393 virtual void didChangeSelection(bool is_selection_empty);
394 virtual void didExecuteCommand(const WebKit::WebString& command_name);
395 virtual bool handleCurrentKeyboardEvent();
[email protected]da8543762012-03-20 08:52:20396 virtual WebKit::WebColorChooser* createColorChooser(
397 WebKit::WebColorChooserClient*, const WebKit::WebColor& initial_color);
[email protected]6e24cf12011-03-18 19:57:02398 virtual bool runFileChooser(
399 const WebKit::WebFileChooserParams& params,
400 WebKit::WebFileChooserCompletion* chooser_completion);
401 virtual void runModalAlertDialog(WebKit::WebFrame* frame,
402 const WebKit::WebString& message);
403 virtual bool runModalConfirmDialog(WebKit::WebFrame* frame,
404 const WebKit::WebString& message);
405 virtual bool runModalPromptDialog(WebKit::WebFrame* frame,
406 const WebKit::WebString& message,
407 const WebKit::WebString& default_value,
408 WebKit::WebString* actual_value);
409 virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame* frame,
410 const WebKit::WebString& message);
411 virtual void showContextMenu(WebKit::WebFrame* frame,
412 const WebKit::WebContextMenuData& data);
[email protected]6e24cf12011-03-18 19:57:02413 virtual void setStatusText(const WebKit::WebString& text);
414 virtual void setMouseOverURL(const WebKit::WebURL& url);
415 virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
[email protected]0407e422012-05-18 19:51:25416 virtual void startDragging(WebKit::WebFrame* frame,
417 const WebKit::WebDragData& data,
[email protected]6e24cf12011-03-18 19:57:02418 WebKit::WebDragOperationsMask mask,
419 const WebKit::WebImage& image,
420 const WebKit::WebPoint& imageOffset);
421 virtual bool acceptsLoadDrops();
422 virtual void focusNext();
423 virtual void focusPrevious();
424 virtual void focusedNodeChanged(const WebKit::WebNode& node);
[email protected]169d4282011-11-30 19:33:59425 virtual void didUpdateLayout();
[email protected]6e24cf12011-03-18 19:57:02426 virtual void navigateBackForwardSoon(int offset);
427 virtual int historyBackListCount();
428 virtual int historyForwardListCount();
429 virtual void postAccessibilityNotification(
430 const WebKit::WebAccessibilityObject& obj,
431 WebKit::WebAccessibilityNotification notification);
432 virtual void didUpdateInspectorSetting(const WebKit::WebString& key,
433 const WebKit::WebString& value);
434 virtual WebKit::WebGeolocationClient* geolocationClient();
435 virtual WebKit::WebSpeechInputController* speechInputController(
436 WebKit::WebSpeechInputListener* listener);
437 virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient();
438 virtual void zoomLimitsChanged(double minimum_level, double maximum_level);
439 virtual void zoomLevelChanged();
440 virtual void registerProtocolHandler(const WebKit::WebString& scheme,
441 const WebKit::WebString& base_url,
442 const WebKit::WebString& url,
443 const WebKit::WebString& title);
[email protected]94dec932011-05-26 20:04:21444 virtual WebKit::WebPageVisibilityState visibilityState() const;
[email protected]273558fb2012-01-12 15:03:51445 virtual WebKit::WebUserMediaClient* userMediaClient();
[email protected]6e24cf12011-03-18 19:57:02446
447 // WebKit::WebFrameClient implementation -------------------------------------
448
449 virtual WebKit::WebPlugin* createPlugin(
450 WebKit::WebFrame* frame,
451 const WebKit::WebPluginParams& params);
[email protected]6ac77cb2012-05-01 14:49:01452 virtual WebKit::WebPlugin* createPluginReplacement(
453 WebKit::WebFrame* frame,
454 const WebKit::WebPluginParams& params);
[email protected]6e24cf12011-03-18 19:57:02455 virtual WebKit::WebSharedWorker* createSharedWorker(
456 WebKit::WebFrame* frame, const WebKit::WebURL& url,
457 const WebKit::WebString& name, unsigned long long documentId);
458 virtual WebKit::WebMediaPlayer* createMediaPlayer(
459 WebKit::WebFrame* frame,
460 WebKit::WebMediaPlayerClient* client);
461 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
462 WebKit::WebFrame* frame,
463 WebKit::WebApplicationCacheHostClient* client);
464 virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame);
465 virtual void frameDetached(WebKit::WebFrame* frame);
466 virtual void willClose(WebKit::WebFrame* frame);
[email protected]6e24cf12011-03-18 19:57:02467 virtual void loadURLExternally(WebKit::WebFrame* frame,
468 const WebKit::WebURLRequest& request,
469 WebKit::WebNavigationPolicy policy);
[email protected]0622875ab2011-07-27 12:10:34470 virtual void loadURLExternally(WebKit::WebFrame* frame,
471 const WebKit::WebURLRequest& request,
472 WebKit::WebNavigationPolicy policy,
473 const WebKit::WebString& suggested_name);
[email protected]6e24cf12011-03-18 19:57:02474 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
475 WebKit::WebFrame* frame,
476 const WebKit::WebURLRequest& request,
477 WebKit::WebNavigationType type,
478 const WebKit::WebNode&,
479 WebKit::WebNavigationPolicy default_policy,
480 bool is_redirect);
481 virtual bool canHandleRequest(WebKit::WebFrame* frame,
482 const WebKit::WebURLRequest& request);
483 virtual WebKit::WebURLError cannotHandleRequestError(
484 WebKit::WebFrame* frame,
485 const WebKit::WebURLRequest& request);
486 virtual WebKit::WebURLError cancelledError(
487 WebKit::WebFrame* frame,
488 const WebKit::WebURLRequest& request);
489 virtual void unableToImplementPolicyWithError(
490 WebKit::WebFrame* frame,
491 const WebKit::WebURLError& error);
492 virtual void willSendSubmitEvent(WebKit::WebFrame* frame,
493 const WebKit::WebFormElement& form);
494 virtual void willSubmitForm(WebKit::WebFrame* frame,
495 const WebKit::WebFormElement& form);
496 virtual void willPerformClientRedirect(WebKit::WebFrame* frame,
497 const WebKit::WebURL& from,
498 const WebKit::WebURL& to,
499 double interval,
500 double fire_time);
501 virtual void didCancelClientRedirect(WebKit::WebFrame* frame);
502 virtual void didCompleteClientRedirect(WebKit::WebFrame* frame,
503 const WebKit::WebURL& from);
504 virtual void didCreateDataSource(WebKit::WebFrame* frame,
505 WebKit::WebDataSource* datasource);
506 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame);
507 virtual void didReceiveServerRedirectForProvisionalLoad(
508 WebKit::WebFrame* frame);
509 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame,
510 const WebKit::WebURLError& error);
511 virtual void didReceiveDocumentData(WebKit::WebFrame* frame,
512 const char* data, size_t length,
513 bool& prevent_default);
514 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame,
515 bool is_new_navigation);
516 virtual void didClearWindowObject(WebKit::WebFrame* frame);
517 virtual void didCreateDocumentElement(WebKit::WebFrame* frame);
518 virtual void didReceiveTitle(WebKit::WebFrame* frame,
[email protected]a3bc4d12011-04-20 17:22:21519 const WebKit::WebString& title,
520 WebKit::WebTextDirection direction);
[email protected]42054a252011-05-17 18:02:13521 virtual void didChangeIcon(WebKit::WebFrame*,
522 WebKit::WebIconURL::Type) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02523 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame);
524 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame);
525 virtual void didFailLoad(WebKit::WebFrame* frame,
526 const WebKit::WebURLError& error);
527 virtual void didFinishLoad(WebKit::WebFrame* frame);
528 virtual void didNavigateWithinPage(WebKit::WebFrame* frame,
529 bool is_new_navigation);
530 virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame);
531 virtual void assignIdentifierToRequest(WebKit::WebFrame* frame,
532 unsigned identifier,
533 const WebKit::WebURLRequest& request);
534 virtual void willSendRequest(WebKit::WebFrame* frame,
535 unsigned identifier,
536 WebKit::WebURLRequest& request,
537 const WebKit::WebURLResponse& redirect_response);
538 virtual void didReceiveResponse(WebKit::WebFrame* frame,
539 unsigned identifier,
540 const WebKit::WebURLResponse& response);
541 virtual void didFinishResourceLoad(WebKit::WebFrame* frame,
542 unsigned identifier);
543 virtual void didFailResourceLoad(WebKit::WebFrame* frame,
544 unsigned identifier,
545 const WebKit::WebURLError& error);
546 virtual void didLoadResourceFromMemoryCache(
547 WebKit::WebFrame* frame,
548 const WebKit::WebURLRequest& request,
549 const WebKit::WebURLResponse&);
550 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame);
551 virtual void didRunInsecureContent(
552 WebKit::WebFrame* frame,
553 const WebKit::WebSecurityOrigin& origin,
554 const WebKit::WebURL& target);
[email protected]b00ba702011-08-17 01:41:03555 virtual void didAdoptURLLoader(WebKit::WebURLLoader* loader);
[email protected]6e24cf12011-03-18 19:57:02556 virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame* frame);
[email protected]5bc10932011-09-21 21:03:30557 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
558 v8::Handle<v8::Context>,
[email protected]a00fe692012-02-27 05:52:58559 int extension_group,
560 int world_id);
561 // TODO(koz): Remove once WebKit no longer calls this.
562 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
563 v8::Handle<v8::Context>,
[email protected]5bc10932011-09-21 21:03:30564 int world_id);
565 virtual void willReleaseScriptContext(WebKit::WebFrame* frame,
566 v8::Handle<v8::Context>,
567 int world_id);
[email protected]6e24cf12011-03-18 19:57:02568 virtual void didChangeScrollOffset(WebKit::WebFrame* frame);
[email protected]dd6afca2011-08-13 03:44:31569 virtual void numberOfWheelEventHandlersChanged(unsigned num_handlers);
[email protected]ea931252012-02-15 22:01:03570 virtual void numberOfTouchEventHandlersChanged(unsigned num_handlers);
[email protected]dd6afca2011-08-13 03:44:31571 virtual void didChangeContentsSize(WebKit::WebFrame* frame,
572 const WebKit::WebSize& size);
[email protected]6e24cf12011-03-18 19:57:02573 virtual void reportFindInPageMatchCount(int request_id,
574 int count,
575 bool final_update);
576 virtual void reportFindInPageSelection(int request_id,
577 int active_match_ordinal,
578 const WebKit::WebRect& sel);
[email protected]6e24cf12011-03-18 19:57:02579 virtual void openFileSystem(WebKit::WebFrame* frame,
580 WebKit::WebFileSystem::Type type,
581 long long size,
582 bool create,
583 WebKit::WebFileSystemCallbacks* callbacks);
[email protected]10e5cf12011-04-13 04:10:40584 virtual void queryStorageUsageAndQuota(
585 WebKit::WebFrame* frame,
586 WebKit::WebStorageQuotaType type,
587 WebKit::WebStorageQuotaCallbacks* callbacks);
[email protected]10e5cf12011-04-13 04:10:40588 virtual void requestStorageQuota(
589 WebKit::WebFrame* frame,
590 WebKit::WebStorageQuotaType type,
591 unsigned long long requested_size,
592 WebKit::WebStorageQuotaCallbacks* callbacks);
[email protected]8b5af492011-11-28 21:50:58593 virtual void registerIntentService(
594 WebKit::WebFrame* frame,
595 const WebKit::WebIntentServiceInfo& service);
596 virtual void dispatchIntent(WebKit::WebFrame* frame,
[email protected]ffc8bed2012-01-21 01:23:15597 const WebKit::WebIntentRequest& intentRequest);
[email protected]5fa3a062012-03-21 15:39:34598 virtual void willOpenSocketStream(
599 WebKit::WebSocketStreamHandle* handle);
[email protected]f546640b2012-05-15 00:03:49600 virtual bool willCheckAndDispatchMessageEvent(
601 WebKit::WebFrame* source,
602 WebKit::WebSecurityOrigin targetOrigin,
603 WebKit::WebDOMMessageEvent event) OVERRIDE;
[email protected]8b5af492011-11-28 21:50:58604
[email protected]18d5be92011-07-25 18:00:19605 // WebKit::WebPageSerializerClient implementation ----------------------------
606
607 virtual void didSerializeDataForFrame(
608 const WebKit::WebURL& frame_url,
609 const WebKit::WebCString& data,
610 PageSerializationStatus status) OVERRIDE;
611
[email protected]a2ef54c2011-10-10 16:20:31612 // content::RenderView implementation ----------------------------------------
613
614 virtual bool Send(IPC::Message* message) OVERRIDE;
[email protected]9f76c1e2012-03-05 15:15:58615 virtual int GetRoutingID() const OVERRIDE;
[email protected]82114f52012-03-20 22:53:41616 virtual int GetPageId() const OVERRIDE;
617 virtual gfx::Size GetSize() const OVERRIDE;
618 virtual gfx::NativeViewId GetHostWindow() const OVERRIDE;
[email protected]6717bf272012-05-11 23:31:25619 virtual webkit_glue::WebPreferences& GetWebkitPreferences() OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31620 virtual WebKit::WebView* GetWebView() OVERRIDE;
621 virtual WebKit::WebNode GetFocusedNode() const OVERRIDE;
622 virtual WebKit::WebNode GetContextMenuNode() const OVERRIDE;
[email protected]82114f52012-03-20 22:53:41623 virtual bool IsEditableNode(const WebKit::WebNode& node) const OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31624 virtual WebKit::WebPlugin* CreatePlugin(
625 WebKit::WebFrame* frame,
626 const webkit::WebPluginInfo& info,
627 const WebKit::WebPluginParams& params) OVERRIDE;
628 virtual void EvaluateScript(const string16& frame_xpath,
629 const string16& jscript,
630 int id,
631 bool notify_result) OVERRIDE;
632 virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE;
[email protected]82114f52012-03-20 22:53:41633 virtual int GetEnabledBindings() const OVERRIDE;
634 virtual bool GetContentStateImmediately() const OVERRIDE;
635 virtual float GetFilteredTimePerFrame() const OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31636 virtual void ShowContextMenu(WebKit::WebFrame* frame,
637 const WebKit::WebContextMenuData& data) OVERRIDE;
638 virtual WebKit::WebPageVisibilityState GetVisibilityState() const OVERRIDE;
639 virtual void RunModalAlertDialog(WebKit::WebFrame* frame,
640 const WebKit::WebString& message) OVERRIDE;
641 virtual void LoadURLExternally(
642 WebKit::WebFrame* frame,
643 const WebKit::WebURLRequest& request,
644 WebKit::WebNavigationPolicy policy) OVERRIDE;
645
[email protected]6e24cf12011-03-18 19:57:02646 // webkit_glue::WebPluginPageDelegate implementation -------------------------
647
648 virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
649 const FilePath& file_path,
[email protected]edc64de2011-11-17 20:07:38650 const std::string& mime_type) OVERRIDE;
[email protected]6ac77cb2012-05-01 14:49:01651 virtual WebKit::WebPlugin* CreatePluginReplacement(
652 const FilePath& file_path) OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38653 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
654 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
655 virtual void DidMovePlugin(
656 const webkit::npapi::WebPluginGeometry& move) OVERRIDE;
657 virtual void DidStartLoadingForPlugin() OVERRIDE;
658 virtual void DidStopLoadingForPlugin() OVERRIDE;
659 virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02660
[email protected]a9288f52011-11-17 05:18:16661 // webkit_media::WebMediaPlayerDelegate implementation -----------------------
[email protected]baff4512011-10-19 18:21:07662
[email protected]a9288f52011-11-17 05:18:16663 virtual void DidPlay(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
664 virtual void DidPause(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
665 virtual void PlayerGone(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
[email protected]baff4512011-10-19 18:21:07666
[email protected]6e24cf12011-03-18 19:57:02667 // Please do not add your stuff randomly to the end here. If there is an
668 // appropriate section, add it there. If not, there are some random functions
669 // nearer to the top you can add it to.
[email protected]6e24cf12011-03-18 19:57:02670
[email protected]38b592902011-04-16 02:08:42671 // Cannot use std::set unfortunately since linked_ptr<> does not support
672 // operator<.
673 typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> >
674 ImageResourceFetcherList;
675
[email protected]6e24cf12011-03-18 19:57:02676 protected:
677 // RenderWidget overrides:
[email protected]edc64de2011-11-17 20:07:38678 virtual void Close() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02679 virtual void OnResize(const gfx::Size& new_size,
[email protected]ee41e7d22011-10-14 19:34:09680 const gfx::Rect& resizer_rect,
[email protected]edc64de2011-11-17 20:07:38681 bool is_fullscreen) OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16682 virtual void WillInitiatePaint() OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38683 virtual void DidInitiatePaint() OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16684 virtual void DidFlushPaint() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02685 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
686 const gfx::Rect& paint_bounds,
687 TransportDIB** dib,
688 gfx::Rect* location,
[email protected]edc64de2011-11-17 20:07:38689 gfx::Rect* clip) OVERRIDE;
690 virtual gfx::Point GetScrollOffset() OVERRIDE;
691 virtual void DidHandleKeyEvent() OVERRIDE;
[email protected]67bfb83f2011-09-22 03:36:37692 virtual bool WillHandleMouseEvent(
693 const WebKit::WebMouseEvent& event) OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38694 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) OVERRIDE;
695 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) OVERRIDE;
696 virtual void OnSetFocus(bool enable) OVERRIDE;
697 virtual void OnWasHidden() OVERRIDE;
698 virtual void OnWasRestored(bool needs_repainting) OVERRIDE;
[email protected]65225772011-05-12 21:10:24699 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE;
[email protected]56ea1a62011-05-30 07:05:57700 virtual void OnImeSetComposition(
701 const string16& text,
702 const std::vector<WebKit::WebCompositionUnderline>& underlines,
703 int selection_start,
704 int selection_end) OVERRIDE;
[email protected]4de6d1692011-10-12 08:45:44705 virtual void OnImeConfirmComposition(
706 const string16& text, const ui::Range& replacement_range) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45707 virtual ui::TextInputType GetTextInputType() OVERRIDE;
[email protected]3f783362011-10-21 22:40:50708 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45709 virtual bool CanComposeInline() OVERRIDE;
[email protected]c3d45532011-10-07 19:20:40710 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02711
712 private:
[email protected]6e24cf12011-03-18 19:57:02713 // For unit tests.
714 friend class ExternalPopupMenuTest;
715 friend class PepperDeviceTest;
[email protected]c6d068ff2011-10-14 17:28:23716 friend class content::RenderViewTest;
[email protected]6e24cf12011-03-18 19:57:02717
718 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
719 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
720 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]744c2a22012-03-15 18:42:04721 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI);
[email protected]068970d2011-10-11 00:05:16722 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
723 DontIgnoreBackAfterNavEntryLimit);
724 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
725 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
726 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
727 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
728 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
729 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeStateChanged);
730 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
731 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
732 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
[email protected]73eb2602012-02-09 19:50:55733 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
[email protected]068970d2011-10-11 00:05:16734 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
735 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
[email protected]6e24cf12011-03-18 19:57:02736#if defined(OS_MACOSX)
737 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
738#endif
[email protected]068970d2011-10-11 00:05:16739 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune);
[email protected]6e24cf12011-03-18 19:57:02740
[email protected]6e24cf12011-03-18 19:57:02741 typedef std::map<GURL, double> HostZoomLevels;
742
[email protected]6e24cf12011-03-18 19:57:02743 enum ErrorPageType {
744 DNS_ERROR,
745 HTTP_404,
746 CONNECTION_ERROR,
747 };
748
[email protected]310ebd6302011-10-10 19:06:28749 RenderViewImpl(gfx::NativeViewId parent_hwnd,
750 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31751 const content::RendererPreferences& renderer_prefs,
[email protected]6717bf272012-05-11 23:31:25752 const webkit_glue::WebPreferences& webkit_prefs,
[email protected]310ebd6302011-10-10 19:06:28753 SharedRenderViewCounter* counter,
754 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56755 int32 surface_id,
[email protected]310ebd6302011-10-10 19:06:28756 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46757 const string16& frame_name,
[email protected]14392a52012-05-02 20:28:44758 bool is_renderer_created,
759 bool swapped_out,
[email protected]6fd35b72012-03-01 19:46:41760 int32 next_page_id,
[email protected]8cca3da2012-03-20 08:26:34761 const WebKit::WebScreenInfo& screen_info,
[email protected]3e3c4522012-04-13 21:16:29762 bool guest,
763 AccessibilityMode accessibility_mode);
[email protected]6e24cf12011-03-18 19:57:02764
765 // Do not delete directly. This class is reference counted.
[email protected]310ebd6302011-10-10 19:06:28766 virtual ~RenderViewImpl();
[email protected]6e24cf12011-03-18 19:57:02767
768 void UpdateURL(WebKit::WebFrame* frame);
[email protected]a49e10b2011-08-01 23:57:46769 void UpdateTitle(WebKit::WebFrame* frame, const string16& title,
770 WebKit::WebTextDirection title_direction);
[email protected]6e24cf12011-03-18 19:57:02771 void UpdateSessionHistory(WebKit::WebFrame* frame);
[email protected]6459800a2012-03-27 23:57:05772 void SendUpdateState(const WebKit::WebHistoryItem& item);
[email protected]6e24cf12011-03-18 19:57:02773
774 // Update current main frame's encoding and send it to browser window.
775 // Since we want to let users see the right encoding info from menu
776 // before finishing loading, we call the UpdateEncoding in
777 // a) function:DidCommitLoadForFrame. When this function is called,
778 // that means we have got first data. In here we try to get encoding
779 // of page if it has been specified in http header.
780 // b) function:DidReceiveTitle. When this function is called,
781 // that means we have got specified title. Because in most of webpages,
782 // title tags will follow meta tags. In here we try to get encoding of
783 // page if it has been specified in meta tag.
784 // c) function:DidFinishDocumentLoadForFrame. When this function is
785 // called, that means we have got whole html page. In here we should
786 // finally get right encoding of page.
787 void UpdateEncoding(WebKit::WebFrame* frame,
788 const std::string& encoding_name);
789
[email protected]ae5184d62011-10-06 19:25:58790 void OpenURL(WebKit::WebFrame* frame,
791 const GURL& url,
[email protected]445e1042011-12-03 21:03:15792 const content::Referrer& referrer,
[email protected]6e24cf12011-03-18 19:57:02793 WebKit::WebNavigationPolicy policy);
794
[email protected]269f86d2011-12-07 02:43:47795 bool RunJavaScriptMessage(ui::JavascriptMessageType type,
[email protected]4f5ce842011-05-27 19:34:41796 const string16& message,
797 const string16& default_value,
[email protected]6e24cf12011-03-18 19:57:02798 const GURL& frame_url,
[email protected]4f5ce842011-05-27 19:34:41799 string16* result);
[email protected]6e24cf12011-03-18 19:57:02800
801 // Sends a message and runs a nested message loop.
802 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
803
[email protected]dd6afca2011-08-13 03:44:31804 // Called when the "pinned to left/right edge" state needs to be updated.
805 void UpdateScrollState(WebKit::WebFrame* frame);
806
[email protected]6e24cf12011-03-18 19:57:02807 // IPC message handlers ------------------------------------------------------
808 //
809 // The documentation for these functions should be in
810 // render_messages_internal.h for the message that the function is handling.
811
[email protected]744c2a22012-03-15 18:42:04812 CONTENT_EXPORT void OnAllowBindings(int enabled_bindings_flags);
[email protected]6e24cf12011-03-18 19:57:02813 void OnAllowScriptToClose(bool script_can_close);
814 void OnAsyncFileOpened(base::PlatformFileError error_code,
815 IPC::PlatformFileForTransit file_for_transit,
816 int message_id);
[email protected]eb415bf0e2011-04-14 02:45:42817 void OnPpapiBrokerChannelCreated(int request_id,
[email protected]d54305072011-06-22 20:58:43818 const IPC::ChannelHandle& handle);
[email protected]6e24cf12011-03-18 19:57:02819 void OnCancelDownload(int32 download_id);
820 void OnClearFocusedNode();
[email protected]992db4c2011-05-12 15:37:15821 void OnClosePage();
[email protected]6e24cf12011-03-18 19:57:02822 void OnContextMenuClosed(
[email protected]35be7ec2012-02-12 20:42:51823 const content::CustomContextMenuContext& custom_context);
[email protected]6e24cf12011-03-18 19:57:02824 void OnCopy();
825 void OnCopyImageAt(int x, int y);
826#if defined(OS_MACOSX)
827 void OnCopyToFindPboard();
828#endif
829 void OnCut();
[email protected]318bf5802011-08-08 17:12:41830 void OnCSSInsertRequest(const string16& frame_xpath,
[email protected]01cf589c2011-07-28 18:04:03831 const std::string& css);
[email protected]6e24cf12011-03-18 19:57:02832 void OnCustomContextMenuAction(
[email protected]35be7ec2012-02-12 20:42:51833 const content::CustomContextMenuContext& custom_context,
[email protected]6e24cf12011-03-18 19:57:02834 unsigned action);
835 void OnDelete();
836 void OnDeterminePageLanguage();
837 void OnDisableScrollbarsForSmallWindows(
838 const gfx::Size& disable_scrollbars_size_limit);
839 void OnDisassociateFromPopupCount();
[email protected]6e24cf12011-03-18 19:57:02840 void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
841 const gfx::Point& screen_point,
842 bool ended,
843 WebKit::WebDragOperation drag_operation);
844 void OnDragSourceSystemDragEnded();
845 void OnDragTargetDrop(const gfx::Point& client_pt,
[email protected]1f2230b2012-05-17 23:43:42846 const gfx::Point& screen_pt,
847 int key_modifiers);
[email protected]6e24cf12011-03-18 19:57:02848 void OnDragTargetDragEnter(const WebDropData& drop_data,
849 const gfx::Point& client_pt,
850 const gfx::Point& screen_pt,
[email protected]1f2230b2012-05-17 23:43:42851 WebKit::WebDragOperationsMask operations_allowed,
852 int key_modifiers);
[email protected]6e24cf12011-03-18 19:57:02853 void OnDragTargetDragLeave();
854 void OnDragTargetDragOver(const gfx::Point& client_pt,
855 const gfx::Point& screen_pt,
[email protected]1f2230b2012-05-17 23:43:42856 WebKit::WebDragOperationsMask operations_allowed,
857 int key_modifiers);
[email protected]2bf834f2011-11-17 20:02:21858 void OnEnablePreferredSizeChangedMode();
[email protected]244ac1892011-12-02 17:04:47859 void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
[email protected]61e2b3cc2012-03-02 16:13:34860 void OnDisableAutoResize(const gfx::Size& new_size);
[email protected]600ea402011-04-12 00:01:51861 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths);
[email protected]6e24cf12011-03-18 19:57:02862 void OnExecuteEditCommand(const std::string& name, const std::string& value);
[email protected]fb11b6a42012-03-14 07:25:12863 void OnFileChooserResponse(
864 const std::vector<content::SelectedFileInfo>& files);
[email protected]6e24cf12011-03-18 19:57:02865 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
866 void OnFindReplyAck();
[email protected]18d5be92011-07-25 18:00:19867 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
868 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
869 const std::vector<GURL>& links,
870 const std::vector<FilePath>& local_paths,
871 const FilePath& local_directory_name);
[email protected]6e24cf12011-03-18 19:57:02872 void OnMediaPlayerActionAt(const gfx::Point& location,
873 const WebKit::WebMediaPlayerAction& action);
[email protected]77829642012-05-15 14:47:17874
875 // Screen has rotated. 0 = default (portrait), 90 = one turn right, and so on.
876 void OnOrientationChangeEvent(int orientation);
877
[email protected]81375e872012-01-11 21:40:36878 void OnPluginActionAt(const gfx::Point& location,
879 const WebKit::WebPluginAction& action);
[email protected]6e24cf12011-03-18 19:57:02880 void OnMoveOrResizeStarted();
[email protected]f3112a52011-09-30 23:47:49881 CONTENT_EXPORT void OnNavigate(const ViewMsg_Navigate_Params& params);
[email protected]6e24cf12011-03-18 19:57:02882 void OnPaste();
[email protected]44bf7002011-10-16 02:46:15883 void OnPasteAndMatchStyle();
[email protected]6e24cf12011-03-18 19:57:02884#if defined(OS_MACOSX)
885 void OnPluginImeCompositionCompleted(const string16& text, int plugin_id);
886#endif
[email protected]f546640b2012-05-15 00:03:49887 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params);
[email protected]6e24cf12011-03-18 19:57:02888 void OnRedo();
889 void OnReloadFrame();
890 void OnReplace(const string16& text);
[email protected]6e24cf12011-03-18 19:57:02891 void OnResetPageEncodingToDefault();
892 void OnScriptEvalRequest(const string16& frame_xpath,
893 const string16& jscript,
894 int id,
895 bool notify_result);
896 void OnSelectAll();
[email protected]4fb60142011-08-09 02:22:08897 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
[email protected]6e24cf12011-03-18 19:57:02898 void OnSetActive(bool active);
899 void OnSetAltErrorPageURL(const GURL& gurl);
900 void OnSetBackground(const SkBitmap& background);
[email protected]7a17bac02012-03-07 21:58:12901 void OnSetNavigationStartTime(
902 const base::TimeTicks& browser_navigation_start);
[email protected]6e24cf12011-03-18 19:57:02903 void OnSetWebUIProperty(const std::string& name, const std::string& value);
[email protected]c5d463e2012-03-15 21:05:56904 CONTENT_EXPORT void OnSetEditCommandsForNextKeyEvent(
905 const EditCommands& edit_commands);
[email protected]f3112a52011-09-30 23:47:49906 CONTENT_EXPORT void OnSetHistoryLengthAndPrune(int history_length,
907 int32 minimum_page_id);
[email protected]6e24cf12011-03-18 19:57:02908 void OnSetInitialFocus(bool reverse);
[email protected]54ca3ca892011-06-07 21:14:54909#if defined(OS_MACOSX)
910 void OnSetInLiveResize(bool in_live_resize);
911#endif
[email protected]333ec8d02011-09-16 18:59:19912 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
[email protected]6e24cf12011-03-18 19:57:02913 void OnSetPageEncoding(const std::string& encoding_name);
[email protected]daf82f82011-10-31 22:35:31914 void OnSetRendererPrefs(const content::RendererPreferences& renderer_prefs);
[email protected]6e24cf12011-03-18 19:57:02915#if defined(OS_MACOSX)
916 void OnSetWindowVisibility(bool visible);
917#endif
918 void OnSetZoomLevel(double zoom_level);
919 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
[email protected]8a5e0ca2011-08-25 06:30:47920 void OnExitFullscreen();
[email protected]6e24cf12011-03-18 19:57:02921 void OnShouldClose();
922 void OnStop();
[email protected]815dd9872011-11-23 18:40:30923 void OnStopFinding(content::StopFindAction action);
[email protected]73eb2602012-02-09 19:50:55924 CONTENT_EXPORT void OnSwapOut(const ViewMsg_SwapOut_Params& params);
[email protected]6e24cf12011-03-18 19:57:02925 void OnThemeChanged();
[email protected]6e24cf12011-03-18 19:57:02926 void OnUndo();
[email protected]6e24cf12011-03-18 19:57:02927 void OnUpdateTargetURLAck();
[email protected]6717bf272012-05-11 23:31:25928 CONTENT_EXPORT void OnUpdateWebPreferences(
929 const webkit_glue::WebPreferences& prefs);
[email protected]08bb1e722011-07-30 19:13:04930
[email protected]6e24cf12011-03-18 19:57:02931#if defined(OS_MACOSX)
932 void OnWindowFrameChanged(const gfx::Rect& window_frame,
933 const gfx::Rect& view_frame);
[email protected]c5d463e2012-03-15 21:05:56934 CONTENT_EXPORT void OnSelectPopupMenuItem(int selected_index);
[email protected]6e24cf12011-03-18 19:57:02935#endif
[email protected]54087fe2011-10-28 22:02:48936 void OnZoom(content::PageZoom zoom);
[email protected]47578fa02011-11-02 19:34:41937 void OnZoomFactor(content::PageZoom zoom, int zoom_center_x,
938 int zoom_center_y);
939
[email protected]5a7b15a2011-08-22 22:48:18940 void OnEnableViewSourceMode();
[email protected]6e24cf12011-03-18 19:57:02941
[email protected]64d0e192011-12-09 14:44:20942 void OnJavaBridgeInit();
[email protected]7f3c7af2011-10-20 22:52:51943
[email protected]6e24cf12011-03-18 19:57:02944 // Adding a new message handler? Please add it in alphabetical order above
945 // and put it in the same position in the .cc file.
946
947 // Misc private functions ----------------------------------------------------
[email protected]47578fa02011-11-02 19:34:41948 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x,
949 int zoom_center_y, float scaling_increment);
[email protected]6e24cf12011-03-18 19:57:02950
[email protected]6e24cf12011-03-18 19:57:02951 void AltErrorPageFinished(WebKit::WebFrame* frame,
952 const WebKit::WebURLError& original_error,
953 const std::string& html);
954
[email protected]d812fd12011-05-27 23:05:07955 // Check whether the preferred size has changed.
[email protected]6e24cf12011-03-18 19:57:02956 void CheckPreferredSize();
957
[email protected]273558fb2012-01-12 15:03:51958 void EnsureMediaStreamImpl();
959
[email protected]5e56df82011-04-18 17:00:15960 // This callback is triggered when DownloadFavicon completes, either
961 // succesfully or with a failure. See DownloadFavicon for more
962 // details.
963 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher,
964 const SkBitmap& image);
[email protected]6e24cf12011-03-18 19:57:02965
[email protected]310ebd6302011-10-10 19:06:28966 // Requests to download a favicon image. When done, the RenderView is notified
967 // by way of DidDownloadFavicon. Returns true if the request was successfully
968 // started, false otherwise. id is used to uniquely identify the request and
969 // passed back to the DidDownloadFavicon method. If the image has multiple
970 // frames, the frame whose size is image_size is returned. If the image
971 // doesn't have a frame at the specified size, the first is returned.
[email protected]5e56df82011-04-18 17:00:15972 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
[email protected]6e24cf12011-03-18 19:57:02973
[email protected]6e24cf12011-03-18 19:57:02974 GURL GetAlternateErrorPageURL(const GURL& failed_url,
975 ErrorPageType error_type);
976
977 // Locates a sub frame with given xpath
[email protected]318bf5802011-08-08 17:12:41978 WebKit::WebFrame* GetChildFrame(const string16& frame_xpath) const;
[email protected]6e24cf12011-03-18 19:57:02979
[email protected]57b9396c2011-10-07 19:11:59980 // Returns the opener url if present, else an empty url.
981 GURL GetOpenerUrl() const;
982
[email protected]69ddf852012-02-21 23:21:31983 // Returns the URL being loaded by the given frame's request.
984 GURL GetLoadingUrl(WebKit::WebFrame* frame) const;
985
[email protected]6e24cf12011-03-18 19:57:02986 WebUIBindings* GetWebUIBindings();
987
[email protected]6e24cf12011-03-18 19:57:02988 // Should only be called if this object wraps a PluginDocument.
989 WebKit::WebPlugin* GetWebPluginFromPluginDocument();
990
[email protected]d466b8a2011-07-15 21:48:03991 // Returns true if the |params| navigation is to an entry that has been
992 // cropped due to a recent navigation the browser did not know about.
993 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params,
994 bool is_reload);
995
[email protected]6e24cf12011-03-18 19:57:02996 // Returns false unless this is a top-level navigation that crosses origins.
997 bool IsNonLocalTopLevelNavigation(const GURL& url,
998 WebKit::WebFrame* frame,
999 WebKit::WebNavigationType type);
1000
[email protected]6e24cf12011-03-18 19:57:021001 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame,
1002 const WebKit::WebURLError& error,
1003 bool replace);
1004
[email protected]14392a52012-05-02 20:28:441005 // Make this RenderView show an empty, unscriptable page.
1006 void NavigateToSwappedOutURL();
1007
[email protected]007733c2011-11-17 00:34:071008 // If we initiated a navigation, this function will populate |document_state|
1009 // with the navigation information saved in OnNavigate().
[email protected]45d83a12012-04-06 22:57:571010 void PopulateDocumentStateFromPending(content::DocumentState* document_state);
1011
1012 // Returns a new NavigationState populated with the navigation information
1013 // saved in OnNavigate().
1014 content::NavigationState* CreateNavigationStateFromPending();
[email protected]007733c2011-11-17 00:34:071015
[email protected]5b52cd2f712012-03-28 02:12:481016 // Processes the command-line flags --enable-viewport and
1017 // --enable-fixed-layout[=w,h].
1018 void ProcessViewLayoutFlags(const CommandLine& command_line);
1019
[email protected]6e24cf12011-03-18 19:57:021020 // Starts nav_state_sync_timer_ if it isn't already running.
1021 void StartNavStateSyncTimerIfNecessary();
1022
1023 // Dispatches the current navigation state to the browser. Called on a
1024 // periodic timer so we don't send too many messages.
1025 void SyncNavigationState();
1026
[email protected]b781ff282011-08-20 06:19:361027 // Dispatches the current state of selection on the webpage to the browser if
1028 // it has changed.
1029 // TODO(varunjain): delete this method once we figure out how to keep
1030 // selection handles in sync with the webpage.
1031 void SyncSelectionIfRequired();
1032
[email protected]c4dabe452012-02-08 23:58:121033#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
[email protected]6e24cf12011-03-18 19:57:021034 void UpdateFontRenderingFromRendererPrefs();
1035#else
1036 void UpdateFontRenderingFromRendererPrefs() {}
1037#endif
1038
1039 // Update the target url and tell the browser that the target URL has changed.
1040 // If |url| is empty, show |fallback_url|.
1041 void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
1042
[email protected]6e24cf12011-03-18 19:57:021043 // ---------------------------------------------------------------------------
1044 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
1045 // it in the same order in the .cc file as it was in the header.
1046 // ---------------------------------------------------------------------------
1047
1048 // Settings ------------------------------------------------------------------
1049
[email protected]6717bf272012-05-11 23:31:251050 webkit_glue::WebPreferences webkit_preferences_;
[email protected]daf82f82011-10-31 22:35:311051 content::RendererPreferences renderer_preferences_;
[email protected]6e24cf12011-03-18 19:57:021052
[email protected]6e24cf12011-03-18 19:57:021053 HostZoomLevels host_zoom_levels_;
1054
1055 // Whether content state (such as form state, scroll position and page
1056 // contents) should be sent to the browser immediately. This is normally
1057 // false, but set to true by some tests.
1058 bool send_content_state_immediately_;
1059
[email protected]6e24cf12011-03-18 19:57:021060 // Bitwise-ORed set of extra bindings that have been enabled. See
1061 // BindingsPolicy for details.
1062 int enabled_bindings_;
1063
1064 // The alternate error page URL, if one exists.
1065 GURL alternate_error_page_url_;
1066
1067 // If true, we send IPC messages when |preferred_size_| changes.
1068 bool send_preferred_size_changes_;
1069
1070 // If non-empty, and |send_preferred_size_changes_| is true, disable drawing
1071 // scroll bars on windows smaller than this size. Used for windows that the
1072 // browser resizes to the size of the content, such as browser action popups.
1073 // If a render view is set to the minimum size of its content, webkit may add
1074 // scroll bars. This makes sense for fixed sized windows, but it does not
1075 // make sense when the size of the view was chosen to fit the content.
1076 // This setting ensures that no scroll bars are drawn. The size limit exists
1077 // because if the view grows beyond a size known to the browser, scroll bars
1078 // should be drawn.
1079 gfx::Size disable_scrollbars_size_limit_;
1080
[email protected]6e24cf12011-03-18 19:57:021081 // Loading state -------------------------------------------------------------
1082
1083 // True if the top level frame is currently being loaded.
1084 bool is_loading_;
1085
1086 // The gesture that initiated the current navigation.
1087 NavigationGesture navigation_gesture_;
1088
1089 // Used for popups.
1090 bool opened_by_user_gesture_;
1091 GURL creator_url_;
1092
1093 // Whether this RenderView was created by a frame that was suppressing its
1094 // opener. If so, we may want to load pages in a separate process. See
1095 // decidePolicyForNavigation for details.
1096 bool opener_suppressed_;
1097
1098 // If we are handling a top-level client-side redirect, this tracks the URL
1099 // of the page that initiated it. Specifically, when a load is committed this
1100 // is used to determine if that load originated from a client-side redirect.
1101 // It is empty if there is no top-level client-side redirect.
[email protected]445e1042011-12-03 21:03:151102 content::Referrer completed_client_redirect_src_;
[email protected]6e24cf12011-03-18 19:57:021103
[email protected]6e24cf12011-03-18 19:57:021104 // Holds state pertaining to a navigation that we initiated. This is held by
1105 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_
1106 // as a temporary holder for the state until the WebDataSource corresponding
1107 // to the new navigation is created. See DidCreateDataSource.
[email protected]007733c2011-11-17 00:34:071108 scoped_ptr<ViewMsg_Navigate_Params> pending_navigation_params_;
[email protected]6e24cf12011-03-18 19:57:021109
1110 // Timer used to delay the updating of nav state (see SyncNavigationState).
[email protected]310ebd6302011-10-10 19:06:281111 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
[email protected]6e24cf12011-03-18 19:57:021112
[email protected]6e24cf12011-03-18 19:57:021113 // Page IDs ------------------------------------------------------------------
[email protected]a813c8e2011-10-08 01:34:111114 // See documentation in content::RenderView.
[email protected]6e24cf12011-03-18 19:57:021115 int32 page_id_;
1116
1117 // Indicates the ID of the last page that we sent a FrameNavigate to the
1118 // browser for. This is used to determine if the most recent transition
1119 // generated a history entry (less than page_id_), or not (equal to or
1120 // greater than). Note that this will be greater than page_id_ if the user
1121 // goes back.
1122 int32 last_page_id_sent_to_browser_;
1123
[email protected]74ce1ad2011-12-16 21:51:461124 // The next available page ID to use for this RenderView. These IDs are
1125 // specific to a given RenderView and the frames within it.
1126 int32 next_page_id_;
[email protected]6e24cf12011-03-18 19:57:021127
[email protected]d466b8a2011-07-15 21:48:031128 // The offset of the current item in the history list.
1129 int history_list_offset_;
1130
1131 // The RenderView's current impression of the history length. This includes
1132 // any items that have committed in this process, but because of cross-process
1133 // navigations, the history may have some entries that were committed in other
1134 // processes. We won't know about them until the next navigation in this
1135 // process.
1136 int history_list_length_;
1137
1138 // The list of page IDs for each history item this RenderView knows about.
1139 // Some entries may be -1 if they were rendered by other processes or were
1140 // restored from a previous session. This lets us detect attempts to
1141 // navigate to stale entries that have been cropped from our history.
1142 std::vector<int32> history_page_ids_;
1143
[email protected]6e24cf12011-03-18 19:57:021144 // Page info -----------------------------------------------------------------
1145
1146 // The last gotten main frame's encoding.
1147 std::string last_encoding_name_;
1148
[email protected]6e24cf12011-03-18 19:57:021149 // UI state ------------------------------------------------------------------
1150
1151 // The state of our target_url transmissions. When we receive a request to
1152 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
1153 // comes back - if a new request comes in before the ACK, we store the new
1154 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
1155 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
1156 // revert to TARGET_INFLIGHT.
1157 //
1158 // We don't need a queue of URLs to send, as only the latest is useful.
1159 enum {
1160 TARGET_NONE,
1161 TARGET_INFLIGHT, // We have a request in-flight, waiting for an ACK
1162 TARGET_PENDING // INFLIGHT + we have a URL waiting to be sent
1163 } target_url_status_;
1164
1165 // The URL we show the user in the status bar. We use this to determine if we
1166 // want to send a new one (we do not need to send duplicates). It will be
1167 // equal to either |mouse_over_url_| or |focus_url_|, depending on which was
1168 // updated last.
1169 GURL target_url_;
1170
1171 // The URL the user's mouse is hovering over.
1172 GURL mouse_over_url_;
1173
1174 // The URL that has keyboard focus.
1175 GURL focus_url_;
1176
1177 // The next target URL we want to send to the browser.
1178 GURL pending_target_url_;
1179
[email protected]6e24cf12011-03-18 19:57:021180 // The text selection the last time DidChangeSelection got called.
[email protected]e99ef6f2011-10-16 01:13:001181 string16 selection_text_;
1182 size_t selection_text_offset_;
1183 ui::Range selection_range_;
[email protected]6e24cf12011-03-18 19:57:021184
1185 // View ----------------------------------------------------------------------
1186
[email protected]6e24cf12011-03-18 19:57:021187 // Cache the preferred size of the page in order to prevent sending the IPC
1188 // when layout() recomputes but doesn't actually change sizes.
1189 gfx::Size preferred_size_;
1190
[email protected]1e0c8e02011-05-25 07:49:371191 // Used to delay determining the preferred size (to avoid intermediate
1192 // states for the sizes).
[email protected]310ebd6302011-10-10 19:06:281193 base::OneShotTimer<RenderViewImpl> check_preferred_size_timer_;
[email protected]1e0c8e02011-05-25 07:49:371194
[email protected]dd6afca2011-08-13 03:44:311195 // These store the "is main frame is scrolled all the way to the left
1196 // or right" state that was last sent to the browser.
1197 bool cached_is_main_frame_pinned_to_left_;
1198 bool cached_is_main_frame_pinned_to_right_;
1199
1200 // These store the "has scrollbars" state last sent to the browser.
1201 bool cached_has_main_frame_horizontal_scrollbar_;
1202 bool cached_has_main_frame_vertical_scrollbar_;
1203
[email protected]6e24cf12011-03-18 19:57:021204#if defined(OS_MACOSX)
1205 // Track the fake plugin window handles allocated on the browser side for
1206 // the accelerated compositor and (currently) accelerated plugins so that
1207 // we can discard them when the view goes away.
1208 std::set<gfx::PluginWindowHandle> fake_plugin_window_handles_;
1209#endif
1210
[email protected]05a980d7a2012-02-07 22:16:421211 // When this view is composited, the context used for compositing may or may
1212 // not support the GL_CHROMIUM_swapbuffers_complete_callback extension. Since
1213 // querying for the existence of this extension is expensive we cache the
1214 // result. These are used to implement SupportsAsynchronousSwapBuffers().
1215 bool context_has_swapbuffers_complete_callback_;
1216 bool queried_for_swapbuffers_complete_callback_;
1217
[email protected]d0fb8a72012-03-10 18:54:521218 // Whether the WebGraphicsContext3D handed out by createGraphicsContext3D() a
1219 // WebGraphicsContext3DCommandBufferImpl. This is a HACK required by the fact
1220 // that there's no other way to tell whether webview()->graphicsContext3D()
1221 // has a ContentGLContext (and thus a CommandBufferProxy & associated
1222 // route_id) or not.
1223 bool context_is_web_graphics_context_3d_command_buffer_impl_;
1224
[email protected]6e24cf12011-03-18 19:57:021225 // Helper objects ------------------------------------------------------------
1226
[email protected]6e24cf12011-03-18 19:57:021227 RendererWebCookieJarImpl cookie_jar_;
1228
1229 // The next group of objects all implement RenderViewObserver, so are deleted
[email protected]310ebd6302011-10-10 19:06:281230 // along with the RenderView automatically. This is why we just store
1231 // weak references.
[email protected]6e24cf12011-03-18 19:57:021232
[email protected]6e24cf12011-03-18 19:57:021233 // Holds a reference to the service which provides desktop notifications.
1234 NotificationProvider* notification_provider_;
1235
1236 // The geolocation dispatcher attached to this view, lazily initialized.
1237 GeolocationDispatcher* geolocation_dispatcher_;
1238
[email protected]0d9989d2011-12-21 20:26:001239 // The intents host attached to this view. Not lazily initialized.
1240 WebIntentsHost* intents_host_;
[email protected]1ef93132011-09-16 18:33:471241
[email protected]6e24cf12011-03-18 19:57:021242 // The speech dispatcher attached to this view, lazily initialized.
[email protected]c52b2892012-03-07 11:01:021243 InputTagSpeechDispatcher* input_tag_speech_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021244
1245 // Device orientation dispatcher attached to this view; lazily initialized.
1246 DeviceOrientationDispatcher* device_orientation_dispatcher_;
1247
[email protected]273558fb2012-01-12 15:03:511248 // MediaStream dispatcher attached to this view; lazily initialized.
1249 MediaStreamDispatcher* media_stream_dispatcher_;
1250
[email protected]ab2c4732011-07-20 19:57:401251 // MediaStreamImpl attached to this view; lazily initialized.
[email protected]1bc65a42012-04-23 09:31:251252 MediaStreamImpl* media_stream_impl_;
[email protected]ab2c4732011-07-20 19:57:401253
[email protected]6e24cf12011-03-18 19:57:021254 // Dispatches all P2P socket used by the renderer.
[email protected]b3f8f9722011-08-25 20:56:071255 content::P2PSocketDispatcher* p2p_socket_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021256
[email protected]c5c1d6d2011-07-28 18:42:411257 DevToolsAgent* devtools_agent_;
1258
[email protected]063afcb2011-09-29 07:54:321259 RendererAccessibility* renderer_accessibility_;
1260
[email protected]7f3c7af2011-10-20 22:52:511261 // Java Bridge dispatcher attached to this view; lazily initialized.
[email protected]7e9c5bb02012-05-14 13:58:311262 JavaBridgeDispatcher* java_bridge_dispatcher_;
[email protected]7f3c7af2011-10-20 22:52:511263
[email protected]217690d2012-01-27 07:33:111264 // Mouse Lock dispatcher attached to this view.
1265 MouseLockDispatcher* mouse_lock_dispatcher_;
1266
[email protected]6e24cf12011-03-18 19:57:021267 // Misc ----------------------------------------------------------------------
1268
1269 // The current and pending file chooser completion objects. If the queue is
1270 // nonempty, the first item represents the currently running file chooser
1271 // callback, and the remaining elements are the other file chooser completion
1272 // still waiting to be run (in order).
1273 struct PendingFileChooser;
1274 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_;
1275
[email protected]600ea402011-04-12 00:01:511276 // The current directory enumeration callback
1277 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_;
1278 int enumeration_completion_id_;
1279
[email protected]6e24cf12011-03-18 19:57:021280 // The SessionStorage namespace that we're assigned to has an ID, and that ID
1281 // is passed to us upon creation. WebKit asks for this ID upon first use and
1282 // uses it whenever asking the browser process to allocate new storage areas.
1283 int64 session_storage_namespace_id_;
1284
1285 // The total number of unrequested popups that exist and can be followed back
[email protected]310ebd6302011-10-10 19:06:281286 // to a common opener. This count is shared among all RenderViews created with
1287 // createView(). All popups are treated as unrequested until specifically
1288 // instructed otherwise by the Browser process.
[email protected]6e24cf12011-03-18 19:57:021289 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_;
1290
1291 // Whether this is a top level window (instead of a popup). Top level windows
1292 // shouldn't count against their own |shared_popup_counter_|.
1293 bool decrement_shared_popup_at_destruction_;
1294
1295 // If the browser hasn't sent us an ACK for the last FindReply we sent
1296 // to it, then we need to queue up the message (keeping only the most
1297 // recent message if new ones come in).
1298 scoped_ptr<IPC::Message> queued_find_reply_message_;
1299
1300 // Stores edit commands associated to the next key event.
1301 // Shall be cleared as soon as the next key event is processed.
1302 EditCommands edit_commands_;
1303
[email protected]6e24cf12011-03-18 19:57:021304 // Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS
1305 // object is only exposed when Web UI bindings are enabled.
1306 scoped_ptr<WebUIBindings> web_ui_bindings_;
1307
[email protected]6e24cf12011-03-18 19:57:021308 // The external popup for the currently showing select popup.
1309 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
1310
1311 // The node that the context menu was pressed over.
1312 WebKit::WebNode context_menu_node_;
1313
1314 // Reports load progress to the browser.
1315 scoped_ptr<LoadProgressTracker> load_progress_tracker_;
1316
1317 // All the registered observers. We expect this list to be small, so vector
1318 // is fine.
[email protected]3a034ebb2011-10-03 19:19:441319 ObserverList<content::RenderViewObserver> observers_;
[email protected]6e24cf12011-03-18 19:57:021320
[email protected]4fb60142011-08-09 02:22:081321 // Used to inform didChangeSelection() when it is called in the context
1322 // of handling a ViewMsg_SelectRange IPC.
1323 bool handling_select_range_;
1324
[email protected]217690d2012-01-27 07:33:111325 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
1326 scoped_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
1327
[email protected]ef5e98e2011-12-06 09:49:181328 // Plugins -------------------------------------------------------------------
1329
1330 // All the currently active plugin delegates for this RenderView; kept so
1331 // that we can enumerate them to send updates about things like window
1332 // location or tab focus and visibily. These are non-owning references.
1333 std::set<WebPluginDelegateProxy*> plugin_delegates_;
1334
1335#if defined(OS_WIN)
1336 // The ID of the focused NPAPI plug-in.
1337 int focused_plugin_id_;
1338#endif
1339
[email protected]766a7082012-02-03 23:39:151340 // Allows JS to access DOM automation. The JS object is only exposed when the
1341 // DOM automation bindings are enabled.
1342 scoped_ptr<DomAutomationController> dom_automation_controller_;
1343
[email protected]8cca3da2012-03-20 08:26:341344 // Indicates whether this RenderView is a guest of another RenderView.
1345 bool guest_;
1346
[email protected]3e3c4522012-04-13 21:16:291347 // The accessibility mode.
1348 AccessibilityMode accessibility_mode_;
1349
[email protected]ef5e98e2011-12-06 09:49:181350 // NOTE: pepper_delegate_ should be last member because its constructor calls
1351 // AddObservers method of RenderViewImpl from c-tor.
[email protected]ca00e9162012-04-03 05:35:361352 content::PepperPluginDelegateImpl pepper_delegate_;
[email protected]ef5e98e2011-12-06 09:49:181353
[email protected]6e24cf12011-03-18 19:57:021354 // ---------------------------------------------------------------------------
1355 // ADDING NEW DATA? Please see if it fits appropriately in one of the above
1356 // sections rather than throwing it randomly at the end. If you're adding a
1357 // bunch of stuff, you should probably create a helper class and put your
[email protected]310ebd6302011-10-10 19:06:281358 // data and methods on that to avoid bloating RenderView more. You can
1359 // use the Observer interface to filter IPC messages and receive frame change
[email protected]6e24cf12011-03-18 19:57:021360 // notifications.
1361 // ---------------------------------------------------------------------------
1362
[email protected]310ebd6302011-10-10 19:06:281363 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
[email protected]6e24cf12011-03-18 19:57:021364};
1365
[email protected]310ebd6302011-10-10 19:06:281366#endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_