blob: 7530fb6060751ace3b6f6222a35d92696bae712f [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]64d09222012-05-25 10:10:3484class SpeechRecognitionDispatcher;
[email protected]6e24cf12011-03-18 19:57:0285struct ViewMsg_Navigate_Params;
[email protected]f546640b2012-05-15 00:03:4986struct ViewMsg_PostMessage_Params;
[email protected]6e24cf12011-03-18 19:57:0287struct ViewMsg_StopFinding_Params;
[email protected]83f93d32011-11-11 00:43:3088struct ViewMsg_SwapOut_Params;
[email protected]6e24cf12011-03-18 19:57:0289struct WebDropData;
[email protected]0d9989d2011-12-21 20:26:0090class WebIntentsHost;
[email protected]83f93d32011-11-11 00:43:3091class WebPluginDelegateProxy;
92class WebUIBindings;
[email protected]b3f8f9722011-08-25 20:56:0793
94namespace content {
[email protected]007733c2011-11-17 00:34:0795class DocumentState;
[email protected]468e4902012-05-23 01:49:3196class GuestToEmbedderChannel;
[email protected]45d83a12012-04-06 22:57:5797class NavigationState;
[email protected]b3f8f9722011-08-25 20:56:0798class P2PSocketDispatcher;
[email protected]3a034ebb2011-10-03 19:19:4499class RenderViewObserver;
[email protected]007733c2011-11-17 00:34:07100class RenderViewTest;
[email protected]35be7ec2012-02-12 20:42:51101struct CustomContextMenuContext;
[email protected]8caadeb2011-11-22 02:45:23102struct FileChooserParams;
[email protected]fb11b6a42012-03-14 07:25:12103struct SelectedFileInfo;
[email protected]b3f8f9722011-08-25 20:56:07104} // namespace content
[email protected]6e24cf12011-03-18 19:57:02105
[email protected]6e24cf12011-03-18 19:57:02106namespace gfx {
107class Point;
108class Rect;
[email protected]b3f8f9722011-08-25 20:56:07109} // namespace gfx
[email protected]6e24cf12011-03-18 19:57:02110
111namespace webkit {
112
[email protected]6e24cf12011-03-18 19:57:02113namespace ppapi {
[email protected]6e24cf12011-03-18 19:57:02114class PluginInstance;
[email protected]468e4902012-05-23 01:49:31115class WebPluginImpl;
[email protected]6e24cf12011-03-18 19:57:02116} // namespace ppapi
117
118} // namespace webkit
119
120namespace webkit_glue {
[email protected]6e24cf12011-03-18 19:57:02121class ImageResourceFetcher;
[email protected]6e24cf12011-03-18 19:57:02122class ResourceFetcher;
123}
124
125namespace WebKit {
[email protected]6e24cf12011-03-18 19:57:02126class WebApplicationCacheHost;
127class WebApplicationCacheHostClient;
[email protected]f546640b2012-05-15 00:03:49128class WebDOMMessageEvent;
[email protected]6e24cf12011-03-18 19:57:02129class WebDataSource;
[email protected]6e24cf12011-03-18 19:57:02130class WebDragData;
[email protected]6e24cf12011-03-18 19:57:02131class WebGeolocationClient;
[email protected]42054a252011-05-17 18:02:13132class WebIconURL;
[email protected]6e24cf12011-03-18 19:57:02133class WebImage;
[email protected]50da23d02012-04-13 17:47:48134class WebPeerConnection00Handler;
135class WebPeerConnection00HandlerClient;
[email protected]6e24cf12011-03-18 19:57:02136class WebMediaPlayer;
137class WebMediaPlayerClient;
138class WebMouseEvent;
[email protected]273558fb2012-01-12 15:03:51139class WebPeerConnectionHandler;
140class WebPeerConnectionHandlerClient;
[email protected]5fa3a062012-03-21 15:39:34141class WebSocketStreamHandle;
[email protected]6e24cf12011-03-18 19:57:02142class WebSpeechInputController;
143class WebSpeechInputListener;
[email protected]64d09222012-05-25 10:10:34144class WebSpeechRecognizer;
[email protected]6e24cf12011-03-18 19:57:02145class WebStorageNamespace;
[email protected]2d0f2e92011-10-03 09:02:24146class WebTouchEvent;
[email protected]b00ba702011-08-17 01:41:03147class WebURLLoader;
[email protected]6e24cf12011-03-18 19:57:02148class WebURLRequest;
[email protected]273558fb2012-01-12 15:03:51149class WebUserMediaClient;
[email protected]7a1ec28a2012-03-28 21:10:24150struct WebActiveWheelFlingParameters;
[email protected]6e24cf12011-03-18 19:57:02151struct WebFileChooserParams;
152struct WebFindOptions;
153struct WebMediaPlayerAction;
[email protected]81375e872012-01-11 21:40:36154struct WebPluginAction;
[email protected]6e24cf12011-03-18 19:57:02155struct WebPoint;
156struct WebWindowFeatures;
157}
158
159// We need to prevent a page from trying to create infinite popups. It is not
160// as simple as keeping a count of the number of immediate children
161// popups. Having an html file that window.open()s itself would create
162// an unlimited chain of RenderViews who only have one RenderView child.
163//
164// Therefore, each new top level RenderView creates a new counter and shares it
[email protected]310ebd6302011-10-10 19:06:28165// with all its children and grandchildren popup RenderViewImpls created with
[email protected]6e24cf12011-03-18 19:57:02166// createView() to have a sort of global limit for the page so no more than
167// kMaximumNumberOfPopups popups are created.
168//
169// This is a RefCounted holder of an int because I can't say
170// scoped_refptr<int>.
171typedef base::RefCountedData<int> SharedRenderViewCounter;
172
173//
174// RenderView is an object that manages a WebView object, and provides a
175// communication interface with an embedding application process
176//
[email protected]310ebd6302011-10-10 19:06:28177class RenderViewImpl : public RenderWidget,
178 public WebKit::WebViewClient,
179 public WebKit::WebFrameClient,
180 public WebKit::WebPageSerializerClient,
181 public content::RenderView,
182 public webkit::npapi::WebPluginPageDelegate,
[email protected]a9288f52011-11-17 05:18:16183 public webkit_media::WebMediaPlayerDelegate,
[email protected]b3e83de2012-02-07 03:33:28184 public WebGraphicsContext3DSwapBuffersClient,
[email protected]310ebd6302011-10-10 19:06:28185 public base::SupportsWeakPtr<RenderViewImpl> {
[email protected]6e24cf12011-03-18 19:57:02186 public:
187 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the
[email protected]5f9de5882011-09-30 23:36:28188 // parent of the WebView HWND that will be created. If this is a blocked
[email protected]6e24cf12011-03-18 19:57:02189 // popup or as a new tab, opener_id is the routing ID of the RenderView
190 // responsible for creating this RenderView (corresponding to parent_hwnd).
191 // |counter| is either a currently initialized counter, or NULL (in which case
192 // we treat this RenderView as a top level window).
[email protected]310ebd6302011-10-10 19:06:28193 CONTENT_EXPORT static RenderViewImpl* Create(
[email protected]6e24cf12011-03-18 19:57:02194 gfx::NativeViewId parent_hwnd,
195 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31196 const content::RendererPreferences& renderer_prefs,
[email protected]6717bf272012-05-11 23:31:25197 const webkit_glue::WebPreferences& webkit_prefs,
[email protected]6e24cf12011-03-18 19:57:02198 SharedRenderViewCounter* counter,
199 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56200 int32 surface_id,
[email protected]6e24cf12011-03-18 19:57:02201 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46202 const string16& frame_name,
[email protected]14392a52012-05-02 20:28:44203 bool is_renderer_created,
204 bool swapped_out,
[email protected]6fd35b72012-03-01 19:46:41205 int32 next_page_id,
[email protected]8cca3da2012-03-20 08:26:34206 const WebKit::WebScreenInfo& screen_info,
[email protected]468e4902012-05-23 01:49:31207 content::GuestToEmbedderChannel* guest_to_embedder_channel,
[email protected]3e3c4522012-04-13 21:16:29208 AccessibilityMode accessibility_mode);
[email protected]6e24cf12011-03-18 19:57:02209
[email protected]310ebd6302011-10-10 19:06:28210 // Returns the RenderViewImpl containing the given WebView.
211 CONTENT_EXPORT static RenderViewImpl* FromWebView(WebKit::WebView* webview);
[email protected]6e24cf12011-03-18 19:57:02212
[email protected]6e24cf12011-03-18 19:57:02213 // May return NULL when the view is closing.
[email protected]8d128d62011-09-13 22:11:57214 CONTENT_EXPORT WebKit::WebView* webview() const;
[email protected]6e24cf12011-03-18 19:57:02215
[email protected]b3e83de2012-02-07 03:33:28216 // WebGraphicsContext3DSwapBuffersClient implementation.
217
[email protected]65225772011-05-12 21:10:24218 // Called by a GraphicsContext associated with this view when swapbuffers
[email protected]37a6f302011-07-11 23:43:08219 // is posted, completes or is aborted.
[email protected]b3e83de2012-02-07 03:33:28220 virtual void OnViewContextSwapBuffersPosted() OVERRIDE;
221 virtual void OnViewContextSwapBuffersComplete() OVERRIDE;
222 virtual void OnViewContextSwapBuffersAborted() OVERRIDE;
[email protected]65225772011-05-12 21:10:24223
[email protected]d466b8a2011-07-15 21:48:03224 int history_list_offset() const { return history_list_offset_; }
[email protected]6e24cf12011-03-18 19:57:02225
[email protected]6717bf272012-05-11 23:31:25226 const webkit_glue::WebPreferences& webkit_preferences() const {
[email protected]6e24cf12011-03-18 19:57:02227 return webkit_preferences_;
228 }
229
230 void set_send_content_state_immediately(bool value) {
231 send_content_state_immediately_ = value;
232 }
233
[email protected]273558fb2012-01-12 15:03:51234 MediaStreamDispatcher* media_stream_dispatcher() {
235 return media_stream_dispatcher_;
236 }
237
[email protected]6e24cf12011-03-18 19:57:02238 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled.
[email protected]b3f8f9722011-08-25 20:56:07239 content::P2PSocketDispatcher* p2p_socket_dispatcher() {
[email protected]6e24cf12011-03-18 19:57:02240 return p2p_socket_dispatcher_;
241 }
242
[email protected]217690d2012-01-27 07:33:11243 MouseLockDispatcher* mouse_lock_dispatcher() {
244 return mouse_lock_dispatcher_;
245 }
246
[email protected]273558fb2012-01-12 15:03:51247 WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler(
248 WebKit::WebPeerConnectionHandlerClient* client);
[email protected]50da23d02012-04-13 17:47:48249 WebKit::WebPeerConnection00Handler* CreatePeerConnectionHandlerJsep(
250 WebKit::WebPeerConnection00HandlerClient* client);
[email protected]273558fb2012-01-12 15:03:51251
[email protected]6e24cf12011-03-18 19:57:02252 // Functions to add and remove observers for this object.
[email protected]3a034ebb2011-10-03 19:19:44253 void AddObserver(content::RenderViewObserver* observer);
254 void RemoveObserver(content::RenderViewObserver* observer);
[email protected]6e24cf12011-03-18 19:57:02255
[email protected]6e24cf12011-03-18 19:57:02256 // Adds the given file chooser request to the file_chooser_completion_ queue
257 // (see that var for more) and requests the chooser be displayed if there are
258 // no other waiting items in the queue.
259 //
260 // Returns true if the chooser was successfully scheduled. False means we
261 // didn't schedule anything.
[email protected]8caadeb2011-11-22 02:45:23262 bool ScheduleFileChooser(const content::FileChooserParams& params,
[email protected]6e24cf12011-03-18 19:57:02263 WebKit::WebFileChooserCompletion* completion);
264
[email protected]6e24cf12011-03-18 19:57:02265 // Sets whether the renderer should report load progress to the browser.
266 void SetReportLoadProgressEnabled(bool enabled);
267
[email protected]7900bfdb2012-05-24 19:31:24268 content::GuestToEmbedderChannel* GetGuestToEmbedderChannel() const;
269 void SetGuestToEmbedderChannel(content::GuestToEmbedderChannel* channel);
[email protected]468e4902012-05-23 01:49:31270 PP_Instance guest_pp_instance() const { return guest_pp_instance_; }
[email protected]7900bfdb2012-05-24 19:31:24271 void set_guest_pp_instance(PP_Instance instance) {
272 guest_pp_instance_ = instance;
273 }
[email protected]468e4902012-05-23 01:49:31274 void set_guest_graphics_resource(const ppapi::HostResource& resource) {
275 guest_graphics_resource_ = resource;
276 }
277 const ppapi::HostResource& guest_graphics_resource() const {
278 return guest_graphics_resource_;
279 }
280
281 // Once the browser plugin embedder has connected to this guest, and is
282 // ready to paint, it informs the guest through GuestReady to begin
283 // compositing.
284 void GuestReady(PP_Instance instance);
285
286 webkit::ppapi::WebPluginImpl* CreateBrowserPlugin(
287 const IPC::ChannelHandle& channel_handle,
288 int guest_process_id,
289 const WebKit::WebPluginParams& params);
[email protected]2ac2be8b2012-03-21 23:11:28290
[email protected]a2ef54c2011-10-10 16:20:31291 void LoadNavigationErrorPage(
[email protected]8d128d62011-09-13 22:11:57292 WebKit::WebFrame* frame,
293 const WebKit::WebURLRequest& failed_request,
294 const WebKit::WebURLError& error,
295 const std::string& html,
296 bool replace);
[email protected]9966325b2011-04-18 05:00:10297
[email protected]6e24cf12011-03-18 19:57:02298 // Plugin-related functions --------------------------------------------------
299 // (See also WebPluginPageDelegate implementation.)
300
301 // Notification that the given plugin has crashed.
302 void PluginCrashed(const FilePath& plugin_path);
303
[email protected]6e24cf12011-03-18 19:57:02304 // Creates a fullscreen container for a pepper plugin instance.
[email protected]ea192e82011-04-11 19:16:02305 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
[email protected]6e24cf12011-03-18 19:57:02306 webkit::ppapi::PluginInstance* plugin);
307
[email protected]56ea1a62011-05-30 07:05:57308 // Informs the render view that a PPAPI plugin has gained or lost focus.
309 void PpapiPluginFocusChanged();
310
[email protected]73bf95812011-10-12 11:38:32311 // Informs the render view that a PPAPI plugin has changed text input status.
312 void PpapiPluginTextInputTypeChanged();
[email protected]3f783362011-10-21 22:40:50313 void PpapiPluginCaretPositionChanged();
[email protected]73bf95812011-10-12 11:38:32314
315 // Cancels current composition.
316 void PpapiPluginCancelComposition();
317
[email protected]3c8c74c2012-03-15 07:34:52318 // Informs the render view that a PPAPI plugin has changed selection.
319 void PpapiPluginSelectionChanged();
320
[email protected]b25b3ee2012-01-13 05:19:54321 // Retrieves the current caret position if a PPAPI plugin has focus.
322 bool GetPpapiPluginCaretBounds(gfx::Rect* rect);
323
[email protected]397c23962012-05-21 07:09:32324 // Simulates IME events for testing purpose.
325 void SimulateImeSetComposition(
326 const string16& text,
327 const std::vector<WebKit::WebCompositionUnderline>& underlines,
328 int selection_start,
329 int selection_end);
330 void SimulateImeConfirmComposition(const string16& text,
331 const ui::Range& replacement_range);
332
[email protected]e6ae0f6c2011-10-04 10:39:23333#if defined(OS_MACOSX) || defined(OS_WIN)
[email protected]6e24cf12011-03-18 19:57:02334 // Informs the render view that the given plugin has gained or lost focus.
335 void PluginFocusChanged(bool focused, int plugin_id);
[email protected]e6ae0f6c2011-10-04 10:39:23336#endif
[email protected]6e24cf12011-03-18 19:57:02337
[email protected]e6ae0f6c2011-10-04 10:39:23338#if defined(OS_MACOSX)
[email protected]6e24cf12011-03-18 19:57:02339 // Starts plugin IME.
340 void StartPluginIme();
341
342 // Helper routines for accelerated plugin support. Used by the
343 // WebPluginDelegateProxy, which has a pointer to the RenderView.
344 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque,
345 bool root);
346 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle window);
347 void AcceleratedSurfaceSetIOSurface(gfx::PluginWindowHandle window,
348 int32 width,
349 int32 height,
350 uint64 io_surface_identifier);
351 TransportDIB::Handle AcceleratedSurfaceAllocTransportDIB(size_t size);
352 void AcceleratedSurfaceFreeTransportDIB(TransportDIB::Id dib_id);
353 void AcceleratedSurfaceSetTransportDIB(gfx::PluginWindowHandle window,
354 int32 width,
355 int32 height,
356 TransportDIB::Handle transport_dib);
357 void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
358 uint64 surface_id);
359#endif
360
361 void RegisterPluginDelegate(WebPluginDelegateProxy* delegate);
362 void UnregisterPluginDelegate(WebPluginDelegateProxy* delegate);
363
[email protected]4a7d6392011-09-19 20:55:08364 // Helper function to retrieve information about a plugin for a URL and mime
365 // type. Returns false if no plugin was found.
366 // |actual_mime_type| is the actual mime type supported by the
367 // plugin found that match the URL given (one for each item in
368 // |info|).
[email protected]84c13c032011-09-23 00:12:22369 CONTENT_EXPORT bool GetPluginInfo(const GURL& url,
370 const GURL& page_url,
371 const std::string& mime_type,
372 webkit::WebPluginInfo* plugin_info,
373 std::string* actual_mime_type);
[email protected]4a7d6392011-09-19 20:55:08374
[email protected]7a1ec28a2012-03-28 21:10:24375 void TransferActiveWheelFlingAnimation(
376 const WebKit::WebActiveWheelFlingParameters& params);
377
[email protected]6e24cf12011-03-18 19:57:02378 // IPC::Channel::Listener implementation -------------------------------------
379
[email protected]edc64de2011-11-17 20:07:38380 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02381
382 // WebKit::WebWidgetClient implementation ------------------------------------
383
384 // Most methods are handled by RenderWidget.
385 virtual void didFocus();
386 virtual void didBlur();
387 virtual void show(WebKit::WebNavigationPolicy policy);
388 virtual void runModal();
[email protected]2b624c562011-10-27 22:58:26389 virtual bool enterFullScreen();
390 virtual void exitFullScreen();
[email protected]217690d2012-01-27 07:33:11391 virtual bool requestPointerLock();
392 virtual void requestPointerUnlock();
393 virtual bool isPointerLocked();
[email protected]7a1ec28a2012-03-28 21:10:24394 virtual void didActivateCompositor(int input_handler_identifier);
[email protected]6e24cf12011-03-18 19:57:02395
396 // WebKit::WebViewClient implementation --------------------------------------
397
398 virtual WebKit::WebView* createView(
399 WebKit::WebFrame* creator,
400 const WebKit::WebURLRequest& request,
401 const WebKit::WebWindowFeatures& features,
[email protected]916dfb62012-03-05 03:39:37402 const WebKit::WebString& frame_name,
403 WebKit::WebNavigationPolicy policy);
[email protected]6e24cf12011-03-18 19:57:02404 virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
[email protected]6e24cf12011-03-18 19:57:02405 virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
406 const WebKit::WebPopupMenuInfo& popup_menu_info,
407 WebKit::WebExternalPopupMenuClient* popup_menu_client);
408 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
409 unsigned quota);
[email protected]7e8b4d12012-01-20 23:39:51410 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(
[email protected]40ec0c12012-03-08 12:34:40411 const WebKit::WebGraphicsContext3D::Attributes& attributes);
[email protected]6e24cf12011-03-18 19:57:02412 virtual void didAddMessageToConsole(
413 const WebKit::WebConsoleMessage& message,
414 const WebKit::WebString& source_name,
415 unsigned source_line);
416 virtual void printPage(WebKit::WebFrame* frame);
417 virtual WebKit::WebNotificationPresenter* notificationPresenter();
[email protected]8a58c1c2011-04-19 18:40:12418 virtual bool enumerateChosenDirectory(
419 const WebKit::WebString& path,
420 WebKit::WebFileChooserCompletion* chooser_completion);
[email protected]6e24cf12011-03-18 19:57:02421 virtual void didStartLoading();
422 virtual void didStopLoading();
423 virtual void didChangeLoadProgress(WebKit::WebFrame* frame,
424 double load_progress);
425 virtual bool isSmartInsertDeleteEnabled();
426 virtual bool isSelectTrailingWhitespaceEnabled();
427 virtual void didChangeSelection(bool is_selection_empty);
428 virtual void didExecuteCommand(const WebKit::WebString& command_name);
429 virtual bool handleCurrentKeyboardEvent();
[email protected]da8543762012-03-20 08:52:20430 virtual WebKit::WebColorChooser* createColorChooser(
431 WebKit::WebColorChooserClient*, const WebKit::WebColor& initial_color);
[email protected]6e24cf12011-03-18 19:57:02432 virtual bool runFileChooser(
433 const WebKit::WebFileChooserParams& params,
434 WebKit::WebFileChooserCompletion* chooser_completion);
435 virtual void runModalAlertDialog(WebKit::WebFrame* frame,
436 const WebKit::WebString& message);
437 virtual bool runModalConfirmDialog(WebKit::WebFrame* frame,
438 const WebKit::WebString& message);
439 virtual bool runModalPromptDialog(WebKit::WebFrame* frame,
440 const WebKit::WebString& message,
441 const WebKit::WebString& default_value,
442 WebKit::WebString* actual_value);
443 virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame* frame,
444 const WebKit::WebString& message);
445 virtual void showContextMenu(WebKit::WebFrame* frame,
446 const WebKit::WebContextMenuData& data);
[email protected]6e24cf12011-03-18 19:57:02447 virtual void setStatusText(const WebKit::WebString& text);
448 virtual void setMouseOverURL(const WebKit::WebURL& url);
449 virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
[email protected]0407e422012-05-18 19:51:25450 virtual void startDragging(WebKit::WebFrame* frame,
451 const WebKit::WebDragData& data,
[email protected]6e24cf12011-03-18 19:57:02452 WebKit::WebDragOperationsMask mask,
453 const WebKit::WebImage& image,
454 const WebKit::WebPoint& imageOffset);
455 virtual bool acceptsLoadDrops();
456 virtual void focusNext();
457 virtual void focusPrevious();
458 virtual void focusedNodeChanged(const WebKit::WebNode& node);
[email protected]169d4282011-11-30 19:33:59459 virtual void didUpdateLayout();
[email protected]6e24cf12011-03-18 19:57:02460 virtual void navigateBackForwardSoon(int offset);
461 virtual int historyBackListCount();
462 virtual int historyForwardListCount();
463 virtual void postAccessibilityNotification(
464 const WebKit::WebAccessibilityObject& obj,
465 WebKit::WebAccessibilityNotification notification);
466 virtual void didUpdateInspectorSetting(const WebKit::WebString& key,
467 const WebKit::WebString& value);
468 virtual WebKit::WebGeolocationClient* geolocationClient();
469 virtual WebKit::WebSpeechInputController* speechInputController(
470 WebKit::WebSpeechInputListener* listener);
[email protected]64d09222012-05-25 10:10:34471 virtual WebKit::WebSpeechRecognizer* speechRecognizer();
[email protected]6e24cf12011-03-18 19:57:02472 virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient();
473 virtual void zoomLimitsChanged(double minimum_level, double maximum_level);
474 virtual void zoomLevelChanged();
475 virtual void registerProtocolHandler(const WebKit::WebString& scheme,
476 const WebKit::WebString& base_url,
477 const WebKit::WebString& url,
478 const WebKit::WebString& title);
[email protected]94dec932011-05-26 20:04:21479 virtual WebKit::WebPageVisibilityState visibilityState() const;
[email protected]273558fb2012-01-12 15:03:51480 virtual WebKit::WebUserMediaClient* userMediaClient();
[email protected]6e24cf12011-03-18 19:57:02481
482 // WebKit::WebFrameClient implementation -------------------------------------
483
484 virtual WebKit::WebPlugin* createPlugin(
485 WebKit::WebFrame* frame,
486 const WebKit::WebPluginParams& params);
[email protected]6ac77cb2012-05-01 14:49:01487 virtual WebKit::WebPlugin* createPluginReplacement(
488 WebKit::WebFrame* frame,
489 const WebKit::WebPluginParams& params);
[email protected]6e24cf12011-03-18 19:57:02490 virtual WebKit::WebSharedWorker* createSharedWorker(
491 WebKit::WebFrame* frame, const WebKit::WebURL& url,
492 const WebKit::WebString& name, unsigned long long documentId);
493 virtual WebKit::WebMediaPlayer* createMediaPlayer(
494 WebKit::WebFrame* frame,
495 WebKit::WebMediaPlayerClient* client);
496 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
497 WebKit::WebFrame* frame,
498 WebKit::WebApplicationCacheHostClient* client);
499 virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame);
500 virtual void frameDetached(WebKit::WebFrame* frame);
501 virtual void willClose(WebKit::WebFrame* frame);
[email protected]6e24cf12011-03-18 19:57:02502 virtual void loadURLExternally(WebKit::WebFrame* frame,
503 const WebKit::WebURLRequest& request,
504 WebKit::WebNavigationPolicy policy);
[email protected]0622875ab2011-07-27 12:10:34505 virtual void loadURLExternally(WebKit::WebFrame* frame,
506 const WebKit::WebURLRequest& request,
507 WebKit::WebNavigationPolicy policy,
508 const WebKit::WebString& suggested_name);
[email protected]6e24cf12011-03-18 19:57:02509 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
510 WebKit::WebFrame* frame,
511 const WebKit::WebURLRequest& request,
512 WebKit::WebNavigationType type,
513 const WebKit::WebNode&,
514 WebKit::WebNavigationPolicy default_policy,
515 bool is_redirect);
516 virtual bool canHandleRequest(WebKit::WebFrame* frame,
517 const WebKit::WebURLRequest& request);
518 virtual WebKit::WebURLError cannotHandleRequestError(
519 WebKit::WebFrame* frame,
520 const WebKit::WebURLRequest& request);
521 virtual WebKit::WebURLError cancelledError(
522 WebKit::WebFrame* frame,
523 const WebKit::WebURLRequest& request);
524 virtual void unableToImplementPolicyWithError(
525 WebKit::WebFrame* frame,
526 const WebKit::WebURLError& error);
527 virtual void willSendSubmitEvent(WebKit::WebFrame* frame,
528 const WebKit::WebFormElement& form);
529 virtual void willSubmitForm(WebKit::WebFrame* frame,
530 const WebKit::WebFormElement& form);
531 virtual void willPerformClientRedirect(WebKit::WebFrame* frame,
532 const WebKit::WebURL& from,
533 const WebKit::WebURL& to,
534 double interval,
535 double fire_time);
536 virtual void didCancelClientRedirect(WebKit::WebFrame* frame);
537 virtual void didCompleteClientRedirect(WebKit::WebFrame* frame,
538 const WebKit::WebURL& from);
539 virtual void didCreateDataSource(WebKit::WebFrame* frame,
540 WebKit::WebDataSource* datasource);
541 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame);
542 virtual void didReceiveServerRedirectForProvisionalLoad(
543 WebKit::WebFrame* frame);
544 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame,
545 const WebKit::WebURLError& error);
546 virtual void didReceiveDocumentData(WebKit::WebFrame* frame,
547 const char* data, size_t length,
548 bool& prevent_default);
549 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame,
550 bool is_new_navigation);
551 virtual void didClearWindowObject(WebKit::WebFrame* frame);
552 virtual void didCreateDocumentElement(WebKit::WebFrame* frame);
553 virtual void didReceiveTitle(WebKit::WebFrame* frame,
[email protected]a3bc4d12011-04-20 17:22:21554 const WebKit::WebString& title,
555 WebKit::WebTextDirection direction);
[email protected]42054a252011-05-17 18:02:13556 virtual void didChangeIcon(WebKit::WebFrame*,
557 WebKit::WebIconURL::Type) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02558 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame);
559 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame);
560 virtual void didFailLoad(WebKit::WebFrame* frame,
561 const WebKit::WebURLError& error);
562 virtual void didFinishLoad(WebKit::WebFrame* frame);
563 virtual void didNavigateWithinPage(WebKit::WebFrame* frame,
564 bool is_new_navigation);
565 virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame);
566 virtual void assignIdentifierToRequest(WebKit::WebFrame* frame,
567 unsigned identifier,
568 const WebKit::WebURLRequest& request);
569 virtual void willSendRequest(WebKit::WebFrame* frame,
570 unsigned identifier,
571 WebKit::WebURLRequest& request,
572 const WebKit::WebURLResponse& redirect_response);
573 virtual void didReceiveResponse(WebKit::WebFrame* frame,
574 unsigned identifier,
575 const WebKit::WebURLResponse& response);
576 virtual void didFinishResourceLoad(WebKit::WebFrame* frame,
577 unsigned identifier);
578 virtual void didFailResourceLoad(WebKit::WebFrame* frame,
579 unsigned identifier,
580 const WebKit::WebURLError& error);
581 virtual void didLoadResourceFromMemoryCache(
582 WebKit::WebFrame* frame,
583 const WebKit::WebURLRequest& request,
584 const WebKit::WebURLResponse&);
585 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame);
586 virtual void didRunInsecureContent(
587 WebKit::WebFrame* frame,
588 const WebKit::WebSecurityOrigin& origin,
589 const WebKit::WebURL& target);
[email protected]b00ba702011-08-17 01:41:03590 virtual void didAdoptURLLoader(WebKit::WebURLLoader* loader);
[email protected]6e24cf12011-03-18 19:57:02591 virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame* frame);
[email protected]5bc10932011-09-21 21:03:30592 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
593 v8::Handle<v8::Context>,
[email protected]a00fe692012-02-27 05:52:58594 int extension_group,
595 int world_id);
596 // TODO(koz): Remove once WebKit no longer calls this.
597 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
598 v8::Handle<v8::Context>,
[email protected]5bc10932011-09-21 21:03:30599 int world_id);
600 virtual void willReleaseScriptContext(WebKit::WebFrame* frame,
601 v8::Handle<v8::Context>,
602 int world_id);
[email protected]6e24cf12011-03-18 19:57:02603 virtual void didChangeScrollOffset(WebKit::WebFrame* frame);
[email protected]dd6afca2011-08-13 03:44:31604 virtual void numberOfWheelEventHandlersChanged(unsigned num_handlers);
[email protected]ea931252012-02-15 22:01:03605 virtual void numberOfTouchEventHandlersChanged(unsigned num_handlers);
[email protected]dd6afca2011-08-13 03:44:31606 virtual void didChangeContentsSize(WebKit::WebFrame* frame,
607 const WebKit::WebSize& size);
[email protected]6e24cf12011-03-18 19:57:02608 virtual void reportFindInPageMatchCount(int request_id,
609 int count,
610 bool final_update);
611 virtual void reportFindInPageSelection(int request_id,
612 int active_match_ordinal,
613 const WebKit::WebRect& sel);
[email protected]6e24cf12011-03-18 19:57:02614 virtual void openFileSystem(WebKit::WebFrame* frame,
615 WebKit::WebFileSystem::Type type,
616 long long size,
617 bool create,
618 WebKit::WebFileSystemCallbacks* callbacks);
[email protected]10e5cf12011-04-13 04:10:40619 virtual void queryStorageUsageAndQuota(
620 WebKit::WebFrame* frame,
621 WebKit::WebStorageQuotaType type,
622 WebKit::WebStorageQuotaCallbacks* callbacks);
[email protected]10e5cf12011-04-13 04:10:40623 virtual void requestStorageQuota(
624 WebKit::WebFrame* frame,
625 WebKit::WebStorageQuotaType type,
626 unsigned long long requested_size,
627 WebKit::WebStorageQuotaCallbacks* callbacks);
[email protected]8b5af492011-11-28 21:50:58628 virtual void registerIntentService(
629 WebKit::WebFrame* frame,
630 const WebKit::WebIntentServiceInfo& service);
631 virtual void dispatchIntent(WebKit::WebFrame* frame,
[email protected]ffc8bed2012-01-21 01:23:15632 const WebKit::WebIntentRequest& intentRequest);
[email protected]5fa3a062012-03-21 15:39:34633 virtual void willOpenSocketStream(
634 WebKit::WebSocketStreamHandle* handle);
[email protected]f546640b2012-05-15 00:03:49635 virtual bool willCheckAndDispatchMessageEvent(
636 WebKit::WebFrame* source,
637 WebKit::WebSecurityOrigin targetOrigin,
638 WebKit::WebDOMMessageEvent event) OVERRIDE;
[email protected]8b5af492011-11-28 21:50:58639
[email protected]18d5be92011-07-25 18:00:19640 // WebKit::WebPageSerializerClient implementation ----------------------------
641
642 virtual void didSerializeDataForFrame(
643 const WebKit::WebURL& frame_url,
644 const WebKit::WebCString& data,
645 PageSerializationStatus status) OVERRIDE;
646
[email protected]a2ef54c2011-10-10 16:20:31647 // content::RenderView implementation ----------------------------------------
648
649 virtual bool Send(IPC::Message* message) OVERRIDE;
[email protected]9f76c1e2012-03-05 15:15:58650 virtual int GetRoutingID() const OVERRIDE;
[email protected]82114f52012-03-20 22:53:41651 virtual int GetPageId() const OVERRIDE;
652 virtual gfx::Size GetSize() const OVERRIDE;
653 virtual gfx::NativeViewId GetHostWindow() const OVERRIDE;
[email protected]6717bf272012-05-11 23:31:25654 virtual webkit_glue::WebPreferences& GetWebkitPreferences() OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31655 virtual WebKit::WebView* GetWebView() OVERRIDE;
656 virtual WebKit::WebNode GetFocusedNode() const OVERRIDE;
657 virtual WebKit::WebNode GetContextMenuNode() const OVERRIDE;
[email protected]82114f52012-03-20 22:53:41658 virtual bool IsEditableNode(const WebKit::WebNode& node) const OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31659 virtual WebKit::WebPlugin* CreatePlugin(
660 WebKit::WebFrame* frame,
661 const webkit::WebPluginInfo& info,
662 const WebKit::WebPluginParams& params) OVERRIDE;
663 virtual void EvaluateScript(const string16& frame_xpath,
664 const string16& jscript,
665 int id,
666 bool notify_result) OVERRIDE;
667 virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE;
[email protected]82114f52012-03-20 22:53:41668 virtual int GetEnabledBindings() const OVERRIDE;
669 virtual bool GetContentStateImmediately() const OVERRIDE;
670 virtual float GetFilteredTimePerFrame() const OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31671 virtual void ShowContextMenu(WebKit::WebFrame* frame,
672 const WebKit::WebContextMenuData& data) OVERRIDE;
673 virtual WebKit::WebPageVisibilityState GetVisibilityState() const OVERRIDE;
674 virtual void RunModalAlertDialog(WebKit::WebFrame* frame,
675 const WebKit::WebString& message) OVERRIDE;
676 virtual void LoadURLExternally(
677 WebKit::WebFrame* frame,
678 const WebKit::WebURLRequest& request,
679 WebKit::WebNavigationPolicy policy) OVERRIDE;
680
[email protected]6e24cf12011-03-18 19:57:02681 // webkit_glue::WebPluginPageDelegate implementation -------------------------
682
683 virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
684 const FilePath& file_path,
[email protected]edc64de2011-11-17 20:07:38685 const std::string& mime_type) OVERRIDE;
[email protected]6ac77cb2012-05-01 14:49:01686 virtual WebKit::WebPlugin* CreatePluginReplacement(
687 const FilePath& file_path) OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38688 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
689 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
690 virtual void DidMovePlugin(
691 const webkit::npapi::WebPluginGeometry& move) OVERRIDE;
692 virtual void DidStartLoadingForPlugin() OVERRIDE;
693 virtual void DidStopLoadingForPlugin() OVERRIDE;
694 virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02695
[email protected]a9288f52011-11-17 05:18:16696 // webkit_media::WebMediaPlayerDelegate implementation -----------------------
[email protected]baff4512011-10-19 18:21:07697
[email protected]a9288f52011-11-17 05:18:16698 virtual void DidPlay(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
699 virtual void DidPause(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
700 virtual void PlayerGone(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
[email protected]baff4512011-10-19 18:21:07701
[email protected]6e24cf12011-03-18 19:57:02702 // Please do not add your stuff randomly to the end here. If there is an
703 // appropriate section, add it there. If not, there are some random functions
704 // nearer to the top you can add it to.
[email protected]6e24cf12011-03-18 19:57:02705
[email protected]38b592902011-04-16 02:08:42706 // Cannot use std::set unfortunately since linked_ptr<> does not support
707 // operator<.
708 typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> >
709 ImageResourceFetcherList;
710
[email protected]6e24cf12011-03-18 19:57:02711 protected:
712 // RenderWidget overrides:
[email protected]edc64de2011-11-17 20:07:38713 virtual void Close() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02714 virtual void OnResize(const gfx::Size& new_size,
[email protected]ee41e7d22011-10-14 19:34:09715 const gfx::Rect& resizer_rect,
[email protected]edc64de2011-11-17 20:07:38716 bool is_fullscreen) OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16717 virtual void WillInitiatePaint() OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38718 virtual void DidInitiatePaint() OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16719 virtual void DidFlushPaint() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02720 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
721 const gfx::Rect& paint_bounds,
722 TransportDIB** dib,
723 gfx::Rect* location,
[email protected]edc64de2011-11-17 20:07:38724 gfx::Rect* clip) OVERRIDE;
725 virtual gfx::Point GetScrollOffset() OVERRIDE;
726 virtual void DidHandleKeyEvent() OVERRIDE;
[email protected]67bfb83f2011-09-22 03:36:37727 virtual bool WillHandleMouseEvent(
728 const WebKit::WebMouseEvent& event) OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38729 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) OVERRIDE;
730 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) OVERRIDE;
731 virtual void OnSetFocus(bool enable) OVERRIDE;
732 virtual void OnWasHidden() OVERRIDE;
733 virtual void OnWasRestored(bool needs_repainting) OVERRIDE;
[email protected]65225772011-05-12 21:10:24734 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE;
[email protected]56ea1a62011-05-30 07:05:57735 virtual void OnImeSetComposition(
736 const string16& text,
737 const std::vector<WebKit::WebCompositionUnderline>& underlines,
738 int selection_start,
739 int selection_end) OVERRIDE;
[email protected]4de6d1692011-10-12 08:45:44740 virtual void OnImeConfirmComposition(
741 const string16& text, const ui::Range& replacement_range) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45742 virtual ui::TextInputType GetTextInputType() OVERRIDE;
[email protected]3f783362011-10-21 22:40:50743 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45744 virtual bool CanComposeInline() OVERRIDE;
[email protected]c3d45532011-10-07 19:20:40745 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02746
747 private:
[email protected]6e24cf12011-03-18 19:57:02748 // For unit tests.
749 friend class ExternalPopupMenuTest;
750 friend class PepperDeviceTest;
[email protected]c6d068ff2011-10-14 17:28:23751 friend class content::RenderViewTest;
[email protected]6e24cf12011-03-18 19:57:02752
753 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
754 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
755 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]744c2a22012-03-15 18:42:04756 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI);
[email protected]068970d2011-10-11 00:05:16757 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
758 DontIgnoreBackAfterNavEntryLimit);
759 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
760 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
761 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
762 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
763 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
764 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeStateChanged);
765 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
766 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
767 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
[email protected]73eb2602012-02-09 19:50:55768 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
[email protected]068970d2011-10-11 00:05:16769 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
770 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
[email protected]6e24cf12011-03-18 19:57:02771#if defined(OS_MACOSX)
772 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
773#endif
[email protected]068970d2011-10-11 00:05:16774 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune);
[email protected]6e24cf12011-03-18 19:57:02775
[email protected]6e24cf12011-03-18 19:57:02776 typedef std::map<GURL, double> HostZoomLevels;
777
[email protected]6e24cf12011-03-18 19:57:02778 enum ErrorPageType {
779 DNS_ERROR,
780 HTTP_404,
781 CONNECTION_ERROR,
782 };
783
[email protected]310ebd6302011-10-10 19:06:28784 RenderViewImpl(gfx::NativeViewId parent_hwnd,
785 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31786 const content::RendererPreferences& renderer_prefs,
[email protected]6717bf272012-05-11 23:31:25787 const webkit_glue::WebPreferences& webkit_prefs,
[email protected]310ebd6302011-10-10 19:06:28788 SharedRenderViewCounter* counter,
789 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56790 int32 surface_id,
[email protected]310ebd6302011-10-10 19:06:28791 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46792 const string16& frame_name,
[email protected]14392a52012-05-02 20:28:44793 bool is_renderer_created,
794 bool swapped_out,
[email protected]6fd35b72012-03-01 19:46:41795 int32 next_page_id,
[email protected]8cca3da2012-03-20 08:26:34796 const WebKit::WebScreenInfo& screen_info,
[email protected]468e4902012-05-23 01:49:31797 content::GuestToEmbedderChannel* guest_to_embedder_channel,
[email protected]3e3c4522012-04-13 21:16:29798 AccessibilityMode accessibility_mode);
[email protected]6e24cf12011-03-18 19:57:02799
800 // Do not delete directly. This class is reference counted.
[email protected]310ebd6302011-10-10 19:06:28801 virtual ~RenderViewImpl();
[email protected]6e24cf12011-03-18 19:57:02802
803 void UpdateURL(WebKit::WebFrame* frame);
[email protected]a49e10b2011-08-01 23:57:46804 void UpdateTitle(WebKit::WebFrame* frame, const string16& title,
805 WebKit::WebTextDirection title_direction);
[email protected]6e24cf12011-03-18 19:57:02806 void UpdateSessionHistory(WebKit::WebFrame* frame);
[email protected]6459800a2012-03-27 23:57:05807 void SendUpdateState(const WebKit::WebHistoryItem& item);
[email protected]6e24cf12011-03-18 19:57:02808
809 // Update current main frame's encoding and send it to browser window.
810 // Since we want to let users see the right encoding info from menu
811 // before finishing loading, we call the UpdateEncoding in
812 // a) function:DidCommitLoadForFrame. When this function is called,
813 // that means we have got first data. In here we try to get encoding
814 // of page if it has been specified in http header.
815 // b) function:DidReceiveTitle. When this function is called,
816 // that means we have got specified title. Because in most of webpages,
817 // title tags will follow meta tags. In here we try to get encoding of
818 // page if it has been specified in meta tag.
819 // c) function:DidFinishDocumentLoadForFrame. When this function is
820 // called, that means we have got whole html page. In here we should
821 // finally get right encoding of page.
822 void UpdateEncoding(WebKit::WebFrame* frame,
823 const std::string& encoding_name);
824
[email protected]ae5184d62011-10-06 19:25:58825 void OpenURL(WebKit::WebFrame* frame,
826 const GURL& url,
[email protected]445e1042011-12-03 21:03:15827 const content::Referrer& referrer,
[email protected]6e24cf12011-03-18 19:57:02828 WebKit::WebNavigationPolicy policy);
829
[email protected]269f86d2011-12-07 02:43:47830 bool RunJavaScriptMessage(ui::JavascriptMessageType type,
[email protected]4f5ce842011-05-27 19:34:41831 const string16& message,
832 const string16& default_value,
[email protected]6e24cf12011-03-18 19:57:02833 const GURL& frame_url,
[email protected]4f5ce842011-05-27 19:34:41834 string16* result);
[email protected]6e24cf12011-03-18 19:57:02835
836 // Sends a message and runs a nested message loop.
837 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
838
[email protected]dd6afca2011-08-13 03:44:31839 // Called when the "pinned to left/right edge" state needs to be updated.
840 void UpdateScrollState(WebKit::WebFrame* frame);
841
[email protected]6e24cf12011-03-18 19:57:02842 // IPC message handlers ------------------------------------------------------
843 //
844 // The documentation for these functions should be in
845 // render_messages_internal.h for the message that the function is handling.
846
[email protected]744c2a22012-03-15 18:42:04847 CONTENT_EXPORT void OnAllowBindings(int enabled_bindings_flags);
[email protected]6e24cf12011-03-18 19:57:02848 void OnAllowScriptToClose(bool script_can_close);
849 void OnAsyncFileOpened(base::PlatformFileError error_code,
850 IPC::PlatformFileForTransit file_for_transit,
851 int message_id);
[email protected]eb415bf0e2011-04-14 02:45:42852 void OnPpapiBrokerChannelCreated(int request_id,
[email protected]d54305072011-06-22 20:58:43853 const IPC::ChannelHandle& handle);
[email protected]6e24cf12011-03-18 19:57:02854 void OnCancelDownload(int32 download_id);
855 void OnClearFocusedNode();
[email protected]992db4c2011-05-12 15:37:15856 void OnClosePage();
[email protected]6e24cf12011-03-18 19:57:02857 void OnContextMenuClosed(
[email protected]35be7ec2012-02-12 20:42:51858 const content::CustomContextMenuContext& custom_context);
[email protected]6e24cf12011-03-18 19:57:02859 void OnCopy();
860 void OnCopyImageAt(int x, int y);
861#if defined(OS_MACOSX)
862 void OnCopyToFindPboard();
863#endif
864 void OnCut();
[email protected]318bf5802011-08-08 17:12:41865 void OnCSSInsertRequest(const string16& frame_xpath,
[email protected]01cf589c2011-07-28 18:04:03866 const std::string& css);
[email protected]6e24cf12011-03-18 19:57:02867 void OnCustomContextMenuAction(
[email protected]35be7ec2012-02-12 20:42:51868 const content::CustomContextMenuContext& custom_context,
[email protected]6e24cf12011-03-18 19:57:02869 unsigned action);
870 void OnDelete();
871 void OnDeterminePageLanguage();
872 void OnDisableScrollbarsForSmallWindows(
873 const gfx::Size& disable_scrollbars_size_limit);
874 void OnDisassociateFromPopupCount();
[email protected]6e24cf12011-03-18 19:57:02875 void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
876 const gfx::Point& screen_point,
877 bool ended,
878 WebKit::WebDragOperation drag_operation);
879 void OnDragSourceSystemDragEnded();
880 void OnDragTargetDrop(const gfx::Point& client_pt,
[email protected]1f2230b2012-05-17 23:43:42881 const gfx::Point& screen_pt,
882 int key_modifiers);
[email protected]6e24cf12011-03-18 19:57:02883 void OnDragTargetDragEnter(const WebDropData& drop_data,
884 const gfx::Point& client_pt,
885 const gfx::Point& screen_pt,
[email protected]1f2230b2012-05-17 23:43:42886 WebKit::WebDragOperationsMask operations_allowed,
887 int key_modifiers);
[email protected]6e24cf12011-03-18 19:57:02888 void OnDragTargetDragLeave();
889 void OnDragTargetDragOver(const gfx::Point& client_pt,
890 const gfx::Point& screen_pt,
[email protected]1f2230b2012-05-17 23:43:42891 WebKit::WebDragOperationsMask operations_allowed,
892 int key_modifiers);
[email protected]2bf834f2011-11-17 20:02:21893 void OnEnablePreferredSizeChangedMode();
[email protected]244ac1892011-12-02 17:04:47894 void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
[email protected]61e2b3cc2012-03-02 16:13:34895 void OnDisableAutoResize(const gfx::Size& new_size);
[email protected]600ea402011-04-12 00:01:51896 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths);
[email protected]6e24cf12011-03-18 19:57:02897 void OnExecuteEditCommand(const std::string& name, const std::string& value);
[email protected]fb11b6a42012-03-14 07:25:12898 void OnFileChooserResponse(
899 const std::vector<content::SelectedFileInfo>& files);
[email protected]6e24cf12011-03-18 19:57:02900 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
901 void OnFindReplyAck();
[email protected]18d5be92011-07-25 18:00:19902 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
903 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
904 const std::vector<GURL>& links,
905 const std::vector<FilePath>& local_paths,
906 const FilePath& local_directory_name);
[email protected]6e24cf12011-03-18 19:57:02907 void OnMediaPlayerActionAt(const gfx::Point& location,
908 const WebKit::WebMediaPlayerAction& action);
[email protected]77829642012-05-15 14:47:17909
910 // Screen has rotated. 0 = default (portrait), 90 = one turn right, and so on.
911 void OnOrientationChangeEvent(int orientation);
912
[email protected]81375e872012-01-11 21:40:36913 void OnPluginActionAt(const gfx::Point& location,
914 const WebKit::WebPluginAction& action);
[email protected]6e24cf12011-03-18 19:57:02915 void OnMoveOrResizeStarted();
[email protected]f3112a52011-09-30 23:47:49916 CONTENT_EXPORT void OnNavigate(const ViewMsg_Navigate_Params& params);
[email protected]6e24cf12011-03-18 19:57:02917 void OnPaste();
[email protected]44bf7002011-10-16 02:46:15918 void OnPasteAndMatchStyle();
[email protected]6e24cf12011-03-18 19:57:02919#if defined(OS_MACOSX)
920 void OnPluginImeCompositionCompleted(const string16& text, int plugin_id);
921#endif
[email protected]f546640b2012-05-15 00:03:49922 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params);
[email protected]6e24cf12011-03-18 19:57:02923 void OnRedo();
924 void OnReloadFrame();
925 void OnReplace(const string16& text);
[email protected]6e24cf12011-03-18 19:57:02926 void OnResetPageEncodingToDefault();
927 void OnScriptEvalRequest(const string16& frame_xpath,
928 const string16& jscript,
929 int id,
930 bool notify_result);
931 void OnSelectAll();
[email protected]4fb60142011-08-09 02:22:08932 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
[email protected]6e24cf12011-03-18 19:57:02933 void OnSetActive(bool active);
934 void OnSetAltErrorPageURL(const GURL& gurl);
935 void OnSetBackground(const SkBitmap& background);
[email protected]7a17bac02012-03-07 21:58:12936 void OnSetNavigationStartTime(
937 const base::TimeTicks& browser_navigation_start);
[email protected]6e24cf12011-03-18 19:57:02938 void OnSetWebUIProperty(const std::string& name, const std::string& value);
[email protected]c5d463e2012-03-15 21:05:56939 CONTENT_EXPORT void OnSetEditCommandsForNextKeyEvent(
940 const EditCommands& edit_commands);
[email protected]f3112a52011-09-30 23:47:49941 CONTENT_EXPORT void OnSetHistoryLengthAndPrune(int history_length,
942 int32 minimum_page_id);
[email protected]6e24cf12011-03-18 19:57:02943 void OnSetInitialFocus(bool reverse);
[email protected]54ca3ca892011-06-07 21:14:54944#if defined(OS_MACOSX)
945 void OnSetInLiveResize(bool in_live_resize);
946#endif
[email protected]333ec8d02011-09-16 18:59:19947 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
[email protected]6e24cf12011-03-18 19:57:02948 void OnSetPageEncoding(const std::string& encoding_name);
[email protected]daf82f82011-10-31 22:35:31949 void OnSetRendererPrefs(const content::RendererPreferences& renderer_prefs);
[email protected]6e24cf12011-03-18 19:57:02950#if defined(OS_MACOSX)
951 void OnSetWindowVisibility(bool visible);
952#endif
953 void OnSetZoomLevel(double zoom_level);
954 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
[email protected]8a5e0ca2011-08-25 06:30:47955 void OnExitFullscreen();
[email protected]6e24cf12011-03-18 19:57:02956 void OnShouldClose();
957 void OnStop();
[email protected]815dd9872011-11-23 18:40:30958 void OnStopFinding(content::StopFindAction action);
[email protected]73eb2602012-02-09 19:50:55959 CONTENT_EXPORT void OnSwapOut(const ViewMsg_SwapOut_Params& params);
[email protected]6e24cf12011-03-18 19:57:02960 void OnThemeChanged();
[email protected]6e24cf12011-03-18 19:57:02961 void OnUndo();
[email protected]6e24cf12011-03-18 19:57:02962 void OnUpdateTargetURLAck();
[email protected]6717bf272012-05-11 23:31:25963 CONTENT_EXPORT void OnUpdateWebPreferences(
964 const webkit_glue::WebPreferences& prefs);
[email protected]08bb1e722011-07-30 19:13:04965
[email protected]6e24cf12011-03-18 19:57:02966#if defined(OS_MACOSX)
967 void OnWindowFrameChanged(const gfx::Rect& window_frame,
968 const gfx::Rect& view_frame);
[email protected]c5d463e2012-03-15 21:05:56969 CONTENT_EXPORT void OnSelectPopupMenuItem(int selected_index);
[email protected]6e24cf12011-03-18 19:57:02970#endif
[email protected]24d2b172012-05-26 00:54:12971
972#if defined(OS_ANDROID)
973 void OnSelectPopupMenuItems(bool canceled,
974 const std::vector<int>& selected_indices);
975#endif
976
[email protected]54087fe2011-10-28 22:02:48977 void OnZoom(content::PageZoom zoom);
[email protected]47578fa02011-11-02 19:34:41978 void OnZoomFactor(content::PageZoom zoom, int zoom_center_x,
979 int zoom_center_y);
980
[email protected]5a7b15a2011-08-22 22:48:18981 void OnEnableViewSourceMode();
[email protected]6e24cf12011-03-18 19:57:02982
[email protected]64d0e192011-12-09 14:44:20983 void OnJavaBridgeInit();
[email protected]7f3c7af2011-10-20 22:52:51984
[email protected]6e24cf12011-03-18 19:57:02985 // Adding a new message handler? Please add it in alphabetical order above
986 // and put it in the same position in the .cc file.
987
988 // Misc private functions ----------------------------------------------------
[email protected]47578fa02011-11-02 19:34:41989 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x,
990 int zoom_center_y, float scaling_increment);
[email protected]6e24cf12011-03-18 19:57:02991
[email protected]6e24cf12011-03-18 19:57:02992 void AltErrorPageFinished(WebKit::WebFrame* frame,
993 const WebKit::WebURLError& original_error,
994 const std::string& html);
995
[email protected]d812fd12011-05-27 23:05:07996 // Check whether the preferred size has changed.
[email protected]6e24cf12011-03-18 19:57:02997 void CheckPreferredSize();
998
[email protected]273558fb2012-01-12 15:03:51999 void EnsureMediaStreamImpl();
1000
[email protected]5e56df82011-04-18 17:00:151001 // This callback is triggered when DownloadFavicon completes, either
1002 // succesfully or with a failure. See DownloadFavicon for more
1003 // details.
1004 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher,
1005 const SkBitmap& image);
[email protected]6e24cf12011-03-18 19:57:021006
[email protected]310ebd6302011-10-10 19:06:281007 // Requests to download a favicon image. When done, the RenderView is notified
1008 // by way of DidDownloadFavicon. Returns true if the request was successfully
1009 // started, false otherwise. id is used to uniquely identify the request and
1010 // passed back to the DidDownloadFavicon method. If the image has multiple
1011 // frames, the frame whose size is image_size is returned. If the image
1012 // doesn't have a frame at the specified size, the first is returned.
[email protected]5e56df82011-04-18 17:00:151013 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
[email protected]6e24cf12011-03-18 19:57:021014
[email protected]6e24cf12011-03-18 19:57:021015 GURL GetAlternateErrorPageURL(const GURL& failed_url,
1016 ErrorPageType error_type);
1017
1018 // Locates a sub frame with given xpath
[email protected]318bf5802011-08-08 17:12:411019 WebKit::WebFrame* GetChildFrame(const string16& frame_xpath) const;
[email protected]6e24cf12011-03-18 19:57:021020
[email protected]57b9396c2011-10-07 19:11:591021 // Returns the opener url if present, else an empty url.
1022 GURL GetOpenerUrl() const;
1023
[email protected]69ddf852012-02-21 23:21:311024 // Returns the URL being loaded by the given frame's request.
1025 GURL GetLoadingUrl(WebKit::WebFrame* frame) const;
1026
[email protected]6e24cf12011-03-18 19:57:021027 WebUIBindings* GetWebUIBindings();
1028
[email protected]6e24cf12011-03-18 19:57:021029 // Should only be called if this object wraps a PluginDocument.
1030 WebKit::WebPlugin* GetWebPluginFromPluginDocument();
1031
[email protected]d466b8a2011-07-15 21:48:031032 // Returns true if the |params| navigation is to an entry that has been
1033 // cropped due to a recent navigation the browser did not know about.
1034 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params,
1035 bool is_reload);
1036
[email protected]6e24cf12011-03-18 19:57:021037 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame,
1038 const WebKit::WebURLError& error,
1039 bool replace);
1040
[email protected]14392a52012-05-02 20:28:441041 // Make this RenderView show an empty, unscriptable page.
1042 void NavigateToSwappedOutURL();
1043
[email protected]007733c2011-11-17 00:34:071044 // If we initiated a navigation, this function will populate |document_state|
1045 // with the navigation information saved in OnNavigate().
[email protected]45d83a12012-04-06 22:57:571046 void PopulateDocumentStateFromPending(content::DocumentState* document_state);
1047
1048 // Returns a new NavigationState populated with the navigation information
1049 // saved in OnNavigate().
1050 content::NavigationState* CreateNavigationStateFromPending();
[email protected]007733c2011-11-17 00:34:071051
[email protected]5b52cd2f712012-03-28 02:12:481052 // Processes the command-line flags --enable-viewport and
1053 // --enable-fixed-layout[=w,h].
1054 void ProcessViewLayoutFlags(const CommandLine& command_line);
1055
[email protected]6e24cf12011-03-18 19:57:021056 // Starts nav_state_sync_timer_ if it isn't already running.
1057 void StartNavStateSyncTimerIfNecessary();
1058
1059 // Dispatches the current navigation state to the browser. Called on a
1060 // periodic timer so we don't send too many messages.
1061 void SyncNavigationState();
1062
[email protected]b781ff282011-08-20 06:19:361063 // Dispatches the current state of selection on the webpage to the browser if
1064 // it has changed.
1065 // TODO(varunjain): delete this method once we figure out how to keep
1066 // selection handles in sync with the webpage.
1067 void SyncSelectionIfRequired();
1068
[email protected]c4dabe452012-02-08 23:58:121069#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
[email protected]6e24cf12011-03-18 19:57:021070 void UpdateFontRenderingFromRendererPrefs();
1071#else
1072 void UpdateFontRenderingFromRendererPrefs() {}
1073#endif
1074
1075 // Update the target url and tell the browser that the target URL has changed.
1076 // If |url| is empty, show |fallback_url|.
1077 void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
1078
[email protected]6e24cf12011-03-18 19:57:021079 // ---------------------------------------------------------------------------
1080 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
1081 // it in the same order in the .cc file as it was in the header.
1082 // ---------------------------------------------------------------------------
1083
1084 // Settings ------------------------------------------------------------------
1085
[email protected]6717bf272012-05-11 23:31:251086 webkit_glue::WebPreferences webkit_preferences_;
[email protected]daf82f82011-10-31 22:35:311087 content::RendererPreferences renderer_preferences_;
[email protected]6e24cf12011-03-18 19:57:021088
[email protected]6e24cf12011-03-18 19:57:021089 HostZoomLevels host_zoom_levels_;
1090
1091 // Whether content state (such as form state, scroll position and page
1092 // contents) should be sent to the browser immediately. This is normally
1093 // false, but set to true by some tests.
1094 bool send_content_state_immediately_;
1095
[email protected]6e24cf12011-03-18 19:57:021096 // Bitwise-ORed set of extra bindings that have been enabled. See
1097 // BindingsPolicy for details.
1098 int enabled_bindings_;
1099
1100 // The alternate error page URL, if one exists.
1101 GURL alternate_error_page_url_;
1102
1103 // If true, we send IPC messages when |preferred_size_| changes.
1104 bool send_preferred_size_changes_;
1105
1106 // If non-empty, and |send_preferred_size_changes_| is true, disable drawing
1107 // scroll bars on windows smaller than this size. Used for windows that the
1108 // browser resizes to the size of the content, such as browser action popups.
1109 // If a render view is set to the minimum size of its content, webkit may add
1110 // scroll bars. This makes sense for fixed sized windows, but it does not
1111 // make sense when the size of the view was chosen to fit the content.
1112 // This setting ensures that no scroll bars are drawn. The size limit exists
1113 // because if the view grows beyond a size known to the browser, scroll bars
1114 // should be drawn.
1115 gfx::Size disable_scrollbars_size_limit_;
1116
[email protected]6e24cf12011-03-18 19:57:021117 // Loading state -------------------------------------------------------------
1118
1119 // True if the top level frame is currently being loaded.
1120 bool is_loading_;
1121
1122 // The gesture that initiated the current navigation.
1123 NavigationGesture navigation_gesture_;
1124
1125 // Used for popups.
1126 bool opened_by_user_gesture_;
1127 GURL creator_url_;
1128
1129 // Whether this RenderView was created by a frame that was suppressing its
1130 // opener. If so, we may want to load pages in a separate process. See
1131 // decidePolicyForNavigation for details.
1132 bool opener_suppressed_;
1133
1134 // If we are handling a top-level client-side redirect, this tracks the URL
1135 // of the page that initiated it. Specifically, when a load is committed this
1136 // is used to determine if that load originated from a client-side redirect.
1137 // It is empty if there is no top-level client-side redirect.
[email protected]445e1042011-12-03 21:03:151138 content::Referrer completed_client_redirect_src_;
[email protected]6e24cf12011-03-18 19:57:021139
[email protected]6e24cf12011-03-18 19:57:021140 // Holds state pertaining to a navigation that we initiated. This is held by
1141 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_
1142 // as a temporary holder for the state until the WebDataSource corresponding
1143 // to the new navigation is created. See DidCreateDataSource.
[email protected]007733c2011-11-17 00:34:071144 scoped_ptr<ViewMsg_Navigate_Params> pending_navigation_params_;
[email protected]6e24cf12011-03-18 19:57:021145
1146 // Timer used to delay the updating of nav state (see SyncNavigationState).
[email protected]310ebd6302011-10-10 19:06:281147 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
[email protected]6e24cf12011-03-18 19:57:021148
[email protected]6e24cf12011-03-18 19:57:021149 // Page IDs ------------------------------------------------------------------
[email protected]a813c8e2011-10-08 01:34:111150 // See documentation in content::RenderView.
[email protected]6e24cf12011-03-18 19:57:021151 int32 page_id_;
1152
1153 // Indicates the ID of the last page that we sent a FrameNavigate to the
1154 // browser for. This is used to determine if the most recent transition
1155 // generated a history entry (less than page_id_), or not (equal to or
1156 // greater than). Note that this will be greater than page_id_ if the user
1157 // goes back.
1158 int32 last_page_id_sent_to_browser_;
1159
[email protected]74ce1ad2011-12-16 21:51:461160 // The next available page ID to use for this RenderView. These IDs are
1161 // specific to a given RenderView and the frames within it.
1162 int32 next_page_id_;
[email protected]6e24cf12011-03-18 19:57:021163
[email protected]d466b8a2011-07-15 21:48:031164 // The offset of the current item in the history list.
1165 int history_list_offset_;
1166
1167 // The RenderView's current impression of the history length. This includes
1168 // any items that have committed in this process, but because of cross-process
1169 // navigations, the history may have some entries that were committed in other
1170 // processes. We won't know about them until the next navigation in this
1171 // process.
1172 int history_list_length_;
1173
1174 // The list of page IDs for each history item this RenderView knows about.
1175 // Some entries may be -1 if they were rendered by other processes or were
1176 // restored from a previous session. This lets us detect attempts to
1177 // navigate to stale entries that have been cropped from our history.
1178 std::vector<int32> history_page_ids_;
1179
[email protected]6e24cf12011-03-18 19:57:021180 // Page info -----------------------------------------------------------------
1181
1182 // The last gotten main frame's encoding.
1183 std::string last_encoding_name_;
1184
[email protected]6e24cf12011-03-18 19:57:021185 // UI state ------------------------------------------------------------------
1186
1187 // The state of our target_url transmissions. When we receive a request to
1188 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
1189 // comes back - if a new request comes in before the ACK, we store the new
1190 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
1191 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
1192 // revert to TARGET_INFLIGHT.
1193 //
1194 // We don't need a queue of URLs to send, as only the latest is useful.
1195 enum {
1196 TARGET_NONE,
1197 TARGET_INFLIGHT, // We have a request in-flight, waiting for an ACK
1198 TARGET_PENDING // INFLIGHT + we have a URL waiting to be sent
1199 } target_url_status_;
1200
1201 // The URL we show the user in the status bar. We use this to determine if we
1202 // want to send a new one (we do not need to send duplicates). It will be
1203 // equal to either |mouse_over_url_| or |focus_url_|, depending on which was
1204 // updated last.
1205 GURL target_url_;
1206
1207 // The URL the user's mouse is hovering over.
1208 GURL mouse_over_url_;
1209
1210 // The URL that has keyboard focus.
1211 GURL focus_url_;
1212
1213 // The next target URL we want to send to the browser.
1214 GURL pending_target_url_;
1215
[email protected]6e24cf12011-03-18 19:57:021216 // The text selection the last time DidChangeSelection got called.
[email protected]e99ef6f2011-10-16 01:13:001217 string16 selection_text_;
1218 size_t selection_text_offset_;
1219 ui::Range selection_range_;
[email protected]6e24cf12011-03-18 19:57:021220
1221 // View ----------------------------------------------------------------------
1222
[email protected]6e24cf12011-03-18 19:57:021223 // Cache the preferred size of the page in order to prevent sending the IPC
1224 // when layout() recomputes but doesn't actually change sizes.
1225 gfx::Size preferred_size_;
1226
[email protected]1e0c8e02011-05-25 07:49:371227 // Used to delay determining the preferred size (to avoid intermediate
1228 // states for the sizes).
[email protected]310ebd6302011-10-10 19:06:281229 base::OneShotTimer<RenderViewImpl> check_preferred_size_timer_;
[email protected]1e0c8e02011-05-25 07:49:371230
[email protected]dd6afca2011-08-13 03:44:311231 // These store the "is main frame is scrolled all the way to the left
1232 // or right" state that was last sent to the browser.
1233 bool cached_is_main_frame_pinned_to_left_;
1234 bool cached_is_main_frame_pinned_to_right_;
1235
1236 // These store the "has scrollbars" state last sent to the browser.
1237 bool cached_has_main_frame_horizontal_scrollbar_;
1238 bool cached_has_main_frame_vertical_scrollbar_;
1239
[email protected]6e24cf12011-03-18 19:57:021240#if defined(OS_MACOSX)
1241 // Track the fake plugin window handles allocated on the browser side for
1242 // the accelerated compositor and (currently) accelerated plugins so that
1243 // we can discard them when the view goes away.
1244 std::set<gfx::PluginWindowHandle> fake_plugin_window_handles_;
1245#endif
1246
[email protected]05a980d7a2012-02-07 22:16:421247 // When this view is composited, the context used for compositing may or may
1248 // not support the GL_CHROMIUM_swapbuffers_complete_callback extension. Since
1249 // querying for the existence of this extension is expensive we cache the
1250 // result. These are used to implement SupportsAsynchronousSwapBuffers().
1251 bool context_has_swapbuffers_complete_callback_;
1252 bool queried_for_swapbuffers_complete_callback_;
1253
[email protected]d0fb8a72012-03-10 18:54:521254 // Whether the WebGraphicsContext3D handed out by createGraphicsContext3D() a
1255 // WebGraphicsContext3DCommandBufferImpl. This is a HACK required by the fact
1256 // that there's no other way to tell whether webview()->graphicsContext3D()
1257 // has a ContentGLContext (and thus a CommandBufferProxy & associated
1258 // route_id) or not.
1259 bool context_is_web_graphics_context_3d_command_buffer_impl_;
1260
[email protected]6e24cf12011-03-18 19:57:021261 // Helper objects ------------------------------------------------------------
1262
[email protected]6e24cf12011-03-18 19:57:021263 RendererWebCookieJarImpl cookie_jar_;
1264
1265 // The next group of objects all implement RenderViewObserver, so are deleted
[email protected]310ebd6302011-10-10 19:06:281266 // along with the RenderView automatically. This is why we just store
1267 // weak references.
[email protected]6e24cf12011-03-18 19:57:021268
[email protected]6e24cf12011-03-18 19:57:021269 // Holds a reference to the service which provides desktop notifications.
1270 NotificationProvider* notification_provider_;
1271
1272 // The geolocation dispatcher attached to this view, lazily initialized.
1273 GeolocationDispatcher* geolocation_dispatcher_;
1274
[email protected]0d9989d2011-12-21 20:26:001275 // The intents host attached to this view. Not lazily initialized.
1276 WebIntentsHost* intents_host_;
[email protected]1ef93132011-09-16 18:33:471277
[email protected]6e24cf12011-03-18 19:57:021278 // The speech dispatcher attached to this view, lazily initialized.
[email protected]c52b2892012-03-07 11:01:021279 InputTagSpeechDispatcher* input_tag_speech_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021280
[email protected]64d09222012-05-25 10:10:341281 // The speech recognition dispatcher attached to this view, lazily
1282 // initialized.
1283 SpeechRecognitionDispatcher* speech_recognition_dispatcher_;
1284
[email protected]6e24cf12011-03-18 19:57:021285 // Device orientation dispatcher attached to this view; lazily initialized.
1286 DeviceOrientationDispatcher* device_orientation_dispatcher_;
1287
[email protected]273558fb2012-01-12 15:03:511288 // MediaStream dispatcher attached to this view; lazily initialized.
1289 MediaStreamDispatcher* media_stream_dispatcher_;
1290
[email protected]ab2c4732011-07-20 19:57:401291 // MediaStreamImpl attached to this view; lazily initialized.
[email protected]1bc65a42012-04-23 09:31:251292 MediaStreamImpl* media_stream_impl_;
[email protected]ab2c4732011-07-20 19:57:401293
[email protected]6e24cf12011-03-18 19:57:021294 // Dispatches all P2P socket used by the renderer.
[email protected]b3f8f9722011-08-25 20:56:071295 content::P2PSocketDispatcher* p2p_socket_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021296
[email protected]c5c1d6d2011-07-28 18:42:411297 DevToolsAgent* devtools_agent_;
1298
[email protected]063afcb2011-09-29 07:54:321299 RendererAccessibility* renderer_accessibility_;
1300
[email protected]7f3c7af2011-10-20 22:52:511301 // Java Bridge dispatcher attached to this view; lazily initialized.
[email protected]7e9c5bb02012-05-14 13:58:311302 JavaBridgeDispatcher* java_bridge_dispatcher_;
[email protected]7f3c7af2011-10-20 22:52:511303
[email protected]217690d2012-01-27 07:33:111304 // Mouse Lock dispatcher attached to this view.
1305 MouseLockDispatcher* mouse_lock_dispatcher_;
1306
[email protected]6e24cf12011-03-18 19:57:021307 // Misc ----------------------------------------------------------------------
1308
1309 // The current and pending file chooser completion objects. If the queue is
1310 // nonempty, the first item represents the currently running file chooser
1311 // callback, and the remaining elements are the other file chooser completion
1312 // still waiting to be run (in order).
1313 struct PendingFileChooser;
1314 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_;
1315
[email protected]600ea402011-04-12 00:01:511316 // The current directory enumeration callback
1317 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_;
1318 int enumeration_completion_id_;
1319
[email protected]6e24cf12011-03-18 19:57:021320 // The SessionStorage namespace that we're assigned to has an ID, and that ID
1321 // is passed to us upon creation. WebKit asks for this ID upon first use and
1322 // uses it whenever asking the browser process to allocate new storage areas.
1323 int64 session_storage_namespace_id_;
1324
1325 // The total number of unrequested popups that exist and can be followed back
[email protected]310ebd6302011-10-10 19:06:281326 // to a common opener. This count is shared among all RenderViews created with
1327 // createView(). All popups are treated as unrequested until specifically
1328 // instructed otherwise by the Browser process.
[email protected]6e24cf12011-03-18 19:57:021329 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_;
1330
1331 // Whether this is a top level window (instead of a popup). Top level windows
1332 // shouldn't count against their own |shared_popup_counter_|.
1333 bool decrement_shared_popup_at_destruction_;
1334
1335 // If the browser hasn't sent us an ACK for the last FindReply we sent
1336 // to it, then we need to queue up the message (keeping only the most
1337 // recent message if new ones come in).
1338 scoped_ptr<IPC::Message> queued_find_reply_message_;
1339
1340 // Stores edit commands associated to the next key event.
1341 // Shall be cleared as soon as the next key event is processed.
1342 EditCommands edit_commands_;
1343
[email protected]6e24cf12011-03-18 19:57:021344 // Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS
1345 // object is only exposed when Web UI bindings are enabled.
1346 scoped_ptr<WebUIBindings> web_ui_bindings_;
1347
[email protected]6e24cf12011-03-18 19:57:021348 // The external popup for the currently showing select popup.
1349 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
1350
1351 // The node that the context menu was pressed over.
1352 WebKit::WebNode context_menu_node_;
1353
1354 // Reports load progress to the browser.
1355 scoped_ptr<LoadProgressTracker> load_progress_tracker_;
1356
1357 // All the registered observers. We expect this list to be small, so vector
1358 // is fine.
[email protected]3a034ebb2011-10-03 19:19:441359 ObserverList<content::RenderViewObserver> observers_;
[email protected]6e24cf12011-03-18 19:57:021360
[email protected]4fb60142011-08-09 02:22:081361 // Used to inform didChangeSelection() when it is called in the context
1362 // of handling a ViewMsg_SelectRange IPC.
1363 bool handling_select_range_;
1364
[email protected]217690d2012-01-27 07:33:111365 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
1366 scoped_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
1367
[email protected]ef5e98e2011-12-06 09:49:181368 // Plugins -------------------------------------------------------------------
1369
1370 // All the currently active plugin delegates for this RenderView; kept so
1371 // that we can enumerate them to send updates about things like window
1372 // location or tab focus and visibily. These are non-owning references.
1373 std::set<WebPluginDelegateProxy*> plugin_delegates_;
1374
1375#if defined(OS_WIN)
1376 // The ID of the focused NPAPI plug-in.
1377 int focused_plugin_id_;
1378#endif
1379
[email protected]766a7082012-02-03 23:39:151380 // Allows JS to access DOM automation. The JS object is only exposed when the
1381 // DOM automation bindings are enabled.
1382 scoped_ptr<DomAutomationController> dom_automation_controller_;
1383
[email protected]468e4902012-05-23 01:49:311384 // Channel for communication with embedding renderer, if it exists.
1385 scoped_refptr<content::GuestToEmbedderChannel> guest_to_embedder_channel_;
1386
1387 // The pepper instance identifer for this guest RenderView.
1388 PP_Instance guest_pp_instance_;
1389
1390 // The ppapi::HostResource associated with the on-screen context for this
1391 // guest RenderView.
1392 ppapi::HostResource guest_graphics_resource_;
1393
1394 // This graphics context is initialized once GuestReady() is called.
1395 WebGraphicsContext3DCommandBufferImpl* guest_uninitialized_context_;
1396
1397 // These are the attributes originally passed into createGraphicsContext3D
1398 // before the guest_to_embedder_channel was ready.
1399 WebKit::WebGraphicsContext3D::Attributes guest_attributes_;
[email protected]8cca3da2012-03-20 08:26:341400
[email protected]3e3c4522012-04-13 21:16:291401 // The accessibility mode.
1402 AccessibilityMode accessibility_mode_;
1403
[email protected]ef5e98e2011-12-06 09:49:181404 // NOTE: pepper_delegate_ should be last member because its constructor calls
1405 // AddObservers method of RenderViewImpl from c-tor.
[email protected]ca00e9162012-04-03 05:35:361406 content::PepperPluginDelegateImpl pepper_delegate_;
[email protected]ef5e98e2011-12-06 09:49:181407
[email protected]6e24cf12011-03-18 19:57:021408 // ---------------------------------------------------------------------------
1409 // ADDING NEW DATA? Please see if it fits appropriately in one of the above
1410 // sections rather than throwing it randomly at the end. If you're adding a
1411 // bunch of stuff, you should probably create a helper class and put your
[email protected]310ebd6302011-10-10 19:06:281412 // data and methods on that to avoid bloating RenderView more. You can
1413 // use the Observer interface to filter IPC messages and receive frame change
[email protected]6e24cf12011-03-18 19:57:021414 // notifications.
1415 // ---------------------------------------------------------------------------
1416
[email protected]310ebd6302011-10-10 19:06:281417 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
[email protected]6e24cf12011-03-18 19:57:021418};
1419
[email protected]310ebd6302011-10-10 19:06:281420#endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_