blob: 1b89c474c69714e99896b9f4879af79436d0c5bd [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>
11#include <queue>
12#include <set>
13#include <string>
14#include <vector>
15
[email protected]6e24cf12011-03-18 19:57:0216#include "base/basictypes.h"
17#include "base/gtest_prod_util.h"
18#include "base/id_map.h"
[email protected]3b63f8f42011-03-28 01:54:1519#include "base/memory/linked_ptr.h"
20#include "base/memory/weak_ptr.h"
[email protected]6e24cf12011-03-18 19:57:0221#include "base/observer_list.h"
22#include "base/timer.h"
[email protected]6e24cf12011-03-18 19:57:0223#include "build/build_config.h"
[email protected]8d128d62011-09-13 22:11:5724#include "content/common/content_export.h"
[email protected]55722152011-03-22 01:33:5325#include "content/common/edit_command.h"
[email protected]c26ad882012-02-07 06:41:2026#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
[email protected]6e24cf12011-03-18 19:57:0227#include "content/common/navigation_gesture.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"
34#include "content/renderer/renderer_webcookiejar_impl.h"
35#include "content/renderer/render_view_selection.h"
[email protected]6e24cf12011-03-18 19:57:0236#include "content/renderer/render_widget.h"
37#include "ipc/ipc_platform_file.h"
[email protected]e6e90dc2011-12-03 00:01:3738#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.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]42054a252011-05-17 18:02:1341#include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h"
[email protected]6e24cf12011-03-18 19:57:0242#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
[email protected]18d5be92011-07-25 18:00:1943#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClient.h"
[email protected]94dec932011-05-26 20:04:2144#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageVisibilityState.h"
[email protected]6e24cf12011-03-18 19:57:0245#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h"
46#include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h"
47#include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationType.h"
[email protected]7e8b4d12012-01-20 23:39:5148#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h"
[email protected]269f86d2011-12-07 02:43:4749#include "ui/base/javascript_message_type.h"
[email protected]b9b751f22011-03-25 14:04:1250#include "ui/gfx/surface/transport_dib.h"
[email protected]6e24cf12011-03-18 19:57:0251#include "webkit/glue/webpreferences.h"
[email protected]a9288f52011-11-17 05:18:1652#include "webkit/media/webmediaplayer_delegate.h"
[email protected]6e24cf12011-03-18 19:57:0253#include "webkit/plugins/npapi/webplugin_page_delegate.h"
54
[email protected]9f76c1e2012-03-05 15:15:5855#if defined(COMPILER_MSVC)
[email protected]310ebd6302011-10-10 19:06:2856// RenderViewImpl is a diamond-shaped hierarchy, with WebWidgetClient at the
57// root. VS warns when we inherit the WebWidgetClient method implementations
58// from RenderWidget. It's safe to ignore that warning.
[email protected]6e24cf12011-03-18 19:57:0259#pragma warning(disable: 4250)
60#endif
61
[email protected]6e24cf12011-03-18 19:57:0262class DeviceOrientationDispatcher;
[email protected]c5c1d6d2011-07-28 18:42:4163class DevToolsAgent;
[email protected]766a7082012-02-03 23:39:1564class DomAutomationController;
[email protected]55722152011-03-22 01:33:5365class ExternalPopupMenu;
[email protected]6e24cf12011-03-18 19:57:0266class GeolocationDispatcher;
[email protected]6e24cf12011-03-18 19:57:0267class GURL;
[email protected]7f3c7af2011-10-20 22:52:5168class JavaBridgeDispatcher;
[email protected]6e24cf12011-03-18 19:57:0269class LoadProgressTracker;
[email protected]273558fb2012-01-12 15:03:5170class MediaStreamDispatcher;
[email protected]ab2c4732011-07-20 19:57:4071class MediaStreamImpl;
[email protected]217690d2012-01-27 07:33:1172class MouseLockDispatcher;
[email protected]6e24cf12011-03-18 19:57:0273class NotificationProvider;
[email protected]6e24cf12011-03-18 19:57:0274class PepperDeviceTest;
[email protected]83f93d32011-11-11 00:43:3075struct PP_NetAddress_Private;
[email protected]ea192e82011-04-11 19:16:0276class RenderWidgetFullscreenPepper;
[email protected]063afcb2011-09-29 07:54:3277class RendererAccessibility;
[email protected]6e24cf12011-03-18 19:57:0278class SkBitmap;
[email protected]c52b2892012-03-07 11:01:0279class InputTagSpeechDispatcher;
[email protected]6e24cf12011-03-18 19:57:0280struct ViewMsg_Navigate_Params;
81struct ViewMsg_StopFinding_Params;
[email protected]83f93d32011-11-11 00:43:3082struct ViewMsg_SwapOut_Params;
[email protected]6e24cf12011-03-18 19:57:0283struct WebDropData;
[email protected]0d9989d2011-12-21 20:26:0084class WebIntentsHost;
[email protected]83f93d32011-11-11 00:43:3085class WebPluginDelegateProxy;
86class WebUIBindings;
[email protected]b3f8f9722011-08-25 20:56:0787
88namespace content {
[email protected]007733c2011-11-17 00:34:0789class DocumentState;
[email protected]b3f8f9722011-08-25 20:56:0790class P2PSocketDispatcher;
[email protected]3a034ebb2011-10-03 19:19:4491class RenderViewObserver;
[email protected]007733c2011-11-17 00:34:0792class RenderViewTest;
[email protected]35be7ec2012-02-12 20:42:5193struct CustomContextMenuContext;
[email protected]8caadeb2011-11-22 02:45:2394struct FileChooserParams;
[email protected]fb11b6a42012-03-14 07:25:1295struct SelectedFileInfo;
[email protected]b3f8f9722011-08-25 20:56:0796} // namespace content
[email protected]6e24cf12011-03-18 19:57:0297
[email protected]6e24cf12011-03-18 19:57:0298namespace gfx {
99class Point;
100class Rect;
[email protected]b3f8f9722011-08-25 20:56:07101} // namespace gfx
[email protected]6e24cf12011-03-18 19:57:02102
103namespace webkit {
104
[email protected]6e24cf12011-03-18 19:57:02105namespace ppapi {
[email protected]6e24cf12011-03-18 19:57:02106class PluginInstance;
[email protected]6e24cf12011-03-18 19:57:02107} // namespace ppapi
108
109} // namespace webkit
110
111namespace webkit_glue {
[email protected]6e24cf12011-03-18 19:57:02112class ImageResourceFetcher;
[email protected]6e24cf12011-03-18 19:57:02113class ResourceFetcher;
114}
115
116namespace WebKit {
[email protected]6e24cf12011-03-18 19:57:02117class WebApplicationCacheHost;
118class WebApplicationCacheHostClient;
119class WebDataSource;
[email protected]6e24cf12011-03-18 19:57:02120class WebDragData;
[email protected]6e24cf12011-03-18 19:57:02121class WebGeolocationClient;
[email protected]42054a252011-05-17 18:02:13122class WebIconURL;
[email protected]6e24cf12011-03-18 19:57:02123class WebImage;
[email protected]6e24cf12011-03-18 19:57:02124class WebMediaPlayer;
125class WebMediaPlayerClient;
126class WebMouseEvent;
[email protected]273558fb2012-01-12 15:03:51127class WebPeerConnectionHandler;
128class WebPeerConnectionHandlerClient;
[email protected]6e24cf12011-03-18 19:57:02129class WebSpeechInputController;
130class WebSpeechInputListener;
131class WebStorageNamespace;
[email protected]2d0f2e92011-10-03 09:02:24132class WebTouchEvent;
[email protected]b00ba702011-08-17 01:41:03133class WebURLLoader;
[email protected]6e24cf12011-03-18 19:57:02134class WebURLRequest;
[email protected]273558fb2012-01-12 15:03:51135class WebUserMediaClient;
[email protected]6e24cf12011-03-18 19:57:02136struct WebFileChooserParams;
137struct WebFindOptions;
138struct WebMediaPlayerAction;
[email protected]81375e872012-01-11 21:40:36139struct WebPluginAction;
[email protected]6e24cf12011-03-18 19:57:02140struct WebPoint;
141struct WebWindowFeatures;
142}
143
144// We need to prevent a page from trying to create infinite popups. It is not
145// as simple as keeping a count of the number of immediate children
146// popups. Having an html file that window.open()s itself would create
147// an unlimited chain of RenderViews who only have one RenderView child.
148//
149// Therefore, each new top level RenderView creates a new counter and shares it
[email protected]310ebd6302011-10-10 19:06:28150// with all its children and grandchildren popup RenderViewImpls created with
[email protected]6e24cf12011-03-18 19:57:02151// createView() to have a sort of global limit for the page so no more than
152// kMaximumNumberOfPopups popups are created.
153//
154// This is a RefCounted holder of an int because I can't say
155// scoped_refptr<int>.
156typedef base::RefCountedData<int> SharedRenderViewCounter;
157
158//
159// RenderView is an object that manages a WebView object, and provides a
160// communication interface with an embedding application process
161//
[email protected]310ebd6302011-10-10 19:06:28162class RenderViewImpl : public RenderWidget,
163 public WebKit::WebViewClient,
164 public WebKit::WebFrameClient,
165 public WebKit::WebPageSerializerClient,
166 public content::RenderView,
167 public webkit::npapi::WebPluginPageDelegate,
[email protected]a9288f52011-11-17 05:18:16168 public webkit_media::WebMediaPlayerDelegate,
[email protected]b3e83de2012-02-07 03:33:28169 public WebGraphicsContext3DSwapBuffersClient,
[email protected]310ebd6302011-10-10 19:06:28170 public base::SupportsWeakPtr<RenderViewImpl> {
[email protected]6e24cf12011-03-18 19:57:02171 public:
172 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the
[email protected]5f9de5882011-09-30 23:36:28173 // parent of the WebView HWND that will be created. If this is a blocked
[email protected]6e24cf12011-03-18 19:57:02174 // popup or as a new tab, opener_id is the routing ID of the RenderView
175 // responsible for creating this RenderView (corresponding to parent_hwnd).
176 // |counter| is either a currently initialized counter, or NULL (in which case
177 // we treat this RenderView as a top level window).
[email protected]310ebd6302011-10-10 19:06:28178 CONTENT_EXPORT static RenderViewImpl* Create(
[email protected]6e24cf12011-03-18 19:57:02179 gfx::NativeViewId parent_hwnd,
180 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31181 const content::RendererPreferences& renderer_prefs,
[email protected]6e24cf12011-03-18 19:57:02182 const WebPreferences& webkit_prefs,
183 SharedRenderViewCounter* counter,
184 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56185 int32 surface_id,
[email protected]6e24cf12011-03-18 19:57:02186 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46187 const string16& frame_name,
[email protected]6fd35b72012-03-01 19:46:41188 int32 next_page_id,
189 const WebKit::WebScreenInfo& screen_info);
[email protected]6e24cf12011-03-18 19:57:02190
[email protected]310ebd6302011-10-10 19:06:28191 // Returns the RenderViewImpl containing the given WebView.
192 CONTENT_EXPORT static RenderViewImpl* FromWebView(WebKit::WebView* webview);
[email protected]6e24cf12011-03-18 19:57:02193
[email protected]6e24cf12011-03-18 19:57:02194 // May return NULL when the view is closing.
[email protected]8d128d62011-09-13 22:11:57195 CONTENT_EXPORT WebKit::WebView* webview() const;
[email protected]6e24cf12011-03-18 19:57:02196
[email protected]b3e83de2012-02-07 03:33:28197 // WebGraphicsContext3DSwapBuffersClient implementation.
198
[email protected]65225772011-05-12 21:10:24199 // Called by a GraphicsContext associated with this view when swapbuffers
[email protected]37a6f302011-07-11 23:43:08200 // is posted, completes or is aborted.
[email protected]b3e83de2012-02-07 03:33:28201 virtual void OnViewContextSwapBuffersPosted() OVERRIDE;
202 virtual void OnViewContextSwapBuffersComplete() OVERRIDE;
203 virtual void OnViewContextSwapBuffersAborted() OVERRIDE;
[email protected]65225772011-05-12 21:10:24204
[email protected]d466b8a2011-07-15 21:48:03205 int history_list_offset() const { return history_list_offset_; }
[email protected]6e24cf12011-03-18 19:57:02206
[email protected]6e24cf12011-03-18 19:57:02207 const WebPreferences& webkit_preferences() const {
208 return webkit_preferences_;
209 }
210
211 void set_send_content_state_immediately(bool value) {
212 send_content_state_immediately_ = value;
213 }
214
[email protected]273558fb2012-01-12 15:03:51215 MediaStreamDispatcher* media_stream_dispatcher() {
216 return media_stream_dispatcher_;
217 }
218
[email protected]6e24cf12011-03-18 19:57:02219 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled.
[email protected]b3f8f9722011-08-25 20:56:07220 content::P2PSocketDispatcher* p2p_socket_dispatcher() {
[email protected]6e24cf12011-03-18 19:57:02221 return p2p_socket_dispatcher_;
222 }
223
[email protected]217690d2012-01-27 07:33:11224 MouseLockDispatcher* mouse_lock_dispatcher() {
225 return mouse_lock_dispatcher_;
226 }
227
[email protected]273558fb2012-01-12 15:03:51228 WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler(
229 WebKit::WebPeerConnectionHandlerClient* client);
230
[email protected]6e24cf12011-03-18 19:57:02231 // Functions to add and remove observers for this object.
[email protected]3a034ebb2011-10-03 19:19:44232 void AddObserver(content::RenderViewObserver* observer);
233 void RemoveObserver(content::RenderViewObserver* observer);
[email protected]6e24cf12011-03-18 19:57:02234
[email protected]6e24cf12011-03-18 19:57:02235 // Adds the given file chooser request to the file_chooser_completion_ queue
236 // (see that var for more) and requests the chooser be displayed if there are
237 // no other waiting items in the queue.
238 //
239 // Returns true if the chooser was successfully scheduled. False means we
240 // didn't schedule anything.
[email protected]8caadeb2011-11-22 02:45:23241 bool ScheduleFileChooser(const content::FileChooserParams& params,
[email protected]6e24cf12011-03-18 19:57:02242 WebKit::WebFileChooserCompletion* completion);
243
[email protected]6e24cf12011-03-18 19:57:02244 // Sets whether the renderer should report load progress to the browser.
245 void SetReportLoadProgressEnabled(bool enabled);
246
[email protected]a2ef54c2011-10-10 16:20:31247 void LoadNavigationErrorPage(
[email protected]8d128d62011-09-13 22:11:57248 WebKit::WebFrame* frame,
249 const WebKit::WebURLRequest& failed_request,
250 const WebKit::WebURLError& error,
251 const std::string& html,
252 bool replace);
[email protected]9966325b2011-04-18 05:00:10253
[email protected]6e24cf12011-03-18 19:57:02254 // Plugin-related functions --------------------------------------------------
255 // (See also WebPluginPageDelegate implementation.)
256
257 // Notification that the given plugin has crashed.
258 void PluginCrashed(const FilePath& plugin_path);
259
[email protected]6e24cf12011-03-18 19:57:02260 // Creates a fullscreen container for a pepper plugin instance.
[email protected]ea192e82011-04-11 19:16:02261 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
[email protected]6e24cf12011-03-18 19:57:02262 webkit::ppapi::PluginInstance* plugin);
263
[email protected]56ea1a62011-05-30 07:05:57264 // Informs the render view that a PPAPI plugin has gained or lost focus.
265 void PpapiPluginFocusChanged();
266
[email protected]73bf95812011-10-12 11:38:32267 // Informs the render view that a PPAPI plugin has changed text input status.
268 void PpapiPluginTextInputTypeChanged();
[email protected]3f783362011-10-21 22:40:50269 void PpapiPluginCaretPositionChanged();
[email protected]73bf95812011-10-12 11:38:32270
271 // Cancels current composition.
272 void PpapiPluginCancelComposition();
273
[email protected]3c8c74c2012-03-15 07:34:52274 // Informs the render view that a PPAPI plugin has changed selection.
275 void PpapiPluginSelectionChanged();
276
[email protected]b25b3ee2012-01-13 05:19:54277 // Retrieves the current caret position if a PPAPI plugin has focus.
278 bool GetPpapiPluginCaretBounds(gfx::Rect* rect);
279
[email protected]e6ae0f6c2011-10-04 10:39:23280#if defined(OS_MACOSX) || defined(OS_WIN)
[email protected]6e24cf12011-03-18 19:57:02281 // Informs the render view that the given plugin has gained or lost focus.
282 void PluginFocusChanged(bool focused, int plugin_id);
[email protected]e6ae0f6c2011-10-04 10:39:23283#endif
[email protected]6e24cf12011-03-18 19:57:02284
[email protected]e6ae0f6c2011-10-04 10:39:23285#if defined(OS_MACOSX)
[email protected]6e24cf12011-03-18 19:57:02286 // Starts plugin IME.
287 void StartPluginIme();
288
289 // Helper routines for accelerated plugin support. Used by the
290 // WebPluginDelegateProxy, which has a pointer to the RenderView.
291 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque,
292 bool root);
293 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle window);
294 void AcceleratedSurfaceSetIOSurface(gfx::PluginWindowHandle window,
295 int32 width,
296 int32 height,
297 uint64 io_surface_identifier);
298 TransportDIB::Handle AcceleratedSurfaceAllocTransportDIB(size_t size);
299 void AcceleratedSurfaceFreeTransportDIB(TransportDIB::Id dib_id);
300 void AcceleratedSurfaceSetTransportDIB(gfx::PluginWindowHandle window,
301 int32 width,
302 int32 height,
303 TransportDIB::Handle transport_dib);
304 void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
305 uint64 surface_id);
306#endif
307
308 void RegisterPluginDelegate(WebPluginDelegateProxy* delegate);
309 void UnregisterPluginDelegate(WebPluginDelegateProxy* delegate);
310
[email protected]4a7d6392011-09-19 20:55:08311 // Helper function to retrieve information about a plugin for a URL and mime
312 // type. Returns false if no plugin was found.
313 // |actual_mime_type| is the actual mime type supported by the
314 // plugin found that match the URL given (one for each item in
315 // |info|).
[email protected]84c13c032011-09-23 00:12:22316 CONTENT_EXPORT bool GetPluginInfo(const GURL& url,
317 const GURL& page_url,
318 const std::string& mime_type,
319 webkit::WebPluginInfo* plugin_info,
320 std::string* actual_mime_type);
[email protected]4a7d6392011-09-19 20:55:08321
[email protected]6e24cf12011-03-18 19:57:02322 // IPC::Channel::Listener implementation -------------------------------------
323
[email protected]edc64de2011-11-17 20:07:38324 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02325
326 // WebKit::WebWidgetClient implementation ------------------------------------
327
328 // Most methods are handled by RenderWidget.
329 virtual void didFocus();
330 virtual void didBlur();
331 virtual void show(WebKit::WebNavigationPolicy policy);
332 virtual void runModal();
[email protected]2b624c562011-10-27 22:58:26333 virtual bool enterFullScreen();
334 virtual void exitFullScreen();
[email protected]217690d2012-01-27 07:33:11335 virtual bool requestPointerLock();
336 virtual void requestPointerUnlock();
337 virtual bool isPointerLocked();
[email protected]6e24cf12011-03-18 19:57:02338
339 // WebKit::WebViewClient implementation --------------------------------------
340
341 virtual WebKit::WebView* createView(
342 WebKit::WebFrame* creator,
343 const WebKit::WebURLRequest& request,
344 const WebKit::WebWindowFeatures& features,
[email protected]916dfb62012-03-05 03:39:37345 const WebKit::WebString& frame_name,
346 WebKit::WebNavigationPolicy policy);
[email protected]6e24cf12011-03-18 19:57:02347 virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
348 virtual WebKit::WebWidget* createPopupMenu(
349 const WebKit::WebPopupMenuInfo& info);
350 virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
351 const WebKit::WebPopupMenuInfo& popup_menu_info,
352 WebKit::WebExternalPopupMenuClient* popup_menu_client);
353 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
354 unsigned quota);
[email protected]7e8b4d12012-01-20 23:39:51355 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(
[email protected]40ec0c12012-03-08 12:34:40356 const WebKit::WebGraphicsContext3D::Attributes& attributes);
357 // TODO(jamesr): remove this form once removed upstream.
358 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(
[email protected]01e69032012-01-31 05:39:06359 const WebKit::WebGraphicsContext3D::Attributes& attributes,
[email protected]7e8b4d12012-01-20 23:39:51360 bool direct);
[email protected]6e24cf12011-03-18 19:57:02361 virtual void didAddMessageToConsole(
362 const WebKit::WebConsoleMessage& message,
363 const WebKit::WebString& source_name,
364 unsigned source_line);
365 virtual void printPage(WebKit::WebFrame* frame);
366 virtual WebKit::WebNotificationPresenter* notificationPresenter();
[email protected]8a58c1c2011-04-19 18:40:12367 virtual bool enumerateChosenDirectory(
368 const WebKit::WebString& path,
369 WebKit::WebFileChooserCompletion* chooser_completion);
[email protected]6e24cf12011-03-18 19:57:02370 virtual void didStartLoading();
371 virtual void didStopLoading();
372 virtual void didChangeLoadProgress(WebKit::WebFrame* frame,
373 double load_progress);
374 virtual bool isSmartInsertDeleteEnabled();
375 virtual bool isSelectTrailingWhitespaceEnabled();
376 virtual void didChangeSelection(bool is_selection_empty);
377 virtual void didExecuteCommand(const WebKit::WebString& command_name);
378 virtual bool handleCurrentKeyboardEvent();
[email protected]6e24cf12011-03-18 19:57:02379 virtual bool runFileChooser(
380 const WebKit::WebFileChooserParams& params,
381 WebKit::WebFileChooserCompletion* chooser_completion);
382 virtual void runModalAlertDialog(WebKit::WebFrame* frame,
383 const WebKit::WebString& message);
384 virtual bool runModalConfirmDialog(WebKit::WebFrame* frame,
385 const WebKit::WebString& message);
386 virtual bool runModalPromptDialog(WebKit::WebFrame* frame,
387 const WebKit::WebString& message,
388 const WebKit::WebString& default_value,
389 WebKit::WebString* actual_value);
390 virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame* frame,
391 const WebKit::WebString& message);
392 virtual void showContextMenu(WebKit::WebFrame* frame,
393 const WebKit::WebContextMenuData& data);
[email protected]2b624c562011-10-27 22:58:26394 virtual void enterFullscreen();
395 virtual void exitFullscreen();
[email protected]6e24cf12011-03-18 19:57:02396 virtual void setStatusText(const WebKit::WebString& text);
397 virtual void setMouseOverURL(const WebKit::WebURL& url);
398 virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
[email protected]6e24cf12011-03-18 19:57:02399 virtual void startDragging(const WebKit::WebDragData& data,
400 WebKit::WebDragOperationsMask mask,
401 const WebKit::WebImage& image,
402 const WebKit::WebPoint& imageOffset);
403 virtual bool acceptsLoadDrops();
404 virtual void focusNext();
405 virtual void focusPrevious();
406 virtual void focusedNodeChanged(const WebKit::WebNode& node);
[email protected]169d4282011-11-30 19:33:59407 virtual void didUpdateLayout();
[email protected]6e24cf12011-03-18 19:57:02408 virtual void navigateBackForwardSoon(int offset);
409 virtual int historyBackListCount();
410 virtual int historyForwardListCount();
411 virtual void postAccessibilityNotification(
412 const WebKit::WebAccessibilityObject& obj,
413 WebKit::WebAccessibilityNotification notification);
414 virtual void didUpdateInspectorSetting(const WebKit::WebString& key,
415 const WebKit::WebString& value);
416 virtual WebKit::WebGeolocationClient* geolocationClient();
417 virtual WebKit::WebSpeechInputController* speechInputController(
418 WebKit::WebSpeechInputListener* listener);
419 virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient();
420 virtual void zoomLimitsChanged(double minimum_level, double maximum_level);
421 virtual void zoomLevelChanged();
422 virtual void registerProtocolHandler(const WebKit::WebString& scheme,
423 const WebKit::WebString& base_url,
424 const WebKit::WebString& url,
425 const WebKit::WebString& title);
[email protected]94dec932011-05-26 20:04:21426 virtual WebKit::WebPageVisibilityState visibilityState() const;
[email protected]273558fb2012-01-12 15:03:51427 virtual WebKit::WebUserMediaClient* userMediaClient();
[email protected]6e24cf12011-03-18 19:57:02428
429 // WebKit::WebFrameClient implementation -------------------------------------
430
431 virtual WebKit::WebPlugin* createPlugin(
432 WebKit::WebFrame* frame,
433 const WebKit::WebPluginParams& params);
[email protected]6e24cf12011-03-18 19:57:02434 virtual WebKit::WebSharedWorker* createSharedWorker(
435 WebKit::WebFrame* frame, const WebKit::WebURL& url,
436 const WebKit::WebString& name, unsigned long long documentId);
437 virtual WebKit::WebMediaPlayer* createMediaPlayer(
438 WebKit::WebFrame* frame,
439 WebKit::WebMediaPlayerClient* client);
440 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
441 WebKit::WebFrame* frame,
442 WebKit::WebApplicationCacheHostClient* client);
443 virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame);
444 virtual void frameDetached(WebKit::WebFrame* frame);
445 virtual void willClose(WebKit::WebFrame* frame);
[email protected]6e24cf12011-03-18 19:57:02446 virtual void loadURLExternally(WebKit::WebFrame* frame,
447 const WebKit::WebURLRequest& request,
448 WebKit::WebNavigationPolicy policy);
[email protected]0622875ab2011-07-27 12:10:34449 virtual void loadURLExternally(WebKit::WebFrame* frame,
450 const WebKit::WebURLRequest& request,
451 WebKit::WebNavigationPolicy policy,
452 const WebKit::WebString& suggested_name);
[email protected]6e24cf12011-03-18 19:57:02453 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
454 WebKit::WebFrame* frame,
455 const WebKit::WebURLRequest& request,
456 WebKit::WebNavigationType type,
457 const WebKit::WebNode&,
458 WebKit::WebNavigationPolicy default_policy,
459 bool is_redirect);
460 virtual bool canHandleRequest(WebKit::WebFrame* frame,
461 const WebKit::WebURLRequest& request);
462 virtual WebKit::WebURLError cannotHandleRequestError(
463 WebKit::WebFrame* frame,
464 const WebKit::WebURLRequest& request);
465 virtual WebKit::WebURLError cancelledError(
466 WebKit::WebFrame* frame,
467 const WebKit::WebURLRequest& request);
468 virtual void unableToImplementPolicyWithError(
469 WebKit::WebFrame* frame,
470 const WebKit::WebURLError& error);
471 virtual void willSendSubmitEvent(WebKit::WebFrame* frame,
472 const WebKit::WebFormElement& form);
473 virtual void willSubmitForm(WebKit::WebFrame* frame,
474 const WebKit::WebFormElement& form);
475 virtual void willPerformClientRedirect(WebKit::WebFrame* frame,
476 const WebKit::WebURL& from,
477 const WebKit::WebURL& to,
478 double interval,
479 double fire_time);
480 virtual void didCancelClientRedirect(WebKit::WebFrame* frame);
481 virtual void didCompleteClientRedirect(WebKit::WebFrame* frame,
482 const WebKit::WebURL& from);
483 virtual void didCreateDataSource(WebKit::WebFrame* frame,
484 WebKit::WebDataSource* datasource);
485 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame);
486 virtual void didReceiveServerRedirectForProvisionalLoad(
487 WebKit::WebFrame* frame);
488 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame,
489 const WebKit::WebURLError& error);
490 virtual void didReceiveDocumentData(WebKit::WebFrame* frame,
491 const char* data, size_t length,
492 bool& prevent_default);
493 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame,
494 bool is_new_navigation);
495 virtual void didClearWindowObject(WebKit::WebFrame* frame);
496 virtual void didCreateDocumentElement(WebKit::WebFrame* frame);
497 virtual void didReceiveTitle(WebKit::WebFrame* frame,
[email protected]a3bc4d12011-04-20 17:22:21498 const WebKit::WebString& title,
499 WebKit::WebTextDirection direction);
[email protected]42054a252011-05-17 18:02:13500 virtual void didChangeIcon(WebKit::WebFrame*,
501 WebKit::WebIconURL::Type) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02502 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame);
503 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame);
504 virtual void didFailLoad(WebKit::WebFrame* frame,
505 const WebKit::WebURLError& error);
506 virtual void didFinishLoad(WebKit::WebFrame* frame);
507 virtual void didNavigateWithinPage(WebKit::WebFrame* frame,
508 bool is_new_navigation);
509 virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame);
510 virtual void assignIdentifierToRequest(WebKit::WebFrame* frame,
511 unsigned identifier,
512 const WebKit::WebURLRequest& request);
513 virtual void willSendRequest(WebKit::WebFrame* frame,
514 unsigned identifier,
515 WebKit::WebURLRequest& request,
516 const WebKit::WebURLResponse& redirect_response);
517 virtual void didReceiveResponse(WebKit::WebFrame* frame,
518 unsigned identifier,
519 const WebKit::WebURLResponse& response);
520 virtual void didFinishResourceLoad(WebKit::WebFrame* frame,
521 unsigned identifier);
522 virtual void didFailResourceLoad(WebKit::WebFrame* frame,
523 unsigned identifier,
524 const WebKit::WebURLError& error);
525 virtual void didLoadResourceFromMemoryCache(
526 WebKit::WebFrame* frame,
527 const WebKit::WebURLRequest& request,
528 const WebKit::WebURLResponse&);
529 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame);
530 virtual void didRunInsecureContent(
531 WebKit::WebFrame* frame,
532 const WebKit::WebSecurityOrigin& origin,
533 const WebKit::WebURL& target);
[email protected]b00ba702011-08-17 01:41:03534 virtual void didAdoptURLLoader(WebKit::WebURLLoader* loader);
[email protected]6e24cf12011-03-18 19:57:02535 virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame* frame);
[email protected]5bc10932011-09-21 21:03:30536 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
537 v8::Handle<v8::Context>,
[email protected]a00fe692012-02-27 05:52:58538 int extension_group,
539 int world_id);
540 // TODO(koz): Remove once WebKit no longer calls this.
541 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
542 v8::Handle<v8::Context>,
[email protected]5bc10932011-09-21 21:03:30543 int world_id);
544 virtual void willReleaseScriptContext(WebKit::WebFrame* frame,
545 v8::Handle<v8::Context>,
546 int world_id);
[email protected]6e24cf12011-03-18 19:57:02547 virtual void didChangeScrollOffset(WebKit::WebFrame* frame);
[email protected]dd6afca2011-08-13 03:44:31548 virtual void numberOfWheelEventHandlersChanged(unsigned num_handlers);
[email protected]ea931252012-02-15 22:01:03549 virtual void numberOfTouchEventHandlersChanged(unsigned num_handlers);
[email protected]dd6afca2011-08-13 03:44:31550 virtual void didChangeContentsSize(WebKit::WebFrame* frame,
551 const WebKit::WebSize& size);
[email protected]6e24cf12011-03-18 19:57:02552 virtual void reportFindInPageMatchCount(int request_id,
553 int count,
554 bool final_update);
555 virtual void reportFindInPageSelection(int request_id,
556 int active_match_ordinal,
557 const WebKit::WebRect& sel);
558
559 virtual void openFileSystem(WebKit::WebFrame* frame,
560 WebKit::WebFileSystem::Type type,
561 long long size,
562 bool create,
563 WebKit::WebFileSystemCallbacks* callbacks);
564
[email protected]10e5cf12011-04-13 04:10:40565 virtual void queryStorageUsageAndQuota(
566 WebKit::WebFrame* frame,
567 WebKit::WebStorageQuotaType type,
568 WebKit::WebStorageQuotaCallbacks* callbacks);
569
570 virtual void requestStorageQuota(
571 WebKit::WebFrame* frame,
572 WebKit::WebStorageQuotaType type,
573 unsigned long long requested_size,
574 WebKit::WebStorageQuotaCallbacks* callbacks);
575
[email protected]8b5af492011-11-28 21:50:58576 virtual void registerIntentService(
577 WebKit::WebFrame* frame,
578 const WebKit::WebIntentServiceInfo& service);
579 virtual void dispatchIntent(WebKit::WebFrame* frame,
[email protected]ffc8bed2012-01-21 01:23:15580 const WebKit::WebIntentRequest& intentRequest);
[email protected]8b5af492011-11-28 21:50:58581
[email protected]18d5be92011-07-25 18:00:19582 // WebKit::WebPageSerializerClient implementation ----------------------------
583
584 virtual void didSerializeDataForFrame(
585 const WebKit::WebURL& frame_url,
586 const WebKit::WebCString& data,
587 PageSerializationStatus status) OVERRIDE;
588
[email protected]a2ef54c2011-10-10 16:20:31589 // content::RenderView implementation ----------------------------------------
590
591 virtual bool Send(IPC::Message* message) OVERRIDE;
[email protected]9f76c1e2012-03-05 15:15:58592 virtual int GetRoutingID() const OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31593 virtual int GetPageId() OVERRIDE;
594 virtual gfx::Size GetSize() OVERRIDE;
595 virtual gfx::NativeViewId GetHostWindow() OVERRIDE;
596 virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
597 virtual WebKit::WebView* GetWebView() OVERRIDE;
598 virtual WebKit::WebNode GetFocusedNode() const OVERRIDE;
599 virtual WebKit::WebNode GetContextMenuNode() const OVERRIDE;
600 virtual bool IsEditableNode(const WebKit::WebNode& node) OVERRIDE;
601 virtual WebKit::WebPlugin* CreatePlugin(
602 WebKit::WebFrame* frame,
603 const webkit::WebPluginInfo& info,
604 const WebKit::WebPluginParams& params) OVERRIDE;
605 virtual void EvaluateScript(const string16& frame_xpath,
606 const string16& jscript,
607 int id,
608 bool notify_result) OVERRIDE;
609 virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE;
610 virtual int GetEnabledBindings() OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31611 virtual bool GetContentStateImmediately() OVERRIDE;
612 virtual float GetFilteredTimePerFrame() OVERRIDE;
613 virtual void ShowContextMenu(WebKit::WebFrame* frame,
614 const WebKit::WebContextMenuData& data) OVERRIDE;
615 virtual WebKit::WebPageVisibilityState GetVisibilityState() const OVERRIDE;
616 virtual void RunModalAlertDialog(WebKit::WebFrame* frame,
617 const WebKit::WebString& message) OVERRIDE;
618 virtual void LoadURLExternally(
619 WebKit::WebFrame* frame,
620 const WebKit::WebURLRequest& request,
621 WebKit::WebNavigationPolicy policy) OVERRIDE;
622
[email protected]6e24cf12011-03-18 19:57:02623 // webkit_glue::WebPluginPageDelegate implementation -------------------------
624
625 virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
626 const FilePath& file_path,
[email protected]edc64de2011-11-17 20:07:38627 const std::string& mime_type) OVERRIDE;
628 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
629 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
630 virtual void DidMovePlugin(
631 const webkit::npapi::WebPluginGeometry& move) OVERRIDE;
632 virtual void DidStartLoadingForPlugin() OVERRIDE;
633 virtual void DidStopLoadingForPlugin() OVERRIDE;
634 virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02635
[email protected]a9288f52011-11-17 05:18:16636 // webkit_media::WebMediaPlayerDelegate implementation -----------------------
[email protected]baff4512011-10-19 18:21:07637
[email protected]a9288f52011-11-17 05:18:16638 virtual void DidPlay(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
639 virtual void DidPause(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
640 virtual void PlayerGone(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
[email protected]baff4512011-10-19 18:21:07641
[email protected]6e24cf12011-03-18 19:57:02642 // Please do not add your stuff randomly to the end here. If there is an
643 // appropriate section, add it there. If not, there are some random functions
644 // nearer to the top you can add it to.
[email protected]6e24cf12011-03-18 19:57:02645
[email protected]38b592902011-04-16 02:08:42646 // Cannot use std::set unfortunately since linked_ptr<> does not support
647 // operator<.
648 typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> >
649 ImageResourceFetcherList;
650
[email protected]6e24cf12011-03-18 19:57:02651 protected:
652 // RenderWidget overrides:
[email protected]edc64de2011-11-17 20:07:38653 virtual void Close() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02654 virtual void OnResize(const gfx::Size& new_size,
[email protected]ee41e7d22011-10-14 19:34:09655 const gfx::Rect& resizer_rect,
[email protected]edc64de2011-11-17 20:07:38656 bool is_fullscreen) OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16657 virtual void WillInitiatePaint() OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38658 virtual void DidInitiatePaint() OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16659 virtual void DidFlushPaint() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02660 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
661 const gfx::Rect& paint_bounds,
662 TransportDIB** dib,
663 gfx::Rect* location,
[email protected]edc64de2011-11-17 20:07:38664 gfx::Rect* clip) OVERRIDE;
665 virtual gfx::Point GetScrollOffset() OVERRIDE;
666 virtual void DidHandleKeyEvent() OVERRIDE;
[email protected]67bfb83f2011-09-22 03:36:37667 virtual bool WillHandleMouseEvent(
668 const WebKit::WebMouseEvent& event) OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38669 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) OVERRIDE;
670 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) OVERRIDE;
671 virtual void OnSetFocus(bool enable) OVERRIDE;
672 virtual void OnWasHidden() OVERRIDE;
673 virtual void OnWasRestored(bool needs_repainting) OVERRIDE;
[email protected]65225772011-05-12 21:10:24674 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE;
[email protected]56ea1a62011-05-30 07:05:57675 virtual void OnImeSetComposition(
676 const string16& text,
677 const std::vector<WebKit::WebCompositionUnderline>& underlines,
678 int selection_start,
679 int selection_end) OVERRIDE;
[email protected]4de6d1692011-10-12 08:45:44680 virtual void OnImeConfirmComposition(
681 const string16& text, const ui::Range& replacement_range) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45682 virtual ui::TextInputType GetTextInputType() OVERRIDE;
[email protected]3f783362011-10-21 22:40:50683 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45684 virtual bool CanComposeInline() OVERRIDE;
[email protected]c3d45532011-10-07 19:20:40685 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02686
687 private:
[email protected]6e24cf12011-03-18 19:57:02688 // For unit tests.
689 friend class ExternalPopupMenuTest;
690 friend class PepperDeviceTest;
[email protected]c6d068ff2011-10-14 17:28:23691 friend class content::RenderViewTest;
[email protected]6e24cf12011-03-18 19:57:02692
693 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
694 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
695 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]744c2a22012-03-15 18:42:04696 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI);
[email protected]068970d2011-10-11 00:05:16697 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
698 DontIgnoreBackAfterNavEntryLimit);
699 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
700 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
701 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
702 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
703 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
704 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeStateChanged);
705 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
706 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
707 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
[email protected]73eb2602012-02-09 19:50:55708 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
[email protected]068970d2011-10-11 00:05:16709 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
710 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
[email protected]6e24cf12011-03-18 19:57:02711#if defined(OS_MACOSX)
712 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
713#endif
[email protected]068970d2011-10-11 00:05:16714 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune);
[email protected]6e24cf12011-03-18 19:57:02715
[email protected]6e24cf12011-03-18 19:57:02716 typedef std::map<GURL, double> HostZoomLevels;
717
[email protected]6e24cf12011-03-18 19:57:02718 enum ErrorPageType {
719 DNS_ERROR,
720 HTTP_404,
721 CONNECTION_ERROR,
722 };
723
[email protected]310ebd6302011-10-10 19:06:28724 RenderViewImpl(gfx::NativeViewId parent_hwnd,
725 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31726 const content::RendererPreferences& renderer_prefs,
[email protected]310ebd6302011-10-10 19:06:28727 const WebPreferences& webkit_prefs,
728 SharedRenderViewCounter* counter,
729 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56730 int32 surface_id,
[email protected]310ebd6302011-10-10 19:06:28731 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46732 const string16& frame_name,
[email protected]6fd35b72012-03-01 19:46:41733 int32 next_page_id,
734 const WebKit::WebScreenInfo& screen_info);
[email protected]6e24cf12011-03-18 19:57:02735
736 // Do not delete directly. This class is reference counted.
[email protected]310ebd6302011-10-10 19:06:28737 virtual ~RenderViewImpl();
[email protected]6e24cf12011-03-18 19:57:02738
739 void UpdateURL(WebKit::WebFrame* frame);
[email protected]a49e10b2011-08-01 23:57:46740 void UpdateTitle(WebKit::WebFrame* frame, const string16& title,
741 WebKit::WebTextDirection title_direction);
[email protected]6e24cf12011-03-18 19:57:02742 void UpdateSessionHistory(WebKit::WebFrame* frame);
743
744 // Update current main frame's encoding and send it to browser window.
745 // Since we want to let users see the right encoding info from menu
746 // before finishing loading, we call the UpdateEncoding in
747 // a) function:DidCommitLoadForFrame. When this function is called,
748 // that means we have got first data. In here we try to get encoding
749 // of page if it has been specified in http header.
750 // b) function:DidReceiveTitle. When this function is called,
751 // that means we have got specified title. Because in most of webpages,
752 // title tags will follow meta tags. In here we try to get encoding of
753 // page if it has been specified in meta tag.
754 // c) function:DidFinishDocumentLoadForFrame. When this function is
755 // called, that means we have got whole html page. In here we should
756 // finally get right encoding of page.
757 void UpdateEncoding(WebKit::WebFrame* frame,
758 const std::string& encoding_name);
759
[email protected]ae5184d62011-10-06 19:25:58760 void OpenURL(WebKit::WebFrame* frame,
761 const GURL& url,
[email protected]445e1042011-12-03 21:03:15762 const content::Referrer& referrer,
[email protected]6e24cf12011-03-18 19:57:02763 WebKit::WebNavigationPolicy policy);
764
[email protected]269f86d2011-12-07 02:43:47765 bool RunJavaScriptMessage(ui::JavascriptMessageType type,
[email protected]4f5ce842011-05-27 19:34:41766 const string16& message,
767 const string16& default_value,
[email protected]6e24cf12011-03-18 19:57:02768 const GURL& frame_url,
[email protected]4f5ce842011-05-27 19:34:41769 string16* result);
[email protected]6e24cf12011-03-18 19:57:02770
771 // Sends a message and runs a nested message loop.
772 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
773
[email protected]dd6afca2011-08-13 03:44:31774 // Called when the "pinned to left/right edge" state needs to be updated.
775 void UpdateScrollState(WebKit::WebFrame* frame);
776
[email protected]6e24cf12011-03-18 19:57:02777 // IPC message handlers ------------------------------------------------------
778 //
779 // The documentation for these functions should be in
780 // render_messages_internal.h for the message that the function is handling.
781
[email protected]744c2a22012-03-15 18:42:04782 CONTENT_EXPORT void OnAllowBindings(int enabled_bindings_flags);
[email protected]6e24cf12011-03-18 19:57:02783 void OnAllowScriptToClose(bool script_can_close);
784 void OnAsyncFileOpened(base::PlatformFileError error_code,
785 IPC::PlatformFileForTransit file_for_transit,
786 int message_id);
[email protected]eb415bf0e2011-04-14 02:45:42787 void OnPpapiBrokerChannelCreated(int request_id,
[email protected]2b657fd2011-04-18 16:00:47788 base::ProcessHandle broker_process_handle,
[email protected]d54305072011-06-22 20:58:43789 const IPC::ChannelHandle& handle);
[email protected]6e24cf12011-03-18 19:57:02790 void OnCancelDownload(int32 download_id);
791 void OnClearFocusedNode();
[email protected]992db4c2011-05-12 15:37:15792 void OnClosePage();
[email protected]6e24cf12011-03-18 19:57:02793#if defined(ENABLE_FLAPPER_HACKS)
794 void OnConnectTcpACK(int request_id,
795 IPC::PlatformFileForTransit socket_for_transit,
[email protected]5a2b68f2011-11-10 00:00:49796 const PP_NetAddress_Private& local_addr,
797 const PP_NetAddress_Private& remote_addr);
[email protected]6e24cf12011-03-18 19:57:02798#endif
799 void OnContextMenuClosed(
[email protected]35be7ec2012-02-12 20:42:51800 const content::CustomContextMenuContext& custom_context);
[email protected]6e24cf12011-03-18 19:57:02801 void OnCopy();
802 void OnCopyImageAt(int x, int y);
803#if defined(OS_MACOSX)
804 void OnCopyToFindPboard();
805#endif
806 void OnCut();
[email protected]318bf5802011-08-08 17:12:41807 void OnCSSInsertRequest(const string16& frame_xpath,
[email protected]01cf589c2011-07-28 18:04:03808 const std::string& css);
[email protected]6e24cf12011-03-18 19:57:02809 void OnCustomContextMenuAction(
[email protected]35be7ec2012-02-12 20:42:51810 const content::CustomContextMenuContext& custom_context,
[email protected]6e24cf12011-03-18 19:57:02811 unsigned action);
812 void OnDelete();
813 void OnDeterminePageLanguage();
814 void OnDisableScrollbarsForSmallWindows(
815 const gfx::Size& disable_scrollbars_size_limit);
816 void OnDisassociateFromPopupCount();
[email protected]6e24cf12011-03-18 19:57:02817 void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
818 const gfx::Point& screen_point,
819 bool ended,
820 WebKit::WebDragOperation drag_operation);
821 void OnDragSourceSystemDragEnded();
822 void OnDragTargetDrop(const gfx::Point& client_pt,
823 const gfx::Point& screen_pt);
824 void OnDragTargetDragEnter(const WebDropData& drop_data,
825 const gfx::Point& client_pt,
826 const gfx::Point& screen_pt,
827 WebKit::WebDragOperationsMask operations_allowed);
828 void OnDragTargetDragLeave();
829 void OnDragTargetDragOver(const gfx::Point& client_pt,
830 const gfx::Point& screen_pt,
831 WebKit::WebDragOperationsMask operations_allowed);
[email protected]2bf834f2011-11-17 20:02:21832 void OnEnablePreferredSizeChangedMode();
[email protected]244ac1892011-12-02 17:04:47833 void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
[email protected]61e2b3cc2012-03-02 16:13:34834 void OnDisableAutoResize(const gfx::Size& new_size);
[email protected]600ea402011-04-12 00:01:51835 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths);
[email protected]6e24cf12011-03-18 19:57:02836 void OnExecuteEditCommand(const std::string& name, const std::string& value);
[email protected]fb11b6a42012-03-14 07:25:12837 void OnFileChooserResponse(
838 const std::vector<content::SelectedFileInfo>& files);
[email protected]6e24cf12011-03-18 19:57:02839 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
840 void OnFindReplyAck();
[email protected]18d5be92011-07-25 18:00:19841 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
842 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
843 const std::vector<GURL>& links,
844 const std::vector<FilePath>& local_paths,
845 const FilePath& local_directory_name);
[email protected]6e24cf12011-03-18 19:57:02846 void OnMediaPlayerActionAt(const gfx::Point& location,
847 const WebKit::WebMediaPlayerAction& action);
[email protected]81375e872012-01-11 21:40:36848 void OnPluginActionAt(const gfx::Point& location,
849 const WebKit::WebPluginAction& action);
[email protected]6e24cf12011-03-18 19:57:02850 void OnMoveOrResizeStarted();
[email protected]f3112a52011-09-30 23:47:49851 CONTENT_EXPORT void OnNavigate(const ViewMsg_Navigate_Params& params);
[email protected]6e24cf12011-03-18 19:57:02852 void OnPaste();
[email protected]44bf7002011-10-16 02:46:15853 void OnPasteAndMatchStyle();
[email protected]6e24cf12011-03-18 19:57:02854#if defined(OS_MACOSX)
855 void OnPluginImeCompositionCompleted(const string16& text, int plugin_id);
856#endif
857 void OnRedo();
858 void OnReloadFrame();
859 void OnReplace(const string16& text);
[email protected]6e24cf12011-03-18 19:57:02860 void OnResetPageEncodingToDefault();
861 void OnScriptEvalRequest(const string16& frame_xpath,
862 const string16& jscript,
863 int id,
864 bool notify_result);
865 void OnSelectAll();
[email protected]4fb60142011-08-09 02:22:08866 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
[email protected]6e24cf12011-03-18 19:57:02867 void OnSetActive(bool active);
868 void OnSetAltErrorPageURL(const GURL& gurl);
869 void OnSetBackground(const SkBitmap& background);
[email protected]7a17bac02012-03-07 21:58:12870 void OnSetNavigationStartTime(
871 const base::TimeTicks& browser_navigation_start);
[email protected]6e24cf12011-03-18 19:57:02872 void OnSetWebUIProperty(const std::string& name, const std::string& value);
[email protected]c5d463e2012-03-15 21:05:56873 CONTENT_EXPORT void OnSetEditCommandsForNextKeyEvent(
874 const EditCommands& edit_commands);
[email protected]f3112a52011-09-30 23:47:49875 CONTENT_EXPORT void OnSetHistoryLengthAndPrune(int history_length,
876 int32 minimum_page_id);
[email protected]6e24cf12011-03-18 19:57:02877 void OnSetInitialFocus(bool reverse);
[email protected]54ca3ca892011-06-07 21:14:54878#if defined(OS_MACOSX)
879 void OnSetInLiveResize(bool in_live_resize);
880#endif
[email protected]333ec8d02011-09-16 18:59:19881 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
[email protected]6e24cf12011-03-18 19:57:02882 void OnSetPageEncoding(const std::string& encoding_name);
[email protected]daf82f82011-10-31 22:35:31883 void OnSetRendererPrefs(const content::RendererPreferences& renderer_prefs);
[email protected]6e24cf12011-03-18 19:57:02884#if defined(OS_MACOSX)
885 void OnSetWindowVisibility(bool visible);
886#endif
887 void OnSetZoomLevel(double zoom_level);
888 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
[email protected]8a5e0ca2011-08-25 06:30:47889 void OnExitFullscreen();
[email protected]6e24cf12011-03-18 19:57:02890 void OnShouldClose();
891 void OnStop();
[email protected]815dd9872011-11-23 18:40:30892 void OnStopFinding(content::StopFindAction action);
[email protected]73eb2602012-02-09 19:50:55893 CONTENT_EXPORT void OnSwapOut(const ViewMsg_SwapOut_Params& params);
[email protected]6e24cf12011-03-18 19:57:02894 void OnThemeChanged();
[email protected]6e24cf12011-03-18 19:57:02895 void OnUndo();
[email protected]6e24cf12011-03-18 19:57:02896 void OnUpdateTargetURLAck();
[email protected]c5d463e2012-03-15 21:05:56897 CONTENT_EXPORT void OnUpdateWebPreferences(const WebPreferences& prefs);
[email protected]08bb1e722011-07-30 19:13:04898
[email protected]6e24cf12011-03-18 19:57:02899#if defined(OS_MACOSX)
900 void OnWindowFrameChanged(const gfx::Rect& window_frame,
901 const gfx::Rect& view_frame);
[email protected]c5d463e2012-03-15 21:05:56902 CONTENT_EXPORT void OnSelectPopupMenuItem(int selected_index);
[email protected]6e24cf12011-03-18 19:57:02903#endif
[email protected]54087fe2011-10-28 22:02:48904 void OnZoom(content::PageZoom zoom);
[email protected]47578fa02011-11-02 19:34:41905 void OnZoomFactor(content::PageZoom zoom, int zoom_center_x,
906 int zoom_center_y);
907
[email protected]5a7b15a2011-08-22 22:48:18908 void OnEnableViewSourceMode();
[email protected]6e24cf12011-03-18 19:57:02909
[email protected]64d0e192011-12-09 14:44:20910 void OnJavaBridgeInit();
[email protected]7f3c7af2011-10-20 22:52:51911
[email protected]6e24cf12011-03-18 19:57:02912 // Adding a new message handler? Please add it in alphabetical order above
913 // and put it in the same position in the .cc file.
914
915 // Misc private functions ----------------------------------------------------
[email protected]47578fa02011-11-02 19:34:41916 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x,
917 int zoom_center_y, float scaling_increment);
[email protected]6e24cf12011-03-18 19:57:02918
[email protected]6e24cf12011-03-18 19:57:02919 void AltErrorPageFinished(WebKit::WebFrame* frame,
920 const WebKit::WebURLError& original_error,
921 const std::string& html);
922
[email protected]d812fd12011-05-27 23:05:07923 // Check whether the preferred size has changed.
[email protected]6e24cf12011-03-18 19:57:02924 void CheckPreferredSize();
925
[email protected]273558fb2012-01-12 15:03:51926 void EnsureMediaStreamImpl();
927
[email protected]5e56df82011-04-18 17:00:15928 // This callback is triggered when DownloadFavicon completes, either
929 // succesfully or with a failure. See DownloadFavicon for more
930 // details.
931 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher,
932 const SkBitmap& image);
[email protected]6e24cf12011-03-18 19:57:02933
[email protected]310ebd6302011-10-10 19:06:28934 // Requests to download a favicon image. When done, the RenderView is notified
935 // by way of DidDownloadFavicon. Returns true if the request was successfully
936 // started, false otherwise. id is used to uniquely identify the request and
937 // passed back to the DidDownloadFavicon method. If the image has multiple
938 // frames, the frame whose size is image_size is returned. If the image
939 // doesn't have a frame at the specified size, the first is returned.
[email protected]5e56df82011-04-18 17:00:15940 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
[email protected]6e24cf12011-03-18 19:57:02941
[email protected]6e24cf12011-03-18 19:57:02942 GURL GetAlternateErrorPageURL(const GURL& failed_url,
943 ErrorPageType error_type);
944
945 // Locates a sub frame with given xpath
[email protected]318bf5802011-08-08 17:12:41946 WebKit::WebFrame* GetChildFrame(const string16& frame_xpath) const;
[email protected]6e24cf12011-03-18 19:57:02947
[email protected]57b9396c2011-10-07 19:11:59948 // Returns the opener url if present, else an empty url.
949 GURL GetOpenerUrl() const;
950
[email protected]69ddf852012-02-21 23:21:31951 // Returns the URL being loaded by the given frame's request.
952 GURL GetLoadingUrl(WebKit::WebFrame* frame) const;
953
[email protected]6e24cf12011-03-18 19:57:02954 WebUIBindings* GetWebUIBindings();
955
[email protected]6e24cf12011-03-18 19:57:02956 // Should only be called if this object wraps a PluginDocument.
957 WebKit::WebPlugin* GetWebPluginFromPluginDocument();
958
[email protected]d466b8a2011-07-15 21:48:03959 // Returns true if the |params| navigation is to an entry that has been
960 // cropped due to a recent navigation the browser did not know about.
961 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params,
962 bool is_reload);
963
[email protected]6e24cf12011-03-18 19:57:02964 // Returns false unless this is a top-level navigation that crosses origins.
965 bool IsNonLocalTopLevelNavigation(const GURL& url,
966 WebKit::WebFrame* frame,
967 WebKit::WebNavigationType type);
968
[email protected]6e24cf12011-03-18 19:57:02969 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame,
970 const WebKit::WebURLError& error,
971 bool replace);
972
[email protected]007733c2011-11-17 00:34:07973 // If we initiated a navigation, this function will populate |document_state|
974 // with the navigation information saved in OnNavigate().
975 void PopulateStateFromPendingNavigationParams(
976 content::DocumentState* document_state);
977
[email protected]6e24cf12011-03-18 19:57:02978 // Starts nav_state_sync_timer_ if it isn't already running.
979 void StartNavStateSyncTimerIfNecessary();
980
981 // Dispatches the current navigation state to the browser. Called on a
982 // periodic timer so we don't send too many messages.
983 void SyncNavigationState();
984
[email protected]b781ff282011-08-20 06:19:36985 // Dispatches the current state of selection on the webpage to the browser if
986 // it has changed.
987 // TODO(varunjain): delete this method once we figure out how to keep
988 // selection handles in sync with the webpage.
989 void SyncSelectionIfRequired();
990
[email protected]c4dabe452012-02-08 23:58:12991#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
[email protected]6e24cf12011-03-18 19:57:02992 void UpdateFontRenderingFromRendererPrefs();
993#else
994 void UpdateFontRenderingFromRendererPrefs() {}
995#endif
996
997 // Update the target url and tell the browser that the target URL has changed.
998 // If |url| is empty, show |fallback_url|.
999 void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
1000
[email protected]6e24cf12011-03-18 19:57:021001 // ---------------------------------------------------------------------------
1002 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
1003 // it in the same order in the .cc file as it was in the header.
1004 // ---------------------------------------------------------------------------
1005
1006 // Settings ------------------------------------------------------------------
1007
1008 WebPreferences webkit_preferences_;
[email protected]daf82f82011-10-31 22:35:311009 content::RendererPreferences renderer_preferences_;
[email protected]6e24cf12011-03-18 19:57:021010
[email protected]6e24cf12011-03-18 19:57:021011 HostZoomLevels host_zoom_levels_;
1012
1013 // Whether content state (such as form state, scroll position and page
1014 // contents) should be sent to the browser immediately. This is normally
1015 // false, but set to true by some tests.
1016 bool send_content_state_immediately_;
1017
[email protected]6e24cf12011-03-18 19:57:021018 // Bitwise-ORed set of extra bindings that have been enabled. See
1019 // BindingsPolicy for details.
1020 int enabled_bindings_;
1021
1022 // The alternate error page URL, if one exists.
1023 GURL alternate_error_page_url_;
1024
1025 // If true, we send IPC messages when |preferred_size_| changes.
1026 bool send_preferred_size_changes_;
1027
1028 // If non-empty, and |send_preferred_size_changes_| is true, disable drawing
1029 // scroll bars on windows smaller than this size. Used for windows that the
1030 // browser resizes to the size of the content, such as browser action popups.
1031 // If a render view is set to the minimum size of its content, webkit may add
1032 // scroll bars. This makes sense for fixed sized windows, but it does not
1033 // make sense when the size of the view was chosen to fit the content.
1034 // This setting ensures that no scroll bars are drawn. The size limit exists
1035 // because if the view grows beyond a size known to the browser, scroll bars
1036 // should be drawn.
1037 gfx::Size disable_scrollbars_size_limit_;
1038
[email protected]6e24cf12011-03-18 19:57:021039 // Loading state -------------------------------------------------------------
1040
1041 // True if the top level frame is currently being loaded.
1042 bool is_loading_;
1043
1044 // The gesture that initiated the current navigation.
1045 NavigationGesture navigation_gesture_;
1046
1047 // Used for popups.
1048 bool opened_by_user_gesture_;
1049 GURL creator_url_;
1050
1051 // Whether this RenderView was created by a frame that was suppressing its
1052 // opener. If so, we may want to load pages in a separate process. See
1053 // decidePolicyForNavigation for details.
1054 bool opener_suppressed_;
1055
1056 // If we are handling a top-level client-side redirect, this tracks the URL
1057 // of the page that initiated it. Specifically, when a load is committed this
1058 // is used to determine if that load originated from a client-side redirect.
1059 // It is empty if there is no top-level client-side redirect.
[email protected]445e1042011-12-03 21:03:151060 content::Referrer completed_client_redirect_src_;
[email protected]6e24cf12011-03-18 19:57:021061
[email protected]6e24cf12011-03-18 19:57:021062 // Holds state pertaining to a navigation that we initiated. This is held by
1063 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_
1064 // as a temporary holder for the state until the WebDataSource corresponding
1065 // to the new navigation is created. See DidCreateDataSource.
[email protected]007733c2011-11-17 00:34:071066 scoped_ptr<ViewMsg_Navigate_Params> pending_navigation_params_;
[email protected]6e24cf12011-03-18 19:57:021067
1068 // Timer used to delay the updating of nav state (see SyncNavigationState).
[email protected]310ebd6302011-10-10 19:06:281069 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
[email protected]6e24cf12011-03-18 19:57:021070
[email protected]6e24cf12011-03-18 19:57:021071 // Page IDs ------------------------------------------------------------------
[email protected]a813c8e2011-10-08 01:34:111072 // See documentation in content::RenderView.
[email protected]6e24cf12011-03-18 19:57:021073 int32 page_id_;
1074
1075 // Indicates the ID of the last page that we sent a FrameNavigate to the
1076 // browser for. This is used to determine if the most recent transition
1077 // generated a history entry (less than page_id_), or not (equal to or
1078 // greater than). Note that this will be greater than page_id_ if the user
1079 // goes back.
1080 int32 last_page_id_sent_to_browser_;
1081
[email protected]74ce1ad2011-12-16 21:51:461082 // The next available page ID to use for this RenderView. These IDs are
1083 // specific to a given RenderView and the frames within it.
1084 int32 next_page_id_;
[email protected]6e24cf12011-03-18 19:57:021085
[email protected]d466b8a2011-07-15 21:48:031086 // The offset of the current item in the history list.
1087 int history_list_offset_;
1088
1089 // The RenderView's current impression of the history length. This includes
1090 // any items that have committed in this process, but because of cross-process
1091 // navigations, the history may have some entries that were committed in other
1092 // processes. We won't know about them until the next navigation in this
1093 // process.
1094 int history_list_length_;
1095
1096 // The list of page IDs for each history item this RenderView knows about.
1097 // Some entries may be -1 if they were rendered by other processes or were
1098 // restored from a previous session. This lets us detect attempts to
1099 // navigate to stale entries that have been cropped from our history.
1100 std::vector<int32> history_page_ids_;
1101
[email protected]6e24cf12011-03-18 19:57:021102 // Page info -----------------------------------------------------------------
1103
1104 // The last gotten main frame's encoding.
1105 std::string last_encoding_name_;
1106
[email protected]6e24cf12011-03-18 19:57:021107 // UI state ------------------------------------------------------------------
1108
1109 // The state of our target_url transmissions. When we receive a request to
1110 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
1111 // comes back - if a new request comes in before the ACK, we store the new
1112 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
1113 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
1114 // revert to TARGET_INFLIGHT.
1115 //
1116 // We don't need a queue of URLs to send, as only the latest is useful.
1117 enum {
1118 TARGET_NONE,
1119 TARGET_INFLIGHT, // We have a request in-flight, waiting for an ACK
1120 TARGET_PENDING // INFLIGHT + we have a URL waiting to be sent
1121 } target_url_status_;
1122
1123 // The URL we show the user in the status bar. We use this to determine if we
1124 // want to send a new one (we do not need to send duplicates). It will be
1125 // equal to either |mouse_over_url_| or |focus_url_|, depending on which was
1126 // updated last.
1127 GURL target_url_;
1128
1129 // The URL the user's mouse is hovering over.
1130 GURL mouse_over_url_;
1131
1132 // The URL that has keyboard focus.
1133 GURL focus_url_;
1134
1135 // The next target URL we want to send to the browser.
1136 GURL pending_target_url_;
1137
[email protected]6e24cf12011-03-18 19:57:021138 // The text selection the last time DidChangeSelection got called.
[email protected]e99ef6f2011-10-16 01:13:001139 string16 selection_text_;
1140 size_t selection_text_offset_;
1141 ui::Range selection_range_;
[email protected]6e24cf12011-03-18 19:57:021142
1143 // View ----------------------------------------------------------------------
1144
[email protected]6e24cf12011-03-18 19:57:021145 // Cache the preferred size of the page in order to prevent sending the IPC
1146 // when layout() recomputes but doesn't actually change sizes.
1147 gfx::Size preferred_size_;
1148
[email protected]1e0c8e02011-05-25 07:49:371149 // Used to delay determining the preferred size (to avoid intermediate
1150 // states for the sizes).
[email protected]310ebd6302011-10-10 19:06:281151 base::OneShotTimer<RenderViewImpl> check_preferred_size_timer_;
[email protected]1e0c8e02011-05-25 07:49:371152
[email protected]dd6afca2011-08-13 03:44:311153 // These store the "is main frame is scrolled all the way to the left
1154 // or right" state that was last sent to the browser.
1155 bool cached_is_main_frame_pinned_to_left_;
1156 bool cached_is_main_frame_pinned_to_right_;
1157
1158 // These store the "has scrollbars" state last sent to the browser.
1159 bool cached_has_main_frame_horizontal_scrollbar_;
1160 bool cached_has_main_frame_vertical_scrollbar_;
1161
[email protected]6e24cf12011-03-18 19:57:021162#if defined(OS_MACOSX)
1163 // Track the fake plugin window handles allocated on the browser side for
1164 // the accelerated compositor and (currently) accelerated plugins so that
1165 // we can discard them when the view goes away.
1166 std::set<gfx::PluginWindowHandle> fake_plugin_window_handles_;
1167#endif
1168
[email protected]05a980d7a2012-02-07 22:16:421169 // When this view is composited, the context used for compositing may or may
1170 // not support the GL_CHROMIUM_swapbuffers_complete_callback extension. Since
1171 // querying for the existence of this extension is expensive we cache the
1172 // result. These are used to implement SupportsAsynchronousSwapBuffers().
1173 bool context_has_swapbuffers_complete_callback_;
1174 bool queried_for_swapbuffers_complete_callback_;
1175
[email protected]d0fb8a72012-03-10 18:54:521176 // Whether the WebGraphicsContext3D handed out by createGraphicsContext3D() a
1177 // WebGraphicsContext3DCommandBufferImpl. This is a HACK required by the fact
1178 // that there's no other way to tell whether webview()->graphicsContext3D()
1179 // has a ContentGLContext (and thus a CommandBufferProxy & associated
1180 // route_id) or not.
1181 bool context_is_web_graphics_context_3d_command_buffer_impl_;
1182
[email protected]6e24cf12011-03-18 19:57:021183 // Helper objects ------------------------------------------------------------
1184
[email protected]6e24cf12011-03-18 19:57:021185 RendererWebCookieJarImpl cookie_jar_;
1186
1187 // The next group of objects all implement RenderViewObserver, so are deleted
[email protected]310ebd6302011-10-10 19:06:281188 // along with the RenderView automatically. This is why we just store
1189 // weak references.
[email protected]6e24cf12011-03-18 19:57:021190
[email protected]6e24cf12011-03-18 19:57:021191 // Holds a reference to the service which provides desktop notifications.
1192 NotificationProvider* notification_provider_;
1193
1194 // The geolocation dispatcher attached to this view, lazily initialized.
1195 GeolocationDispatcher* geolocation_dispatcher_;
1196
[email protected]0d9989d2011-12-21 20:26:001197 // The intents host attached to this view. Not lazily initialized.
1198 WebIntentsHost* intents_host_;
[email protected]1ef93132011-09-16 18:33:471199
[email protected]6e24cf12011-03-18 19:57:021200 // The speech dispatcher attached to this view, lazily initialized.
[email protected]c52b2892012-03-07 11:01:021201 InputTagSpeechDispatcher* input_tag_speech_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021202
1203 // Device orientation dispatcher attached to this view; lazily initialized.
1204 DeviceOrientationDispatcher* device_orientation_dispatcher_;
1205
[email protected]273558fb2012-01-12 15:03:511206 // MediaStream dispatcher attached to this view; lazily initialized.
1207 MediaStreamDispatcher* media_stream_dispatcher_;
1208
[email protected]ab2c4732011-07-20 19:57:401209 // MediaStreamImpl attached to this view; lazily initialized.
1210 scoped_refptr<MediaStreamImpl> media_stream_impl_;
1211
[email protected]6e24cf12011-03-18 19:57:021212 // Dispatches all P2P socket used by the renderer.
[email protected]b3f8f9722011-08-25 20:56:071213 content::P2PSocketDispatcher* p2p_socket_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021214
[email protected]c5c1d6d2011-07-28 18:42:411215 DevToolsAgent* devtools_agent_;
1216
[email protected]063afcb2011-09-29 07:54:321217 RendererAccessibility* renderer_accessibility_;
1218
[email protected]7f3c7af2011-10-20 22:52:511219 // Java Bridge dispatcher attached to this view; lazily initialized.
1220 scoped_ptr<JavaBridgeDispatcher> java_bridge_dispatcher_;
1221
[email protected]217690d2012-01-27 07:33:111222 // Mouse Lock dispatcher attached to this view.
1223 MouseLockDispatcher* mouse_lock_dispatcher_;
1224
[email protected]6e24cf12011-03-18 19:57:021225 // Misc ----------------------------------------------------------------------
1226
1227 // The current and pending file chooser completion objects. If the queue is
1228 // nonempty, the first item represents the currently running file chooser
1229 // callback, and the remaining elements are the other file chooser completion
1230 // still waiting to be run (in order).
1231 struct PendingFileChooser;
1232 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_;
1233
[email protected]600ea402011-04-12 00:01:511234 // The current directory enumeration callback
1235 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_;
1236 int enumeration_completion_id_;
1237
[email protected]6e24cf12011-03-18 19:57:021238 // The SessionStorage namespace that we're assigned to has an ID, and that ID
1239 // is passed to us upon creation. WebKit asks for this ID upon first use and
1240 // uses it whenever asking the browser process to allocate new storage areas.
1241 int64 session_storage_namespace_id_;
1242
1243 // The total number of unrequested popups that exist and can be followed back
[email protected]310ebd6302011-10-10 19:06:281244 // to a common opener. This count is shared among all RenderViews created with
1245 // createView(). All popups are treated as unrequested until specifically
1246 // instructed otherwise by the Browser process.
[email protected]6e24cf12011-03-18 19:57:021247 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_;
1248
1249 // Whether this is a top level window (instead of a popup). Top level windows
1250 // shouldn't count against their own |shared_popup_counter_|.
1251 bool decrement_shared_popup_at_destruction_;
1252
1253 // If the browser hasn't sent us an ACK for the last FindReply we sent
1254 // to it, then we need to queue up the message (keeping only the most
1255 // recent message if new ones come in).
1256 scoped_ptr<IPC::Message> queued_find_reply_message_;
1257
1258 // Stores edit commands associated to the next key event.
1259 // Shall be cleared as soon as the next key event is processed.
1260 EditCommands edit_commands_;
1261
[email protected]6e24cf12011-03-18 19:57:021262 // Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS
1263 // object is only exposed when Web UI bindings are enabled.
1264 scoped_ptr<WebUIBindings> web_ui_bindings_;
1265
[email protected]6e24cf12011-03-18 19:57:021266 // The external popup for the currently showing select popup.
1267 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
1268
1269 // The node that the context menu was pressed over.
1270 WebKit::WebNode context_menu_node_;
1271
1272 // Reports load progress to the browser.
1273 scoped_ptr<LoadProgressTracker> load_progress_tracker_;
1274
1275 // All the registered observers. We expect this list to be small, so vector
1276 // is fine.
[email protected]3a034ebb2011-10-03 19:19:441277 ObserverList<content::RenderViewObserver> observers_;
[email protected]6e24cf12011-03-18 19:57:021278
[email protected]4fb60142011-08-09 02:22:081279 // Used to inform didChangeSelection() when it is called in the context
1280 // of handling a ViewMsg_SelectRange IPC.
1281 bool handling_select_range_;
1282
[email protected]217690d2012-01-27 07:33:111283 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
1284 scoped_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
1285
[email protected]ef5e98e2011-12-06 09:49:181286 // Plugins -------------------------------------------------------------------
1287
1288 // All the currently active plugin delegates for this RenderView; kept so
1289 // that we can enumerate them to send updates about things like window
1290 // location or tab focus and visibily. These are non-owning references.
1291 std::set<WebPluginDelegateProxy*> plugin_delegates_;
1292
1293#if defined(OS_WIN)
1294 // The ID of the focused NPAPI plug-in.
1295 int focused_plugin_id_;
1296#endif
1297
[email protected]766a7082012-02-03 23:39:151298 // Allows JS to access DOM automation. The JS object is only exposed when the
1299 // DOM automation bindings are enabled.
1300 scoped_ptr<DomAutomationController> dom_automation_controller_;
1301
[email protected]ef5e98e2011-12-06 09:49:181302 // NOTE: pepper_delegate_ should be last member because its constructor calls
1303 // AddObservers method of RenderViewImpl from c-tor.
1304 PepperPluginDelegateImpl pepper_delegate_;
1305
[email protected]6e24cf12011-03-18 19:57:021306 // ---------------------------------------------------------------------------
1307 // ADDING NEW DATA? Please see if it fits appropriately in one of the above
1308 // sections rather than throwing it randomly at the end. If you're adding a
1309 // bunch of stuff, you should probably create a helper class and put your
[email protected]310ebd6302011-10-10 19:06:281310 // data and methods on that to avoid bloating RenderView more. You can
1311 // use the Observer interface to filter IPC messages and receive frame change
[email protected]6e24cf12011-03-18 19:57:021312 // notifications.
1313 // ---------------------------------------------------------------------------
1314
[email protected]310ebd6302011-10-10 19:06:281315 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
[email protected]6e24cf12011-03-18 19:57:021316};
1317
[email protected]310ebd6302011-10-10 19:06:281318#endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_