blob: 2c9d561d92680740ff614db5cde94978c035f0a4 [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]be2510c02012-05-28 14:52:1428#include "content/public/common/javascript_message_type.h"
[email protected]54087fe2011-10-28 22:02:4829#include "content/public/common/page_zoom.h"
[email protected]445e1042011-12-03 21:03:1530#include "content/public/common/referrer.h"
[email protected]daf82f82011-10-31 22:35:3131#include "content/public/common/renderer_preferences.h"
[email protected]815dd9872011-11-23 18:40:3032#include "content/public/common/stop_find_action.h"
[email protected]a2ef54c2011-10-10 16:20:3133#include "content/public/renderer/render_view.h"
[email protected]1e7e3572012-02-22 00:25:0834#include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
[email protected]1e7e3572012-02-22 00:25:0835#include "content/renderer/render_view_selection.h"
[email protected]6e24cf12011-03-18 19:57:0236#include "content/renderer/render_widget.h"
[email protected]d353541f2012-05-03 22:45:4137#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]6e24cf12011-03-18 19:57:0238#include "ipc/ipc_platform_file.h"
[email protected]1e7e3572012-02-22 00:25:0839#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
[email protected]6e24cf12011-03-18 19:57:0240#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h"
[email protected]6459800a2012-03-27 23:57:0541#include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h"
[email protected]42054a252011-05-17 18:02:1342#include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h"
[email protected]d353541f2012-05-03 22:45:4143#include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationType.h"
[email protected]6e24cf12011-03-18 19:57:0244#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
[email protected]18d5be92011-07-25 18:00:1945#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClient.h"
[email protected]94dec932011-05-26 20:04:2146#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageVisibilityState.h"
[email protected]f546640b2012-05-15 00:03:4947#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
[email protected]6e24cf12011-03-18 19:57:0248#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h"
49#include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h"
[email protected]d353541f2012-05-03 22:45:4150#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h"
[email protected]7e8b4d12012-01-20 23:39:5151#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.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]da8543762012-03-20 08:52:2080class RendererWebColorChooserImpl;
[email protected]6e24cf12011-03-18 19:57:0281class SkBitmap;
[email protected]c52b2892012-03-07 11:01:0282class InputTagSpeechDispatcher;
[email protected]64d09222012-05-25 10:10:3483class SpeechRecognitionDispatcher;
[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]468e4902012-05-23 01:49:3195class GuestToEmbedderChannel;
[email protected]45d83a12012-04-06 22:57:5796class NavigationState;
[email protected]b3f8f9722011-08-25 20:56:0797class P2PSocketDispatcher;
[email protected]3a034ebb2011-10-03 19:19:4498class RenderViewObserver;
[email protected]007733c2011-11-17 00:34:0799class RenderViewTest;
[email protected]2a84f9d2012-06-05 21:50:43100class RendererAccessibility;
[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
[email protected]2d7b82c2012-06-01 05:57:50125#if defined(OS_ANDROID)
126namespace webkit_media {
127class WebMediaPlayerManagerAndroid;
128}
129#endif
130
[email protected]6e24cf12011-03-18 19:57:02131namespace WebKit {
[email protected]6e24cf12011-03-18 19:57:02132class WebApplicationCacheHost;
133class WebApplicationCacheHostClient;
[email protected]f546640b2012-05-15 00:03:49134class WebDOMMessageEvent;
[email protected]6e24cf12011-03-18 19:57:02135class WebDataSource;
[email protected]6e24cf12011-03-18 19:57:02136class WebDragData;
[email protected]6e24cf12011-03-18 19:57:02137class WebGeolocationClient;
[email protected]42054a252011-05-17 18:02:13138class WebIconURL;
[email protected]6e24cf12011-03-18 19:57:02139class WebImage;
[email protected]50da23d02012-04-13 17:47:48140class WebPeerConnection00Handler;
141class WebPeerConnection00HandlerClient;
[email protected]6e24cf12011-03-18 19:57:02142class WebMediaPlayer;
143class WebMediaPlayerClient;
144class WebMouseEvent;
[email protected]273558fb2012-01-12 15:03:51145class WebPeerConnectionHandler;
146class WebPeerConnectionHandlerClient;
[email protected]5fa3a062012-03-21 15:39:34147class WebSocketStreamHandle;
[email protected]6e24cf12011-03-18 19:57:02148class WebSpeechInputController;
149class WebSpeechInputListener;
[email protected]64d09222012-05-25 10:10:34150class WebSpeechRecognizer;
[email protected]6e24cf12011-03-18 19:57:02151class WebStorageNamespace;
[email protected]2d0f2e92011-10-03 09:02:24152class WebTouchEvent;
[email protected]b00ba702011-08-17 01:41:03153class WebURLLoader;
[email protected]6e24cf12011-03-18 19:57:02154class WebURLRequest;
[email protected]273558fb2012-01-12 15:03:51155class WebUserMediaClient;
[email protected]7a1ec28a2012-03-28 21:10:24156struct WebActiveWheelFlingParameters;
[email protected]6e24cf12011-03-18 19:57:02157struct WebFileChooserParams;
158struct WebFindOptions;
159struct WebMediaPlayerAction;
[email protected]81375e872012-01-11 21:40:36160struct WebPluginAction;
[email protected]6e24cf12011-03-18 19:57:02161struct WebPoint;
162struct WebWindowFeatures;
163}
164
165// We need to prevent a page from trying to create infinite popups. It is not
166// as simple as keeping a count of the number of immediate children
167// popups. Having an html file that window.open()s itself would create
168// an unlimited chain of RenderViews who only have one RenderView child.
169//
170// Therefore, each new top level RenderView creates a new counter and shares it
[email protected]310ebd6302011-10-10 19:06:28171// with all its children and grandchildren popup RenderViewImpls created with
[email protected]6e24cf12011-03-18 19:57:02172// createView() to have a sort of global limit for the page so no more than
173// kMaximumNumberOfPopups popups are created.
174//
175// This is a RefCounted holder of an int because I can't say
176// scoped_refptr<int>.
177typedef base::RefCountedData<int> SharedRenderViewCounter;
178
179//
180// RenderView is an object that manages a WebView object, and provides a
181// communication interface with an embedding application process
182//
[email protected]310ebd6302011-10-10 19:06:28183class RenderViewImpl : public RenderWidget,
184 public WebKit::WebViewClient,
185 public WebKit::WebFrameClient,
186 public WebKit::WebPageSerializerClient,
187 public content::RenderView,
188 public webkit::npapi::WebPluginPageDelegate,
[email protected]a9288f52011-11-17 05:18:16189 public webkit_media::WebMediaPlayerDelegate,
[email protected]b3e83de2012-02-07 03:33:28190 public WebGraphicsContext3DSwapBuffersClient,
[email protected]310ebd6302011-10-10 19:06:28191 public base::SupportsWeakPtr<RenderViewImpl> {
[email protected]6e24cf12011-03-18 19:57:02192 public:
193 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the
[email protected]5f9de5882011-09-30 23:36:28194 // parent of the WebView HWND that will be created. If this is a blocked
[email protected]6e24cf12011-03-18 19:57:02195 // popup or as a new tab, opener_id is the routing ID of the RenderView
196 // responsible for creating this RenderView (corresponding to parent_hwnd).
197 // |counter| is either a currently initialized counter, or NULL (in which case
198 // we treat this RenderView as a top level window).
[email protected]310ebd6302011-10-10 19:06:28199 CONTENT_EXPORT static RenderViewImpl* Create(
[email protected]6e24cf12011-03-18 19:57:02200 gfx::NativeViewId parent_hwnd,
201 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31202 const content::RendererPreferences& renderer_prefs,
[email protected]6717bf272012-05-11 23:31:25203 const webkit_glue::WebPreferences& webkit_prefs,
[email protected]6e24cf12011-03-18 19:57:02204 SharedRenderViewCounter* counter,
205 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56206 int32 surface_id,
[email protected]6e24cf12011-03-18 19:57:02207 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46208 const string16& frame_name,
[email protected]14392a52012-05-02 20:28:44209 bool is_renderer_created,
210 bool swapped_out,
[email protected]6fd35b72012-03-01 19:46:41211 int32 next_page_id,
[email protected]468e4902012-05-23 01:49:31212 content::GuestToEmbedderChannel* guest_to_embedder_channel,
[email protected]3e3c4522012-04-13 21:16:29213 AccessibilityMode accessibility_mode);
[email protected]6e24cf12011-03-18 19:57:02214
[email protected]310ebd6302011-10-10 19:06:28215 // Returns the RenderViewImpl containing the given WebView.
216 CONTENT_EXPORT static RenderViewImpl* FromWebView(WebKit::WebView* webview);
[email protected]6e24cf12011-03-18 19:57:02217
[email protected]6e24cf12011-03-18 19:57:02218 // May return NULL when the view is closing.
[email protected]8d128d62011-09-13 22:11:57219 CONTENT_EXPORT WebKit::WebView* webview() const;
[email protected]6e24cf12011-03-18 19:57:02220
[email protected]b3e83de2012-02-07 03:33:28221 // WebGraphicsContext3DSwapBuffersClient implementation.
222
[email protected]65225772011-05-12 21:10:24223 // Called by a GraphicsContext associated with this view when swapbuffers
[email protected]37a6f302011-07-11 23:43:08224 // is posted, completes or is aborted.
[email protected]b3e83de2012-02-07 03:33:28225 virtual void OnViewContextSwapBuffersPosted() OVERRIDE;
226 virtual void OnViewContextSwapBuffersComplete() OVERRIDE;
227 virtual void OnViewContextSwapBuffersAborted() OVERRIDE;
[email protected]65225772011-05-12 21:10:24228
[email protected]d466b8a2011-07-15 21:48:03229 int history_list_offset() const { return history_list_offset_; }
[email protected]6e24cf12011-03-18 19:57:02230
[email protected]6717bf272012-05-11 23:31:25231 const webkit_glue::WebPreferences& webkit_preferences() const {
[email protected]6e24cf12011-03-18 19:57:02232 return webkit_preferences_;
233 }
234
235 void set_send_content_state_immediately(bool value) {
236 send_content_state_immediately_ = value;
237 }
238
[email protected]273558fb2012-01-12 15:03:51239 MediaStreamDispatcher* media_stream_dispatcher() {
240 return media_stream_dispatcher_;
241 }
242
[email protected]6e24cf12011-03-18 19:57:02243 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled.
[email protected]b3f8f9722011-08-25 20:56:07244 content::P2PSocketDispatcher* p2p_socket_dispatcher() {
[email protected]6e24cf12011-03-18 19:57:02245 return p2p_socket_dispatcher_;
246 }
247
[email protected]217690d2012-01-27 07:33:11248 MouseLockDispatcher* mouse_lock_dispatcher() {
249 return mouse_lock_dispatcher_;
250 }
251
[email protected]2d7b82c2012-06-01 05:57:50252#if defined(OS_ANDROID)
253 webkit_media::WebMediaPlayerManagerAndroid* media_player_manager() {
254 return media_player_manager_.get();
255 }
256#endif
257
[email protected]273558fb2012-01-12 15:03:51258 WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler(
259 WebKit::WebPeerConnectionHandlerClient* client);
[email protected]50da23d02012-04-13 17:47:48260 WebKit::WebPeerConnection00Handler* CreatePeerConnectionHandlerJsep(
261 WebKit::WebPeerConnection00HandlerClient* client);
[email protected]273558fb2012-01-12 15:03:51262
[email protected]6e24cf12011-03-18 19:57:02263 // Functions to add and remove observers for this object.
[email protected]3a034ebb2011-10-03 19:19:44264 void AddObserver(content::RenderViewObserver* observer);
265 void RemoveObserver(content::RenderViewObserver* observer);
[email protected]6e24cf12011-03-18 19:57:02266
[email protected]6e24cf12011-03-18 19:57:02267 // Adds the given file chooser request to the file_chooser_completion_ queue
268 // (see that var for more) and requests the chooser be displayed if there are
269 // no other waiting items in the queue.
270 //
271 // Returns true if the chooser was successfully scheduled. False means we
272 // didn't schedule anything.
[email protected]8caadeb2011-11-22 02:45:23273 bool ScheduleFileChooser(const content::FileChooserParams& params,
[email protected]6e24cf12011-03-18 19:57:02274 WebKit::WebFileChooserCompletion* completion);
275
[email protected]6e24cf12011-03-18 19:57:02276 // Sets whether the renderer should report load progress to the browser.
277 void SetReportLoadProgressEnabled(bool enabled);
278
[email protected]7900bfdb2012-05-24 19:31:24279 content::GuestToEmbedderChannel* GetGuestToEmbedderChannel() const;
280 void SetGuestToEmbedderChannel(content::GuestToEmbedderChannel* channel);
[email protected]468e4902012-05-23 01:49:31281 PP_Instance guest_pp_instance() const { return guest_pp_instance_; }
[email protected]7900bfdb2012-05-24 19:31:24282 void set_guest_pp_instance(PP_Instance instance) {
283 guest_pp_instance_ = instance;
284 }
[email protected]468e4902012-05-23 01:49:31285 void set_guest_graphics_resource(const ppapi::HostResource& resource) {
286 guest_graphics_resource_ = resource;
287 }
288 const ppapi::HostResource& guest_graphics_resource() const {
289 return guest_graphics_resource_;
290 }
291
292 // Once the browser plugin embedder has connected to this guest, and is
293 // ready to paint, it informs the guest through GuestReady to begin
294 // compositing.
295 void GuestReady(PP_Instance instance);
296
297 webkit::ppapi::WebPluginImpl* CreateBrowserPlugin(
298 const IPC::ChannelHandle& channel_handle,
299 int guest_process_id,
300 const WebKit::WebPluginParams& params);
[email protected]2ac2be8b2012-03-21 23:11:28301
[email protected]a2ef54c2011-10-10 16:20:31302 void LoadNavigationErrorPage(
[email protected]8d128d62011-09-13 22:11:57303 WebKit::WebFrame* frame,
304 const WebKit::WebURLRequest& failed_request,
305 const WebKit::WebURLError& error,
306 const std::string& html,
307 bool replace);
[email protected]9966325b2011-04-18 05:00:10308
[email protected]6e24cf12011-03-18 19:57:02309 // Plugin-related functions --------------------------------------------------
310 // (See also WebPluginPageDelegate implementation.)
311
312 // Notification that the given plugin has crashed.
313 void PluginCrashed(const FilePath& plugin_path);
314
[email protected]6e24cf12011-03-18 19:57:02315 // Creates a fullscreen container for a pepper plugin instance.
[email protected]ea192e82011-04-11 19:16:02316 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
[email protected]6e24cf12011-03-18 19:57:02317 webkit::ppapi::PluginInstance* plugin);
318
[email protected]56ea1a62011-05-30 07:05:57319 // Informs the render view that a PPAPI plugin has gained or lost focus.
320 void PpapiPluginFocusChanged();
321
[email protected]73bf95812011-10-12 11:38:32322 // Informs the render view that a PPAPI plugin has changed text input status.
323 void PpapiPluginTextInputTypeChanged();
[email protected]3f783362011-10-21 22:40:50324 void PpapiPluginCaretPositionChanged();
[email protected]73bf95812011-10-12 11:38:32325
326 // Cancels current composition.
327 void PpapiPluginCancelComposition();
328
[email protected]3c8c74c2012-03-15 07:34:52329 // Informs the render view that a PPAPI plugin has changed selection.
330 void PpapiPluginSelectionChanged();
331
[email protected]b25b3ee2012-01-13 05:19:54332 // Retrieves the current caret position if a PPAPI plugin has focus.
333 bool GetPpapiPluginCaretBounds(gfx::Rect* rect);
334
[email protected]397c23962012-05-21 07:09:32335 // Simulates IME events for testing purpose.
336 void SimulateImeSetComposition(
337 const string16& text,
338 const std::vector<WebKit::WebCompositionUnderline>& underlines,
339 int selection_start,
340 int selection_end);
341 void SimulateImeConfirmComposition(const string16& text,
342 const ui::Range& replacement_range);
343
[email protected]e6ae0f6c2011-10-04 10:39:23344#if defined(OS_MACOSX) || defined(OS_WIN)
[email protected]6e24cf12011-03-18 19:57:02345 // Informs the render view that the given plugin has gained or lost focus.
346 void PluginFocusChanged(bool focused, int plugin_id);
[email protected]e6ae0f6c2011-10-04 10:39:23347#endif
[email protected]6e24cf12011-03-18 19:57:02348
[email protected]e6ae0f6c2011-10-04 10:39:23349#if defined(OS_MACOSX)
[email protected]6e24cf12011-03-18 19:57:02350 // Starts plugin IME.
351 void StartPluginIme();
352
353 // Helper routines for accelerated plugin support. Used by the
354 // WebPluginDelegateProxy, which has a pointer to the RenderView.
355 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque,
356 bool root);
357 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle window);
358 void AcceleratedSurfaceSetIOSurface(gfx::PluginWindowHandle window,
359 int32 width,
360 int32 height,
361 uint64 io_surface_identifier);
362 TransportDIB::Handle AcceleratedSurfaceAllocTransportDIB(size_t size);
363 void AcceleratedSurfaceFreeTransportDIB(TransportDIB::Id dib_id);
364 void AcceleratedSurfaceSetTransportDIB(gfx::PluginWindowHandle window,
365 int32 width,
366 int32 height,
367 TransportDIB::Handle transport_dib);
368 void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
369 uint64 surface_id);
370#endif
371
372 void RegisterPluginDelegate(WebPluginDelegateProxy* delegate);
373 void UnregisterPluginDelegate(WebPluginDelegateProxy* delegate);
374
[email protected]4a7d6392011-09-19 20:55:08375 // Helper function to retrieve information about a plugin for a URL and mime
376 // type. Returns false if no plugin was found.
377 // |actual_mime_type| is the actual mime type supported by the
378 // plugin found that match the URL given (one for each item in
379 // |info|).
[email protected]84c13c032011-09-23 00:12:22380 CONTENT_EXPORT bool GetPluginInfo(const GURL& url,
381 const GURL& page_url,
382 const std::string& mime_type,
383 webkit::WebPluginInfo* plugin_info,
384 std::string* actual_mime_type);
[email protected]4a7d6392011-09-19 20:55:08385
[email protected]7a1ec28a2012-03-28 21:10:24386 void TransferActiveWheelFlingAnimation(
387 const WebKit::WebActiveWheelFlingParameters& params);
388
[email protected]6e24cf12011-03-18 19:57:02389 // IPC::Channel::Listener implementation -------------------------------------
390
[email protected]edc64de2011-11-17 20:07:38391 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02392
393 // WebKit::WebWidgetClient implementation ------------------------------------
394
395 // Most methods are handled by RenderWidget.
396 virtual void didFocus();
397 virtual void didBlur();
398 virtual void show(WebKit::WebNavigationPolicy policy);
399 virtual void runModal();
[email protected]2b624c562011-10-27 22:58:26400 virtual bool enterFullScreen();
401 virtual void exitFullScreen();
[email protected]217690d2012-01-27 07:33:11402 virtual bool requestPointerLock();
403 virtual void requestPointerUnlock();
404 virtual bool isPointerLocked();
[email protected]7a1ec28a2012-03-28 21:10:24405 virtual void didActivateCompositor(int input_handler_identifier);
[email protected]6e24cf12011-03-18 19:57:02406
407 // WebKit::WebViewClient implementation --------------------------------------
408
409 virtual WebKit::WebView* createView(
410 WebKit::WebFrame* creator,
411 const WebKit::WebURLRequest& request,
412 const WebKit::WebWindowFeatures& features,
[email protected]916dfb62012-03-05 03:39:37413 const WebKit::WebString& frame_name,
414 WebKit::WebNavigationPolicy policy);
[email protected]6e24cf12011-03-18 19:57:02415 virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
[email protected]6e24cf12011-03-18 19:57:02416 virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
417 const WebKit::WebPopupMenuInfo& popup_menu_info,
418 WebKit::WebExternalPopupMenuClient* popup_menu_client);
419 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
420 unsigned quota);
[email protected]7e8b4d12012-01-20 23:39:51421 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(
[email protected]40ec0c12012-03-08 12:34:40422 const WebKit::WebGraphicsContext3D::Attributes& attributes);
[email protected]6e24cf12011-03-18 19:57:02423 virtual void didAddMessageToConsole(
424 const WebKit::WebConsoleMessage& message,
425 const WebKit::WebString& source_name,
426 unsigned source_line);
427 virtual void printPage(WebKit::WebFrame* frame);
428 virtual WebKit::WebNotificationPresenter* notificationPresenter();
[email protected]8a58c1c2011-04-19 18:40:12429 virtual bool enumerateChosenDirectory(
430 const WebKit::WebString& path,
431 WebKit::WebFileChooserCompletion* chooser_completion);
[email protected]6e24cf12011-03-18 19:57:02432 virtual void didStartLoading();
433 virtual void didStopLoading();
434 virtual void didChangeLoadProgress(WebKit::WebFrame* frame,
435 double load_progress);
436 virtual bool isSmartInsertDeleteEnabled();
437 virtual bool isSelectTrailingWhitespaceEnabled();
438 virtual void didChangeSelection(bool is_selection_empty);
439 virtual void didExecuteCommand(const WebKit::WebString& command_name);
440 virtual bool handleCurrentKeyboardEvent();
[email protected]da8543762012-03-20 08:52:20441 virtual WebKit::WebColorChooser* createColorChooser(
442 WebKit::WebColorChooserClient*, const WebKit::WebColor& initial_color);
[email protected]6e24cf12011-03-18 19:57:02443 virtual bool runFileChooser(
444 const WebKit::WebFileChooserParams& params,
445 WebKit::WebFileChooserCompletion* chooser_completion);
446 virtual void runModalAlertDialog(WebKit::WebFrame* frame,
447 const WebKit::WebString& message);
448 virtual bool runModalConfirmDialog(WebKit::WebFrame* frame,
449 const WebKit::WebString& message);
450 virtual bool runModalPromptDialog(WebKit::WebFrame* frame,
451 const WebKit::WebString& message,
452 const WebKit::WebString& default_value,
453 WebKit::WebString* actual_value);
454 virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame* frame,
455 const WebKit::WebString& message);
456 virtual void showContextMenu(WebKit::WebFrame* frame,
457 const WebKit::WebContextMenuData& data);
[email protected]6e24cf12011-03-18 19:57:02458 virtual void setStatusText(const WebKit::WebString& text);
459 virtual void setMouseOverURL(const WebKit::WebURL& url);
460 virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
[email protected]0407e422012-05-18 19:51:25461 virtual void startDragging(WebKit::WebFrame* frame,
462 const WebKit::WebDragData& data,
[email protected]6e24cf12011-03-18 19:57:02463 WebKit::WebDragOperationsMask mask,
464 const WebKit::WebImage& image,
465 const WebKit::WebPoint& imageOffset);
466 virtual bool acceptsLoadDrops();
467 virtual void focusNext();
468 virtual void focusPrevious();
469 virtual void focusedNodeChanged(const WebKit::WebNode& node);
[email protected]169d4282011-11-30 19:33:59470 virtual void didUpdateLayout();
[email protected]6e24cf12011-03-18 19:57:02471 virtual void navigateBackForwardSoon(int offset);
472 virtual int historyBackListCount();
473 virtual int historyForwardListCount();
474 virtual void postAccessibilityNotification(
475 const WebKit::WebAccessibilityObject& obj,
476 WebKit::WebAccessibilityNotification notification);
477 virtual void didUpdateInspectorSetting(const WebKit::WebString& key,
478 const WebKit::WebString& value);
479 virtual WebKit::WebGeolocationClient* geolocationClient();
480 virtual WebKit::WebSpeechInputController* speechInputController(
481 WebKit::WebSpeechInputListener* listener);
[email protected]64d09222012-05-25 10:10:34482 virtual WebKit::WebSpeechRecognizer* speechRecognizer();
[email protected]6e24cf12011-03-18 19:57:02483 virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient();
484 virtual void zoomLimitsChanged(double minimum_level, double maximum_level);
485 virtual void zoomLevelChanged();
486 virtual void registerProtocolHandler(const WebKit::WebString& scheme,
487 const WebKit::WebString& base_url,
488 const WebKit::WebString& url,
489 const WebKit::WebString& title);
[email protected]94dec932011-05-26 20:04:21490 virtual WebKit::WebPageVisibilityState visibilityState() const;
[email protected]273558fb2012-01-12 15:03:51491 virtual WebKit::WebUserMediaClient* userMediaClient();
[email protected]6e24cf12011-03-18 19:57:02492
493 // WebKit::WebFrameClient implementation -------------------------------------
494
495 virtual WebKit::WebPlugin* createPlugin(
496 WebKit::WebFrame* frame,
497 const WebKit::WebPluginParams& params);
[email protected]6ac77cb2012-05-01 14:49:01498 virtual WebKit::WebPlugin* createPluginReplacement(
499 WebKit::WebFrame* frame,
500 const WebKit::WebPluginParams& params);
[email protected]6e24cf12011-03-18 19:57:02501 virtual WebKit::WebSharedWorker* createSharedWorker(
502 WebKit::WebFrame* frame, const WebKit::WebURL& url,
503 const WebKit::WebString& name, unsigned long long documentId);
504 virtual WebKit::WebMediaPlayer* createMediaPlayer(
505 WebKit::WebFrame* frame,
506 WebKit::WebMediaPlayerClient* client);
507 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
508 WebKit::WebFrame* frame,
509 WebKit::WebApplicationCacheHostClient* client);
510 virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame);
511 virtual void frameDetached(WebKit::WebFrame* frame);
512 virtual void willClose(WebKit::WebFrame* frame);
[email protected]6e24cf12011-03-18 19:57:02513 virtual void loadURLExternally(WebKit::WebFrame* frame,
514 const WebKit::WebURLRequest& request,
515 WebKit::WebNavigationPolicy policy);
[email protected]0622875ab2011-07-27 12:10:34516 virtual void loadURLExternally(WebKit::WebFrame* frame,
517 const WebKit::WebURLRequest& request,
518 WebKit::WebNavigationPolicy policy,
519 const WebKit::WebString& suggested_name);
[email protected]6e24cf12011-03-18 19:57:02520 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
521 WebKit::WebFrame* frame,
522 const WebKit::WebURLRequest& request,
523 WebKit::WebNavigationType type,
524 const WebKit::WebNode&,
525 WebKit::WebNavigationPolicy default_policy,
526 bool is_redirect);
527 virtual bool canHandleRequest(WebKit::WebFrame* frame,
528 const WebKit::WebURLRequest& request);
529 virtual WebKit::WebURLError cannotHandleRequestError(
530 WebKit::WebFrame* frame,
531 const WebKit::WebURLRequest& request);
532 virtual WebKit::WebURLError cancelledError(
533 WebKit::WebFrame* frame,
534 const WebKit::WebURLRequest& request);
535 virtual void unableToImplementPolicyWithError(
536 WebKit::WebFrame* frame,
537 const WebKit::WebURLError& error);
538 virtual void willSendSubmitEvent(WebKit::WebFrame* frame,
539 const WebKit::WebFormElement& form);
540 virtual void willSubmitForm(WebKit::WebFrame* frame,
541 const WebKit::WebFormElement& form);
542 virtual void willPerformClientRedirect(WebKit::WebFrame* frame,
543 const WebKit::WebURL& from,
544 const WebKit::WebURL& to,
545 double interval,
546 double fire_time);
547 virtual void didCancelClientRedirect(WebKit::WebFrame* frame);
548 virtual void didCompleteClientRedirect(WebKit::WebFrame* frame,
549 const WebKit::WebURL& from);
550 virtual void didCreateDataSource(WebKit::WebFrame* frame,
551 WebKit::WebDataSource* datasource);
552 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame);
553 virtual void didReceiveServerRedirectForProvisionalLoad(
554 WebKit::WebFrame* frame);
555 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame,
556 const WebKit::WebURLError& error);
557 virtual void didReceiveDocumentData(WebKit::WebFrame* frame,
558 const char* data, size_t length,
559 bool& prevent_default);
560 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame,
561 bool is_new_navigation);
562 virtual void didClearWindowObject(WebKit::WebFrame* frame);
563 virtual void didCreateDocumentElement(WebKit::WebFrame* frame);
564 virtual void didReceiveTitle(WebKit::WebFrame* frame,
[email protected]a3bc4d12011-04-20 17:22:21565 const WebKit::WebString& title,
566 WebKit::WebTextDirection direction);
[email protected]42054a252011-05-17 18:02:13567 virtual void didChangeIcon(WebKit::WebFrame*,
568 WebKit::WebIconURL::Type) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02569 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame);
570 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame);
571 virtual void didFailLoad(WebKit::WebFrame* frame,
572 const WebKit::WebURLError& error);
573 virtual void didFinishLoad(WebKit::WebFrame* frame);
574 virtual void didNavigateWithinPage(WebKit::WebFrame* frame,
575 bool is_new_navigation);
576 virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame);
577 virtual void assignIdentifierToRequest(WebKit::WebFrame* frame,
578 unsigned identifier,
579 const WebKit::WebURLRequest& request);
580 virtual void willSendRequest(WebKit::WebFrame* frame,
581 unsigned identifier,
582 WebKit::WebURLRequest& request,
583 const WebKit::WebURLResponse& redirect_response);
584 virtual void didReceiveResponse(WebKit::WebFrame* frame,
585 unsigned identifier,
586 const WebKit::WebURLResponse& response);
587 virtual void didFinishResourceLoad(WebKit::WebFrame* frame,
588 unsigned identifier);
589 virtual void didFailResourceLoad(WebKit::WebFrame* frame,
590 unsigned identifier,
591 const WebKit::WebURLError& error);
592 virtual void didLoadResourceFromMemoryCache(
593 WebKit::WebFrame* frame,
594 const WebKit::WebURLRequest& request,
595 const WebKit::WebURLResponse&);
596 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame);
597 virtual void didRunInsecureContent(
598 WebKit::WebFrame* frame,
599 const WebKit::WebSecurityOrigin& origin,
600 const WebKit::WebURL& target);
[email protected]b00ba702011-08-17 01:41:03601 virtual void didAdoptURLLoader(WebKit::WebURLLoader* loader);
[email protected]6e24cf12011-03-18 19:57:02602 virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame* frame);
[email protected]5bc10932011-09-21 21:03:30603 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
604 v8::Handle<v8::Context>,
[email protected]a00fe692012-02-27 05:52:58605 int extension_group,
606 int world_id);
607 // TODO(koz): Remove once WebKit no longer calls this.
608 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
609 v8::Handle<v8::Context>,
[email protected]5bc10932011-09-21 21:03:30610 int world_id);
611 virtual void willReleaseScriptContext(WebKit::WebFrame* frame,
612 v8::Handle<v8::Context>,
613 int world_id);
[email protected]6e24cf12011-03-18 19:57:02614 virtual void didChangeScrollOffset(WebKit::WebFrame* frame);
[email protected]dd6afca2011-08-13 03:44:31615 virtual void numberOfWheelEventHandlersChanged(unsigned num_handlers);
[email protected]ea931252012-02-15 22:01:03616 virtual void numberOfTouchEventHandlersChanged(unsigned num_handlers);
[email protected]dd6afca2011-08-13 03:44:31617 virtual void didChangeContentsSize(WebKit::WebFrame* frame,
618 const WebKit::WebSize& size);
[email protected]6e24cf12011-03-18 19:57:02619 virtual void reportFindInPageMatchCount(int request_id,
620 int count,
621 bool final_update);
622 virtual void reportFindInPageSelection(int request_id,
623 int active_match_ordinal,
624 const WebKit::WebRect& sel);
[email protected]6e24cf12011-03-18 19:57:02625 virtual void openFileSystem(WebKit::WebFrame* frame,
626 WebKit::WebFileSystem::Type type,
627 long long size,
628 bool create,
629 WebKit::WebFileSystemCallbacks* callbacks);
[email protected]10e5cf12011-04-13 04:10:40630 virtual void queryStorageUsageAndQuota(
631 WebKit::WebFrame* frame,
632 WebKit::WebStorageQuotaType type,
633 WebKit::WebStorageQuotaCallbacks* callbacks);
[email protected]10e5cf12011-04-13 04:10:40634 virtual void requestStorageQuota(
635 WebKit::WebFrame* frame,
636 WebKit::WebStorageQuotaType type,
637 unsigned long long requested_size,
638 WebKit::WebStorageQuotaCallbacks* callbacks);
[email protected]8b5af492011-11-28 21:50:58639 virtual void registerIntentService(
640 WebKit::WebFrame* frame,
641 const WebKit::WebIntentServiceInfo& service);
642 virtual void dispatchIntent(WebKit::WebFrame* frame,
[email protected]ffc8bed2012-01-21 01:23:15643 const WebKit::WebIntentRequest& intentRequest);
[email protected]5fa3a062012-03-21 15:39:34644 virtual void willOpenSocketStream(
645 WebKit::WebSocketStreamHandle* handle);
[email protected]f546640b2012-05-15 00:03:49646 virtual bool willCheckAndDispatchMessageEvent(
647 WebKit::WebFrame* source,
648 WebKit::WebSecurityOrigin targetOrigin,
649 WebKit::WebDOMMessageEvent event) OVERRIDE;
[email protected]8b5af492011-11-28 21:50:58650
[email protected]18d5be92011-07-25 18:00:19651 // WebKit::WebPageSerializerClient implementation ----------------------------
652
653 virtual void didSerializeDataForFrame(
654 const WebKit::WebURL& frame_url,
655 const WebKit::WebCString& data,
656 PageSerializationStatus status) OVERRIDE;
657
[email protected]a2ef54c2011-10-10 16:20:31658 // content::RenderView implementation ----------------------------------------
659
660 virtual bool Send(IPC::Message* message) OVERRIDE;
[email protected]9f76c1e2012-03-05 15:15:58661 virtual int GetRoutingID() const OVERRIDE;
[email protected]82114f52012-03-20 22:53:41662 virtual int GetPageId() const OVERRIDE;
663 virtual gfx::Size GetSize() const OVERRIDE;
664 virtual gfx::NativeViewId GetHostWindow() const OVERRIDE;
[email protected]6717bf272012-05-11 23:31:25665 virtual webkit_glue::WebPreferences& GetWebkitPreferences() OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31666 virtual WebKit::WebView* GetWebView() OVERRIDE;
667 virtual WebKit::WebNode GetFocusedNode() const OVERRIDE;
668 virtual WebKit::WebNode GetContextMenuNode() const OVERRIDE;
[email protected]82114f52012-03-20 22:53:41669 virtual bool IsEditableNode(const WebKit::WebNode& node) const OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31670 virtual WebKit::WebPlugin* CreatePlugin(
671 WebKit::WebFrame* frame,
672 const webkit::WebPluginInfo& info,
673 const WebKit::WebPluginParams& params) OVERRIDE;
674 virtual void EvaluateScript(const string16& frame_xpath,
675 const string16& jscript,
676 int id,
677 bool notify_result) OVERRIDE;
678 virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE;
[email protected]82114f52012-03-20 22:53:41679 virtual int GetEnabledBindings() const OVERRIDE;
680 virtual bool GetContentStateImmediately() const OVERRIDE;
681 virtual float GetFilteredTimePerFrame() const OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31682 virtual void ShowContextMenu(WebKit::WebFrame* frame,
683 const WebKit::WebContextMenuData& data) OVERRIDE;
684 virtual WebKit::WebPageVisibilityState GetVisibilityState() const OVERRIDE;
685 virtual void RunModalAlertDialog(WebKit::WebFrame* frame,
686 const WebKit::WebString& message) OVERRIDE;
687 virtual void LoadURLExternally(
688 WebKit::WebFrame* frame,
689 const WebKit::WebURLRequest& request,
690 WebKit::WebNavigationPolicy policy) OVERRIDE;
691
[email protected]6e24cf12011-03-18 19:57:02692 // webkit_glue::WebPluginPageDelegate implementation -------------------------
693
694 virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
695 const FilePath& file_path,
[email protected]edc64de2011-11-17 20:07:38696 const std::string& mime_type) OVERRIDE;
[email protected]6ac77cb2012-05-01 14:49:01697 virtual WebKit::WebPlugin* CreatePluginReplacement(
698 const FilePath& file_path) OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38699 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
700 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
701 virtual void DidMovePlugin(
702 const webkit::npapi::WebPluginGeometry& move) OVERRIDE;
703 virtual void DidStartLoadingForPlugin() OVERRIDE;
704 virtual void DidStopLoadingForPlugin() OVERRIDE;
705 virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02706
[email protected]a9288f52011-11-17 05:18:16707 // webkit_media::WebMediaPlayerDelegate implementation -----------------------
[email protected]baff4512011-10-19 18:21:07708
[email protected]5d65fe92012-06-02 00:48:55709 virtual void DidPlay(WebKit::WebMediaPlayer* player) OVERRIDE;
710 virtual void DidPause(WebKit::WebMediaPlayer* player) OVERRIDE;
711 virtual void PlayerGone(WebKit::WebMediaPlayer* player) OVERRIDE;
[email protected]baff4512011-10-19 18:21:07712
[email protected]6e24cf12011-03-18 19:57:02713 // Please do not add your stuff randomly to the end here. If there is an
714 // appropriate section, add it there. If not, there are some random functions
715 // nearer to the top you can add it to.
[email protected]6e24cf12011-03-18 19:57:02716
[email protected]38b592902011-04-16 02:08:42717 // Cannot use std::set unfortunately since linked_ptr<> does not support
718 // operator<.
719 typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> >
720 ImageResourceFetcherList;
721
[email protected]6e24cf12011-03-18 19:57:02722 protected:
723 // RenderWidget overrides:
[email protected]edc64de2011-11-17 20:07:38724 virtual void Close() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02725 virtual void OnResize(const gfx::Size& new_size,
[email protected]ee41e7d22011-10-14 19:34:09726 const gfx::Rect& resizer_rect,
[email protected]edc64de2011-11-17 20:07:38727 bool is_fullscreen) OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16728 virtual void WillInitiatePaint() OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38729 virtual void DidInitiatePaint() OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16730 virtual void DidFlushPaint() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02731 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
732 const gfx::Rect& paint_bounds,
733 TransportDIB** dib,
734 gfx::Rect* location,
[email protected]edc64de2011-11-17 20:07:38735 gfx::Rect* clip) OVERRIDE;
736 virtual gfx::Point GetScrollOffset() OVERRIDE;
737 virtual void DidHandleKeyEvent() OVERRIDE;
[email protected]67bfb83f2011-09-22 03:36:37738 virtual bool WillHandleMouseEvent(
739 const WebKit::WebMouseEvent& event) OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38740 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) OVERRIDE;
741 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) OVERRIDE;
742 virtual void OnSetFocus(bool enable) OVERRIDE;
743 virtual void OnWasHidden() OVERRIDE;
744 virtual void OnWasRestored(bool needs_repainting) OVERRIDE;
[email protected]65225772011-05-12 21:10:24745 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE;
[email protected]56ea1a62011-05-30 07:05:57746 virtual void OnImeSetComposition(
747 const string16& text,
748 const std::vector<WebKit::WebCompositionUnderline>& underlines,
749 int selection_start,
750 int selection_end) OVERRIDE;
[email protected]4de6d1692011-10-12 08:45:44751 virtual void OnImeConfirmComposition(
752 const string16& text, const ui::Range& replacement_range) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45753 virtual ui::TextInputType GetTextInputType() OVERRIDE;
[email protected]3f783362011-10-21 22:40:50754 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45755 virtual bool CanComposeInline() OVERRIDE;
[email protected]c3d45532011-10-07 19:20:40756 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02757
758 private:
[email protected]6e24cf12011-03-18 19:57:02759 // For unit tests.
760 friend class ExternalPopupMenuTest;
761 friend class PepperDeviceTest;
[email protected]2a84f9d2012-06-05 21:50:43762 friend class RendererAccessibilityTest;
[email protected]c6d068ff2011-10-14 17:28:23763 friend class content::RenderViewTest;
[email protected]6e24cf12011-03-18 19:57:02764
765 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
766 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
767 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]744c2a22012-03-15 18:42:04768 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI);
[email protected]068970d2011-10-11 00:05:16769 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
770 DontIgnoreBackAfterNavEntryLimit);
771 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
772 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
773 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
774 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
775 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
776 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeStateChanged);
777 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
778 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
779 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
[email protected]73eb2602012-02-09 19:50:55780 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
[email protected]068970d2011-10-11 00:05:16781 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
782 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
[email protected]6e24cf12011-03-18 19:57:02783#if defined(OS_MACOSX)
784 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
785#endif
[email protected]068970d2011-10-11 00:05:16786 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune);
[email protected]6e24cf12011-03-18 19:57:02787
[email protected]6e24cf12011-03-18 19:57:02788 typedef std::map<GURL, double> HostZoomLevels;
789
[email protected]6e24cf12011-03-18 19:57:02790 enum ErrorPageType {
791 DNS_ERROR,
792 HTTP_404,
793 CONNECTION_ERROR,
794 };
795
[email protected]310ebd6302011-10-10 19:06:28796 RenderViewImpl(gfx::NativeViewId parent_hwnd,
797 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31798 const content::RendererPreferences& renderer_prefs,
[email protected]6717bf272012-05-11 23:31:25799 const webkit_glue::WebPreferences& webkit_prefs,
[email protected]310ebd6302011-10-10 19:06:28800 SharedRenderViewCounter* counter,
801 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56802 int32 surface_id,
[email protected]310ebd6302011-10-10 19:06:28803 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46804 const string16& frame_name,
[email protected]14392a52012-05-02 20:28:44805 bool is_renderer_created,
806 bool swapped_out,
[email protected]6fd35b72012-03-01 19:46:41807 int32 next_page_id,
[email protected]468e4902012-05-23 01:49:31808 content::GuestToEmbedderChannel* guest_to_embedder_channel,
[email protected]3e3c4522012-04-13 21:16:29809 AccessibilityMode accessibility_mode);
[email protected]6e24cf12011-03-18 19:57:02810
811 // Do not delete directly. This class is reference counted.
[email protected]310ebd6302011-10-10 19:06:28812 virtual ~RenderViewImpl();
[email protected]6e24cf12011-03-18 19:57:02813
814 void UpdateURL(WebKit::WebFrame* frame);
[email protected]a49e10b2011-08-01 23:57:46815 void UpdateTitle(WebKit::WebFrame* frame, const string16& title,
816 WebKit::WebTextDirection title_direction);
[email protected]6e24cf12011-03-18 19:57:02817 void UpdateSessionHistory(WebKit::WebFrame* frame);
[email protected]6459800a2012-03-27 23:57:05818 void SendUpdateState(const WebKit::WebHistoryItem& item);
[email protected]6e24cf12011-03-18 19:57:02819
820 // Update current main frame's encoding and send it to browser window.
821 // Since we want to let users see the right encoding info from menu
822 // before finishing loading, we call the UpdateEncoding in
823 // a) function:DidCommitLoadForFrame. When this function is called,
824 // that means we have got first data. In here we try to get encoding
825 // of page if it has been specified in http header.
826 // b) function:DidReceiveTitle. When this function is called,
827 // that means we have got specified title. Because in most of webpages,
828 // title tags will follow meta tags. In here we try to get encoding of
829 // page if it has been specified in meta tag.
830 // c) function:DidFinishDocumentLoadForFrame. When this function is
831 // called, that means we have got whole html page. In here we should
832 // finally get right encoding of page.
833 void UpdateEncoding(WebKit::WebFrame* frame,
834 const std::string& encoding_name);
835
[email protected]ae5184d62011-10-06 19:25:58836 void OpenURL(WebKit::WebFrame* frame,
837 const GURL& url,
[email protected]445e1042011-12-03 21:03:15838 const content::Referrer& referrer,
[email protected]6e24cf12011-03-18 19:57:02839 WebKit::WebNavigationPolicy policy);
840
[email protected]be2510c02012-05-28 14:52:14841 bool RunJavaScriptMessage(content::JavaScriptMessageType type,
[email protected]4f5ce842011-05-27 19:34:41842 const string16& message,
843 const string16& default_value,
[email protected]6e24cf12011-03-18 19:57:02844 const GURL& frame_url,
[email protected]4f5ce842011-05-27 19:34:41845 string16* result);
[email protected]6e24cf12011-03-18 19:57:02846
847 // Sends a message and runs a nested message loop.
848 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
849
[email protected]dd6afca2011-08-13 03:44:31850 // Called when the "pinned to left/right edge" state needs to be updated.
851 void UpdateScrollState(WebKit::WebFrame* frame);
852
[email protected]6e24cf12011-03-18 19:57:02853 // IPC message handlers ------------------------------------------------------
854 //
855 // The documentation for these functions should be in
856 // render_messages_internal.h for the message that the function is handling.
857
[email protected]744c2a22012-03-15 18:42:04858 CONTENT_EXPORT void OnAllowBindings(int enabled_bindings_flags);
[email protected]6e24cf12011-03-18 19:57:02859 void OnAllowScriptToClose(bool script_can_close);
860 void OnAsyncFileOpened(base::PlatformFileError error_code,
861 IPC::PlatformFileForTransit file_for_transit,
862 int message_id);
[email protected]eb415bf0e2011-04-14 02:45:42863 void OnPpapiBrokerChannelCreated(int request_id,
[email protected]d54305072011-06-22 20:58:43864 const IPC::ChannelHandle& handle);
[email protected]6e24cf12011-03-18 19:57:02865 void OnCancelDownload(int32 download_id);
866 void OnClearFocusedNode();
[email protected]992db4c2011-05-12 15:37:15867 void OnClosePage();
[email protected]6e24cf12011-03-18 19:57:02868 void OnContextMenuClosed(
[email protected]35be7ec2012-02-12 20:42:51869 const content::CustomContextMenuContext& custom_context);
[email protected]6e24cf12011-03-18 19:57:02870 void OnCopy();
871 void OnCopyImageAt(int x, int y);
872#if defined(OS_MACOSX)
873 void OnCopyToFindPboard();
874#endif
875 void OnCut();
[email protected]318bf5802011-08-08 17:12:41876 void OnCSSInsertRequest(const string16& frame_xpath,
[email protected]01cf589c2011-07-28 18:04:03877 const std::string& css);
[email protected]6e24cf12011-03-18 19:57:02878 void OnCustomContextMenuAction(
[email protected]35be7ec2012-02-12 20:42:51879 const content::CustomContextMenuContext& custom_context,
[email protected]6e24cf12011-03-18 19:57:02880 unsigned action);
881 void OnDelete();
882 void OnDeterminePageLanguage();
883 void OnDisableScrollbarsForSmallWindows(
884 const gfx::Size& disable_scrollbars_size_limit);
885 void OnDisassociateFromPopupCount();
[email protected]6e24cf12011-03-18 19:57:02886 void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
887 const gfx::Point& screen_point,
888 bool ended,
889 WebKit::WebDragOperation drag_operation);
890 void OnDragSourceSystemDragEnded();
891 void OnDragTargetDrop(const gfx::Point& client_pt,
[email protected]1f2230b2012-05-17 23:43:42892 const gfx::Point& screen_pt,
893 int key_modifiers);
[email protected]6e24cf12011-03-18 19:57:02894 void OnDragTargetDragEnter(const WebDropData& drop_data,
895 const gfx::Point& client_pt,
896 const gfx::Point& screen_pt,
[email protected]1f2230b2012-05-17 23:43:42897 WebKit::WebDragOperationsMask operations_allowed,
898 int key_modifiers);
[email protected]6e24cf12011-03-18 19:57:02899 void OnDragTargetDragLeave();
900 void OnDragTargetDragOver(const gfx::Point& client_pt,
901 const gfx::Point& screen_pt,
[email protected]1f2230b2012-05-17 23:43:42902 WebKit::WebDragOperationsMask operations_allowed,
903 int key_modifiers);
[email protected]2bf834f2011-11-17 20:02:21904 void OnEnablePreferredSizeChangedMode();
[email protected]244ac1892011-12-02 17:04:47905 void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
[email protected]61e2b3cc2012-03-02 16:13:34906 void OnDisableAutoResize(const gfx::Size& new_size);
[email protected]600ea402011-04-12 00:01:51907 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths);
[email protected]6e24cf12011-03-18 19:57:02908 void OnExecuteEditCommand(const std::string& name, const std::string& value);
[email protected]fb11b6a42012-03-14 07:25:12909 void OnFileChooserResponse(
910 const std::vector<content::SelectedFileInfo>& files);
[email protected]6e24cf12011-03-18 19:57:02911 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
912 void OnFindReplyAck();
[email protected]18d5be92011-07-25 18:00:19913 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
914 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
915 const std::vector<GURL>& links,
916 const std::vector<FilePath>& local_paths,
917 const FilePath& local_directory_name);
[email protected]6e24cf12011-03-18 19:57:02918 void OnMediaPlayerActionAt(const gfx::Point& location,
919 const WebKit::WebMediaPlayerAction& action);
[email protected]77829642012-05-15 14:47:17920
921 // Screen has rotated. 0 = default (portrait), 90 = one turn right, and so on.
922 void OnOrientationChangeEvent(int orientation);
923
[email protected]81375e872012-01-11 21:40:36924 void OnPluginActionAt(const gfx::Point& location,
925 const WebKit::WebPluginAction& action);
[email protected]6e24cf12011-03-18 19:57:02926 void OnMoveOrResizeStarted();
[email protected]f3112a52011-09-30 23:47:49927 CONTENT_EXPORT void OnNavigate(const ViewMsg_Navigate_Params& params);
[email protected]6e24cf12011-03-18 19:57:02928 void OnPaste();
[email protected]44bf7002011-10-16 02:46:15929 void OnPasteAndMatchStyle();
[email protected]6e24cf12011-03-18 19:57:02930#if defined(OS_MACOSX)
931 void OnPluginImeCompositionCompleted(const string16& text, int plugin_id);
932#endif
[email protected]f546640b2012-05-15 00:03:49933 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params);
[email protected]6e24cf12011-03-18 19:57:02934 void OnRedo();
935 void OnReloadFrame();
936 void OnReplace(const string16& text);
[email protected]6e24cf12011-03-18 19:57:02937 void OnResetPageEncodingToDefault();
938 void OnScriptEvalRequest(const string16& frame_xpath,
939 const string16& jscript,
940 int id,
941 bool notify_result);
942 void OnSelectAll();
[email protected]4fb60142011-08-09 02:22:08943 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
[email protected]2a84f9d2012-06-05 21:50:43944 CONTENT_EXPORT void OnSetAccessibilityMode(AccessibilityMode new_mode);
[email protected]6e24cf12011-03-18 19:57:02945 void OnSetActive(bool active);
946 void OnSetAltErrorPageURL(const GURL& gurl);
947 void OnSetBackground(const SkBitmap& background);
[email protected]7a17bac02012-03-07 21:58:12948 void OnSetNavigationStartTime(
949 const base::TimeTicks& browser_navigation_start);
[email protected]6e24cf12011-03-18 19:57:02950 void OnSetWebUIProperty(const std::string& name, const std::string& value);
[email protected]c5d463e2012-03-15 21:05:56951 CONTENT_EXPORT void OnSetEditCommandsForNextKeyEvent(
952 const EditCommands& edit_commands);
[email protected]f3112a52011-09-30 23:47:49953 CONTENT_EXPORT void OnSetHistoryLengthAndPrune(int history_length,
954 int32 minimum_page_id);
[email protected]6e24cf12011-03-18 19:57:02955 void OnSetInitialFocus(bool reverse);
[email protected]54ca3ca892011-06-07 21:14:54956#if defined(OS_MACOSX)
957 void OnSetInLiveResize(bool in_live_resize);
958#endif
[email protected]333ec8d02011-09-16 18:59:19959 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
[email protected]6e24cf12011-03-18 19:57:02960 void OnSetPageEncoding(const std::string& encoding_name);
[email protected]daf82f82011-10-31 22:35:31961 void OnSetRendererPrefs(const content::RendererPreferences& renderer_prefs);
[email protected]6e24cf12011-03-18 19:57:02962#if defined(OS_MACOSX)
963 void OnSetWindowVisibility(bool visible);
964#endif
965 void OnSetZoomLevel(double zoom_level);
966 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
[email protected]8a5e0ca2011-08-25 06:30:47967 void OnExitFullscreen();
[email protected]6e24cf12011-03-18 19:57:02968 void OnShouldClose();
969 void OnStop();
[email protected]815dd9872011-11-23 18:40:30970 void OnStopFinding(content::StopFindAction action);
[email protected]73eb2602012-02-09 19:50:55971 CONTENT_EXPORT void OnSwapOut(const ViewMsg_SwapOut_Params& params);
[email protected]6e24cf12011-03-18 19:57:02972 void OnThemeChanged();
[email protected]6e24cf12011-03-18 19:57:02973 void OnUndo();
[email protected]6e24cf12011-03-18 19:57:02974 void OnUpdateTargetURLAck();
[email protected]6717bf272012-05-11 23:31:25975 CONTENT_EXPORT void OnUpdateWebPreferences(
976 const webkit_glue::WebPreferences& prefs);
[email protected]08bb1e722011-07-30 19:13:04977
[email protected]6e24cf12011-03-18 19:57:02978#if defined(OS_MACOSX)
979 void OnWindowFrameChanged(const gfx::Rect& window_frame,
980 const gfx::Rect& view_frame);
[email protected]c5d463e2012-03-15 21:05:56981 CONTENT_EXPORT void OnSelectPopupMenuItem(int selected_index);
[email protected]6e24cf12011-03-18 19:57:02982#endif
[email protected]24d2b172012-05-26 00:54:12983
984#if defined(OS_ANDROID)
985 void OnSelectPopupMenuItems(bool canceled,
986 const std::vector<int>& selected_indices);
987#endif
988
[email protected]54087fe2011-10-28 22:02:48989 void OnZoom(content::PageZoom zoom);
[email protected]47578fa02011-11-02 19:34:41990 void OnZoomFactor(content::PageZoom zoom, int zoom_center_x,
991 int zoom_center_y);
992
[email protected]5a7b15a2011-08-22 22:48:18993 void OnEnableViewSourceMode();
[email protected]6e24cf12011-03-18 19:57:02994
[email protected]64d0e192011-12-09 14:44:20995 void OnJavaBridgeInit();
[email protected]7f3c7af2011-10-20 22:52:51996
[email protected]6e24cf12011-03-18 19:57:02997 // Adding a new message handler? Please add it in alphabetical order above
998 // and put it in the same position in the .cc file.
999
1000 // Misc private functions ----------------------------------------------------
[email protected]47578fa02011-11-02 19:34:411001 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x,
1002 int zoom_center_y, float scaling_increment);
[email protected]6e24cf12011-03-18 19:57:021003
[email protected]6e24cf12011-03-18 19:57:021004 void AltErrorPageFinished(WebKit::WebFrame* frame,
1005 const WebKit::WebURLError& original_error,
1006 const std::string& html);
1007
[email protected]d812fd12011-05-27 23:05:071008 // Check whether the preferred size has changed.
[email protected]6e24cf12011-03-18 19:57:021009 void CheckPreferredSize();
1010
[email protected]273558fb2012-01-12 15:03:511011 void EnsureMediaStreamImpl();
1012
[email protected]5e56df82011-04-18 17:00:151013 // This callback is triggered when DownloadFavicon completes, either
1014 // succesfully or with a failure. See DownloadFavicon for more
1015 // details.
1016 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher,
1017 const SkBitmap& image);
[email protected]6e24cf12011-03-18 19:57:021018
[email protected]310ebd6302011-10-10 19:06:281019 // Requests to download a favicon image. When done, the RenderView is notified
1020 // by way of DidDownloadFavicon. Returns true if the request was successfully
1021 // started, false otherwise. id is used to uniquely identify the request and
1022 // passed back to the DidDownloadFavicon method. If the image has multiple
1023 // frames, the frame whose size is image_size is returned. If the image
1024 // doesn't have a frame at the specified size, the first is returned.
[email protected]5e56df82011-04-18 17:00:151025 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
[email protected]6e24cf12011-03-18 19:57:021026
[email protected]6e24cf12011-03-18 19:57:021027 GURL GetAlternateErrorPageURL(const GURL& failed_url,
1028 ErrorPageType error_type);
1029
1030 // Locates a sub frame with given xpath
[email protected]318bf5802011-08-08 17:12:411031 WebKit::WebFrame* GetChildFrame(const string16& frame_xpath) const;
[email protected]6e24cf12011-03-18 19:57:021032
[email protected]57b9396c2011-10-07 19:11:591033 // Returns the opener url if present, else an empty url.
1034 GURL GetOpenerUrl() const;
1035
[email protected]69ddf852012-02-21 23:21:311036 // Returns the URL being loaded by the given frame's request.
1037 GURL GetLoadingUrl(WebKit::WebFrame* frame) const;
1038
[email protected]6e24cf12011-03-18 19:57:021039 WebUIBindings* GetWebUIBindings();
1040
[email protected]6e24cf12011-03-18 19:57:021041 // Should only be called if this object wraps a PluginDocument.
1042 WebKit::WebPlugin* GetWebPluginFromPluginDocument();
1043
[email protected]d466b8a2011-07-15 21:48:031044 // Returns true if the |params| navigation is to an entry that has been
1045 // cropped due to a recent navigation the browser did not know about.
1046 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params,
1047 bool is_reload);
1048
[email protected]6e24cf12011-03-18 19:57:021049 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame,
1050 const WebKit::WebURLError& error,
1051 bool replace);
1052
[email protected]14392a52012-05-02 20:28:441053 // Make this RenderView show an empty, unscriptable page.
1054 void NavigateToSwappedOutURL();
1055
[email protected]007733c2011-11-17 00:34:071056 // If we initiated a navigation, this function will populate |document_state|
1057 // with the navigation information saved in OnNavigate().
[email protected]45d83a12012-04-06 22:57:571058 void PopulateDocumentStateFromPending(content::DocumentState* document_state);
1059
1060 // Returns a new NavigationState populated with the navigation information
1061 // saved in OnNavigate().
1062 content::NavigationState* CreateNavigationStateFromPending();
[email protected]007733c2011-11-17 00:34:071063
[email protected]5b52cd2f712012-03-28 02:12:481064 // Processes the command-line flags --enable-viewport and
1065 // --enable-fixed-layout[=w,h].
1066 void ProcessViewLayoutFlags(const CommandLine& command_line);
1067
[email protected]6e24cf12011-03-18 19:57:021068 // Starts nav_state_sync_timer_ if it isn't already running.
1069 void StartNavStateSyncTimerIfNecessary();
1070
1071 // Dispatches the current navigation state to the browser. Called on a
1072 // periodic timer so we don't send too many messages.
1073 void SyncNavigationState();
1074
[email protected]b781ff282011-08-20 06:19:361075 // Dispatches the current state of selection on the webpage to the browser if
1076 // it has changed.
1077 // TODO(varunjain): delete this method once we figure out how to keep
1078 // selection handles in sync with the webpage.
1079 void SyncSelectionIfRequired();
1080
[email protected]c4dabe452012-02-08 23:58:121081#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
[email protected]6e24cf12011-03-18 19:57:021082 void UpdateFontRenderingFromRendererPrefs();
1083#else
1084 void UpdateFontRenderingFromRendererPrefs() {}
1085#endif
1086
1087 // Update the target url and tell the browser that the target URL has changed.
1088 // If |url| is empty, show |fallback_url|.
1089 void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
1090
[email protected]6e24cf12011-03-18 19:57:021091 // ---------------------------------------------------------------------------
1092 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
1093 // it in the same order in the .cc file as it was in the header.
1094 // ---------------------------------------------------------------------------
1095
1096 // Settings ------------------------------------------------------------------
1097
[email protected]6717bf272012-05-11 23:31:251098 webkit_glue::WebPreferences webkit_preferences_;
[email protected]daf82f82011-10-31 22:35:311099 content::RendererPreferences renderer_preferences_;
[email protected]6e24cf12011-03-18 19:57:021100
[email protected]6e24cf12011-03-18 19:57:021101 HostZoomLevels host_zoom_levels_;
1102
1103 // Whether content state (such as form state, scroll position and page
1104 // contents) should be sent to the browser immediately. This is normally
1105 // false, but set to true by some tests.
1106 bool send_content_state_immediately_;
1107
[email protected]6e24cf12011-03-18 19:57:021108 // Bitwise-ORed set of extra bindings that have been enabled. See
1109 // BindingsPolicy for details.
1110 int enabled_bindings_;
1111
1112 // The alternate error page URL, if one exists.
1113 GURL alternate_error_page_url_;
1114
1115 // If true, we send IPC messages when |preferred_size_| changes.
1116 bool send_preferred_size_changes_;
1117
1118 // If non-empty, and |send_preferred_size_changes_| is true, disable drawing
1119 // scroll bars on windows smaller than this size. Used for windows that the
1120 // browser resizes to the size of the content, such as browser action popups.
1121 // If a render view is set to the minimum size of its content, webkit may add
1122 // scroll bars. This makes sense for fixed sized windows, but it does not
1123 // make sense when the size of the view was chosen to fit the content.
1124 // This setting ensures that no scroll bars are drawn. The size limit exists
1125 // because if the view grows beyond a size known to the browser, scroll bars
1126 // should be drawn.
1127 gfx::Size disable_scrollbars_size_limit_;
1128
[email protected]6e24cf12011-03-18 19:57:021129 // Loading state -------------------------------------------------------------
1130
1131 // True if the top level frame is currently being loaded.
1132 bool is_loading_;
1133
1134 // The gesture that initiated the current navigation.
1135 NavigationGesture navigation_gesture_;
1136
1137 // Used for popups.
1138 bool opened_by_user_gesture_;
1139 GURL creator_url_;
1140
1141 // Whether this RenderView was created by a frame that was suppressing its
1142 // opener. If so, we may want to load pages in a separate process. See
1143 // decidePolicyForNavigation for details.
1144 bool opener_suppressed_;
1145
1146 // If we are handling a top-level client-side redirect, this tracks the URL
1147 // of the page that initiated it. Specifically, when a load is committed this
1148 // is used to determine if that load originated from a client-side redirect.
1149 // It is empty if there is no top-level client-side redirect.
[email protected]445e1042011-12-03 21:03:151150 content::Referrer completed_client_redirect_src_;
[email protected]6e24cf12011-03-18 19:57:021151
[email protected]6e24cf12011-03-18 19:57:021152 // Holds state pertaining to a navigation that we initiated. This is held by
1153 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_
1154 // as a temporary holder for the state until the WebDataSource corresponding
1155 // to the new navigation is created. See DidCreateDataSource.
[email protected]007733c2011-11-17 00:34:071156 scoped_ptr<ViewMsg_Navigate_Params> pending_navigation_params_;
[email protected]6e24cf12011-03-18 19:57:021157
1158 // Timer used to delay the updating of nav state (see SyncNavigationState).
[email protected]310ebd6302011-10-10 19:06:281159 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
[email protected]6e24cf12011-03-18 19:57:021160
[email protected]6e24cf12011-03-18 19:57:021161 // Page IDs ------------------------------------------------------------------
[email protected]a813c8e2011-10-08 01:34:111162 // See documentation in content::RenderView.
[email protected]6e24cf12011-03-18 19:57:021163 int32 page_id_;
1164
1165 // Indicates the ID of the last page that we sent a FrameNavigate to the
1166 // browser for. This is used to determine if the most recent transition
1167 // generated a history entry (less than page_id_), or not (equal to or
1168 // greater than). Note that this will be greater than page_id_ if the user
1169 // goes back.
1170 int32 last_page_id_sent_to_browser_;
1171
[email protected]74ce1ad2011-12-16 21:51:461172 // The next available page ID to use for this RenderView. These IDs are
1173 // specific to a given RenderView and the frames within it.
1174 int32 next_page_id_;
[email protected]6e24cf12011-03-18 19:57:021175
[email protected]d466b8a2011-07-15 21:48:031176 // The offset of the current item in the history list.
1177 int history_list_offset_;
1178
1179 // The RenderView's current impression of the history length. This includes
1180 // any items that have committed in this process, but because of cross-process
1181 // navigations, the history may have some entries that were committed in other
1182 // processes. We won't know about them until the next navigation in this
1183 // process.
1184 int history_list_length_;
1185
1186 // The list of page IDs for each history item this RenderView knows about.
1187 // Some entries may be -1 if they were rendered by other processes or were
1188 // restored from a previous session. This lets us detect attempts to
1189 // navigate to stale entries that have been cropped from our history.
1190 std::vector<int32> history_page_ids_;
1191
[email protected]6e24cf12011-03-18 19:57:021192 // Page info -----------------------------------------------------------------
1193
1194 // The last gotten main frame's encoding.
1195 std::string last_encoding_name_;
1196
[email protected]6e24cf12011-03-18 19:57:021197 // UI state ------------------------------------------------------------------
1198
1199 // The state of our target_url transmissions. When we receive a request to
1200 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
1201 // comes back - if a new request comes in before the ACK, we store the new
1202 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
1203 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
1204 // revert to TARGET_INFLIGHT.
1205 //
1206 // We don't need a queue of URLs to send, as only the latest is useful.
1207 enum {
1208 TARGET_NONE,
1209 TARGET_INFLIGHT, // We have a request in-flight, waiting for an ACK
1210 TARGET_PENDING // INFLIGHT + we have a URL waiting to be sent
1211 } target_url_status_;
1212
1213 // The URL we show the user in the status bar. We use this to determine if we
1214 // want to send a new one (we do not need to send duplicates). It will be
1215 // equal to either |mouse_over_url_| or |focus_url_|, depending on which was
1216 // updated last.
1217 GURL target_url_;
1218
1219 // The URL the user's mouse is hovering over.
1220 GURL mouse_over_url_;
1221
1222 // The URL that has keyboard focus.
1223 GURL focus_url_;
1224
1225 // The next target URL we want to send to the browser.
1226 GURL pending_target_url_;
1227
[email protected]6e24cf12011-03-18 19:57:021228 // The text selection the last time DidChangeSelection got called.
[email protected]e99ef6f2011-10-16 01:13:001229 string16 selection_text_;
1230 size_t selection_text_offset_;
1231 ui::Range selection_range_;
[email protected]6e24cf12011-03-18 19:57:021232
1233 // View ----------------------------------------------------------------------
1234
[email protected]6e24cf12011-03-18 19:57:021235 // Cache the preferred size of the page in order to prevent sending the IPC
1236 // when layout() recomputes but doesn't actually change sizes.
1237 gfx::Size preferred_size_;
1238
[email protected]1e0c8e02011-05-25 07:49:371239 // Used to delay determining the preferred size (to avoid intermediate
1240 // states for the sizes).
[email protected]310ebd6302011-10-10 19:06:281241 base::OneShotTimer<RenderViewImpl> check_preferred_size_timer_;
[email protected]1e0c8e02011-05-25 07:49:371242
[email protected]dd6afca2011-08-13 03:44:311243 // These store the "is main frame is scrolled all the way to the left
1244 // or right" state that was last sent to the browser.
1245 bool cached_is_main_frame_pinned_to_left_;
1246 bool cached_is_main_frame_pinned_to_right_;
1247
1248 // These store the "has scrollbars" state last sent to the browser.
1249 bool cached_has_main_frame_horizontal_scrollbar_;
1250 bool cached_has_main_frame_vertical_scrollbar_;
1251
[email protected]6e24cf12011-03-18 19:57:021252#if defined(OS_MACOSX)
1253 // Track the fake plugin window handles allocated on the browser side for
1254 // the accelerated compositor and (currently) accelerated plugins so that
1255 // we can discard them when the view goes away.
1256 std::set<gfx::PluginWindowHandle> fake_plugin_window_handles_;
1257#endif
1258
[email protected]05a980d7a2012-02-07 22:16:421259 // When this view is composited, the context used for compositing may or may
1260 // not support the GL_CHROMIUM_swapbuffers_complete_callback extension. Since
1261 // querying for the existence of this extension is expensive we cache the
1262 // result. These are used to implement SupportsAsynchronousSwapBuffers().
1263 bool context_has_swapbuffers_complete_callback_;
1264 bool queried_for_swapbuffers_complete_callback_;
1265
[email protected]d0fb8a72012-03-10 18:54:521266 // Whether the WebGraphicsContext3D handed out by createGraphicsContext3D() a
1267 // WebGraphicsContext3DCommandBufferImpl. This is a HACK required by the fact
1268 // that there's no other way to tell whether webview()->graphicsContext3D()
1269 // has a ContentGLContext (and thus a CommandBufferProxy & associated
1270 // route_id) or not.
1271 bool context_is_web_graphics_context_3d_command_buffer_impl_;
1272
[email protected]6e24cf12011-03-18 19:57:021273 // Helper objects ------------------------------------------------------------
1274
[email protected]6e24cf12011-03-18 19:57:021275 RendererWebCookieJarImpl cookie_jar_;
1276
1277 // The next group of objects all implement RenderViewObserver, so are deleted
[email protected]310ebd6302011-10-10 19:06:281278 // along with the RenderView automatically. This is why we just store
1279 // weak references.
[email protected]6e24cf12011-03-18 19:57:021280
[email protected]6e24cf12011-03-18 19:57:021281 // Holds a reference to the service which provides desktop notifications.
1282 NotificationProvider* notification_provider_;
1283
1284 // The geolocation dispatcher attached to this view, lazily initialized.
1285 GeolocationDispatcher* geolocation_dispatcher_;
1286
[email protected]0d9989d2011-12-21 20:26:001287 // The intents host attached to this view. Not lazily initialized.
1288 WebIntentsHost* intents_host_;
[email protected]1ef93132011-09-16 18:33:471289
[email protected]6e24cf12011-03-18 19:57:021290 // The speech dispatcher attached to this view, lazily initialized.
[email protected]c52b2892012-03-07 11:01:021291 InputTagSpeechDispatcher* input_tag_speech_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021292
[email protected]64d09222012-05-25 10:10:341293 // The speech recognition dispatcher attached to this view, lazily
1294 // initialized.
1295 SpeechRecognitionDispatcher* speech_recognition_dispatcher_;
1296
[email protected]6e24cf12011-03-18 19:57:021297 // Device orientation dispatcher attached to this view; lazily initialized.
1298 DeviceOrientationDispatcher* device_orientation_dispatcher_;
1299
[email protected]273558fb2012-01-12 15:03:511300 // MediaStream dispatcher attached to this view; lazily initialized.
1301 MediaStreamDispatcher* media_stream_dispatcher_;
1302
[email protected]ab2c4732011-07-20 19:57:401303 // MediaStreamImpl attached to this view; lazily initialized.
[email protected]1bc65a42012-04-23 09:31:251304 MediaStreamImpl* media_stream_impl_;
[email protected]ab2c4732011-07-20 19:57:401305
[email protected]6e24cf12011-03-18 19:57:021306 // Dispatches all P2P socket used by the renderer.
[email protected]b3f8f9722011-08-25 20:56:071307 content::P2PSocketDispatcher* p2p_socket_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021308
[email protected]c5c1d6d2011-07-28 18:42:411309 DevToolsAgent* devtools_agent_;
1310
[email protected]2a84f9d2012-06-05 21:50:431311 // The current accessibility mode.
1312 AccessibilityMode accessibility_mode_;
1313
1314 // Only valid if |accessibility_mode_| is anything other than
1315 // AccessibilityModeOff.
1316 content::RendererAccessibility* renderer_accessibility_;
[email protected]063afcb2011-09-29 07:54:321317
[email protected]7f3c7af2011-10-20 22:52:511318 // Java Bridge dispatcher attached to this view; lazily initialized.
[email protected]7e9c5bb02012-05-14 13:58:311319 JavaBridgeDispatcher* java_bridge_dispatcher_;
[email protected]7f3c7af2011-10-20 22:52:511320
[email protected]217690d2012-01-27 07:33:111321 // Mouse Lock dispatcher attached to this view.
1322 MouseLockDispatcher* mouse_lock_dispatcher_;
1323
[email protected]6e24cf12011-03-18 19:57:021324 // Misc ----------------------------------------------------------------------
1325
1326 // The current and pending file chooser completion objects. If the queue is
1327 // nonempty, the first item represents the currently running file chooser
1328 // callback, and the remaining elements are the other file chooser completion
1329 // still waiting to be run (in order).
1330 struct PendingFileChooser;
1331 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_;
1332
[email protected]600ea402011-04-12 00:01:511333 // The current directory enumeration callback
1334 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_;
1335 int enumeration_completion_id_;
1336
[email protected]6e24cf12011-03-18 19:57:021337 // The SessionStorage namespace that we're assigned to has an ID, and that ID
1338 // is passed to us upon creation. WebKit asks for this ID upon first use and
1339 // uses it whenever asking the browser process to allocate new storage areas.
1340 int64 session_storage_namespace_id_;
1341
1342 // The total number of unrequested popups that exist and can be followed back
[email protected]310ebd6302011-10-10 19:06:281343 // to a common opener. This count is shared among all RenderViews created with
1344 // createView(). All popups are treated as unrequested until specifically
1345 // instructed otherwise by the Browser process.
[email protected]6e24cf12011-03-18 19:57:021346 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_;
1347
1348 // Whether this is a top level window (instead of a popup). Top level windows
1349 // shouldn't count against their own |shared_popup_counter_|.
1350 bool decrement_shared_popup_at_destruction_;
1351
1352 // If the browser hasn't sent us an ACK for the last FindReply we sent
1353 // to it, then we need to queue up the message (keeping only the most
1354 // recent message if new ones come in).
1355 scoped_ptr<IPC::Message> queued_find_reply_message_;
1356
1357 // Stores edit commands associated to the next key event.
1358 // Shall be cleared as soon as the next key event is processed.
1359 EditCommands edit_commands_;
1360
[email protected]6e24cf12011-03-18 19:57:021361 // Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS
1362 // object is only exposed when Web UI bindings are enabled.
1363 scoped_ptr<WebUIBindings> web_ui_bindings_;
1364
[email protected]6e24cf12011-03-18 19:57:021365 // The external popup for the currently showing select popup.
1366 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
1367
1368 // The node that the context menu was pressed over.
1369 WebKit::WebNode context_menu_node_;
1370
1371 // Reports load progress to the browser.
1372 scoped_ptr<LoadProgressTracker> load_progress_tracker_;
1373
1374 // All the registered observers. We expect this list to be small, so vector
1375 // is fine.
[email protected]3a034ebb2011-10-03 19:19:441376 ObserverList<content::RenderViewObserver> observers_;
[email protected]6e24cf12011-03-18 19:57:021377
[email protected]4fb60142011-08-09 02:22:081378 // Used to inform didChangeSelection() when it is called in the context
1379 // of handling a ViewMsg_SelectRange IPC.
1380 bool handling_select_range_;
1381
[email protected]217690d2012-01-27 07:33:111382 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
1383 scoped_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
1384
[email protected]2d7b82c2012-06-01 05:57:501385#if defined(OS_ANDROID)
1386 // The media player manager for managing all the media players on this view.
1387 scoped_ptr<webkit_media::WebMediaPlayerManagerAndroid> media_player_manager_;
1388#endif
1389
[email protected]ef5e98e2011-12-06 09:49:181390 // Plugins -------------------------------------------------------------------
1391
1392 // All the currently active plugin delegates for this RenderView; kept so
1393 // that we can enumerate them to send updates about things like window
1394 // location or tab focus and visibily. These are non-owning references.
1395 std::set<WebPluginDelegateProxy*> plugin_delegates_;
1396
1397#if defined(OS_WIN)
1398 // The ID of the focused NPAPI plug-in.
1399 int focused_plugin_id_;
1400#endif
1401
[email protected]766a7082012-02-03 23:39:151402 // Allows JS to access DOM automation. The JS object is only exposed when the
1403 // DOM automation bindings are enabled.
1404 scoped_ptr<DomAutomationController> dom_automation_controller_;
1405
[email protected]468e4902012-05-23 01:49:311406 // Channel for communication with embedding renderer, if it exists.
1407 scoped_refptr<content::GuestToEmbedderChannel> guest_to_embedder_channel_;
1408
1409 // The pepper instance identifer for this guest RenderView.
1410 PP_Instance guest_pp_instance_;
1411
1412 // The ppapi::HostResource associated with the on-screen context for this
1413 // guest RenderView.
1414 ppapi::HostResource guest_graphics_resource_;
1415
1416 // This graphics context is initialized once GuestReady() is called.
1417 WebGraphicsContext3DCommandBufferImpl* guest_uninitialized_context_;
1418
1419 // These are the attributes originally passed into createGraphicsContext3D
1420 // before the guest_to_embedder_channel was ready.
1421 WebKit::WebGraphicsContext3D::Attributes guest_attributes_;
[email protected]8cca3da2012-03-20 08:26:341422
[email protected]ef5e98e2011-12-06 09:49:181423 // NOTE: pepper_delegate_ should be last member because its constructor calls
1424 // AddObservers method of RenderViewImpl from c-tor.
[email protected]ca00e9162012-04-03 05:35:361425 content::PepperPluginDelegateImpl pepper_delegate_;
[email protected]ef5e98e2011-12-06 09:49:181426
[email protected]6e24cf12011-03-18 19:57:021427 // ---------------------------------------------------------------------------
1428 // ADDING NEW DATA? Please see if it fits appropriately in one of the above
1429 // sections rather than throwing it randomly at the end. If you're adding a
1430 // bunch of stuff, you should probably create a helper class and put your
[email protected]310ebd6302011-10-10 19:06:281431 // data and methods on that to avoid bloating RenderView more. You can
1432 // use the Observer interface to filter IPC messages and receive frame change
[email protected]6e24cf12011-03-18 19:57:021433 // notifications.
1434 // ---------------------------------------------------------------------------
1435
[email protected]310ebd6302011-10-10 19:06:281436 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
[email protected]6e24cf12011-03-18 19:57:021437};
1438
[email protected]310ebd6302011-10-10 19:06:281439#endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_