blob: fb2621f1e70b1cbcbc3f3e9f987cf8e6dbfa58b1 [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
55#if defined(OS_WIN)
[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;
79class SpeechInputDispatcher;
[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]b3f8f9722011-08-25 20:56:0795} // namespace content
[email protected]6e24cf12011-03-18 19:57:0296
[email protected]6e24cf12011-03-18 19:57:0297namespace gfx {
98class Point;
99class Rect;
[email protected]b3f8f9722011-08-25 20:56:07100} // namespace gfx
[email protected]6e24cf12011-03-18 19:57:02101
102namespace webkit {
103
[email protected]6e24cf12011-03-18 19:57:02104namespace ppapi {
[email protected]6e24cf12011-03-18 19:57:02105class PluginInstance;
[email protected]6e24cf12011-03-18 19:57:02106} // namespace ppapi
107
108} // namespace webkit
109
110namespace webkit_glue {
[email protected]6e24cf12011-03-18 19:57:02111class ImageResourceFetcher;
[email protected]6e24cf12011-03-18 19:57:02112class ResourceFetcher;
113}
114
115namespace WebKit {
[email protected]6e24cf12011-03-18 19:57:02116class WebApplicationCacheHost;
117class WebApplicationCacheHostClient;
118class WebDataSource;
[email protected]6e24cf12011-03-18 19:57:02119class WebDragData;
[email protected]6e24cf12011-03-18 19:57:02120class WebGeolocationClient;
[email protected]42054a252011-05-17 18:02:13121class WebIconURL;
[email protected]6e24cf12011-03-18 19:57:02122class WebImage;
[email protected]6e24cf12011-03-18 19:57:02123class WebMediaPlayer;
124class WebMediaPlayerClient;
125class WebMouseEvent;
[email protected]273558fb2012-01-12 15:03:51126class WebPeerConnectionHandler;
127class WebPeerConnectionHandlerClient;
[email protected]6e24cf12011-03-18 19:57:02128class WebSpeechInputController;
129class WebSpeechInputListener;
130class WebStorageNamespace;
[email protected]2d0f2e92011-10-03 09:02:24131class WebTouchEvent;
[email protected]b00ba702011-08-17 01:41:03132class WebURLLoader;
[email protected]6e24cf12011-03-18 19:57:02133class WebURLRequest;
[email protected]273558fb2012-01-12 15:03:51134class WebUserMediaClient;
[email protected]6e24cf12011-03-18 19:57:02135struct WebFileChooserParams;
136struct WebFindOptions;
137struct WebMediaPlayerAction;
[email protected]81375e872012-01-11 21:40:36138struct WebPluginAction;
[email protected]6e24cf12011-03-18 19:57:02139struct WebPoint;
140struct WebWindowFeatures;
141}
142
143// We need to prevent a page from trying to create infinite popups. It is not
144// as simple as keeping a count of the number of immediate children
145// popups. Having an html file that window.open()s itself would create
146// an unlimited chain of RenderViews who only have one RenderView child.
147//
148// Therefore, each new top level RenderView creates a new counter and shares it
[email protected]310ebd6302011-10-10 19:06:28149// with all its children and grandchildren popup RenderViewImpls created with
[email protected]6e24cf12011-03-18 19:57:02150// createView() to have a sort of global limit for the page so no more than
151// kMaximumNumberOfPopups popups are created.
152//
153// This is a RefCounted holder of an int because I can't say
154// scoped_refptr<int>.
155typedef base::RefCountedData<int> SharedRenderViewCounter;
156
157//
158// RenderView is an object that manages a WebView object, and provides a
159// communication interface with an embedding application process
160//
[email protected]310ebd6302011-10-10 19:06:28161class RenderViewImpl : public RenderWidget,
162 public WebKit::WebViewClient,
163 public WebKit::WebFrameClient,
164 public WebKit::WebPageSerializerClient,
165 public content::RenderView,
166 public webkit::npapi::WebPluginPageDelegate,
[email protected]a9288f52011-11-17 05:18:16167 public webkit_media::WebMediaPlayerDelegate,
[email protected]b3e83de2012-02-07 03:33:28168 public WebGraphicsContext3DSwapBuffersClient,
[email protected]310ebd6302011-10-10 19:06:28169 public base::SupportsWeakPtr<RenderViewImpl> {
[email protected]6e24cf12011-03-18 19:57:02170 public:
171 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the
[email protected]5f9de5882011-09-30 23:36:28172 // parent of the WebView HWND that will be created. If this is a blocked
[email protected]6e24cf12011-03-18 19:57:02173 // popup or as a new tab, opener_id is the routing ID of the RenderView
174 // responsible for creating this RenderView (corresponding to parent_hwnd).
175 // |counter| is either a currently initialized counter, or NULL (in which case
176 // we treat this RenderView as a top level window).
[email protected]310ebd6302011-10-10 19:06:28177 CONTENT_EXPORT static RenderViewImpl* Create(
[email protected]6e24cf12011-03-18 19:57:02178 gfx::NativeViewId parent_hwnd,
179 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31180 const content::RendererPreferences& renderer_prefs,
[email protected]6e24cf12011-03-18 19:57:02181 const WebPreferences& webkit_prefs,
182 SharedRenderViewCounter* counter,
183 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56184 int32 surface_id,
[email protected]6e24cf12011-03-18 19:57:02185 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46186 const string16& frame_name,
[email protected]6fd35b72012-03-01 19:46:41187 int32 next_page_id,
188 const WebKit::WebScreenInfo& screen_info);
[email protected]6e24cf12011-03-18 19:57:02189
[email protected]310ebd6302011-10-10 19:06:28190 // Returns the RenderViewImpl containing the given WebView.
191 CONTENT_EXPORT static RenderViewImpl* FromWebView(WebKit::WebView* webview);
[email protected]6e24cf12011-03-18 19:57:02192
[email protected]6e24cf12011-03-18 19:57:02193 // May return NULL when the view is closing.
[email protected]8d128d62011-09-13 22:11:57194 CONTENT_EXPORT WebKit::WebView* webview() const;
[email protected]6e24cf12011-03-18 19:57:02195
[email protected]b3e83de2012-02-07 03:33:28196 // WebGraphicsContext3DSwapBuffersClient implementation.
197
[email protected]65225772011-05-12 21:10:24198 // Called by a GraphicsContext associated with this view when swapbuffers
[email protected]37a6f302011-07-11 23:43:08199 // is posted, completes or is aborted.
[email protected]b3e83de2012-02-07 03:33:28200 virtual void OnViewContextSwapBuffersPosted() OVERRIDE;
201 virtual void OnViewContextSwapBuffersComplete() OVERRIDE;
202 virtual void OnViewContextSwapBuffersAborted() OVERRIDE;
[email protected]65225772011-05-12 21:10:24203
[email protected]d466b8a2011-07-15 21:48:03204 int history_list_offset() const { return history_list_offset_; }
[email protected]6e24cf12011-03-18 19:57:02205
[email protected]6e24cf12011-03-18 19:57:02206 const WebPreferences& webkit_preferences() const {
207 return webkit_preferences_;
208 }
209
210 void set_send_content_state_immediately(bool value) {
211 send_content_state_immediately_ = value;
212 }
213
[email protected]273558fb2012-01-12 15:03:51214 MediaStreamDispatcher* media_stream_dispatcher() {
215 return media_stream_dispatcher_;
216 }
217
[email protected]6e24cf12011-03-18 19:57:02218 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled.
[email protected]b3f8f9722011-08-25 20:56:07219 content::P2PSocketDispatcher* p2p_socket_dispatcher() {
[email protected]6e24cf12011-03-18 19:57:02220 return p2p_socket_dispatcher_;
221 }
222
[email protected]217690d2012-01-27 07:33:11223 MouseLockDispatcher* mouse_lock_dispatcher() {
224 return mouse_lock_dispatcher_;
225 }
226
[email protected]273558fb2012-01-12 15:03:51227 WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler(
228 WebKit::WebPeerConnectionHandlerClient* client);
229
[email protected]6e24cf12011-03-18 19:57:02230 // Functions to add and remove observers for this object.
[email protected]3a034ebb2011-10-03 19:19:44231 void AddObserver(content::RenderViewObserver* observer);
232 void RemoveObserver(content::RenderViewObserver* observer);
[email protected]6e24cf12011-03-18 19:57:02233
[email protected]6e24cf12011-03-18 19:57:02234 // Adds the given file chooser request to the file_chooser_completion_ queue
235 // (see that var for more) and requests the chooser be displayed if there are
236 // no other waiting items in the queue.
237 //
238 // Returns true if the chooser was successfully scheduled. False means we
239 // didn't schedule anything.
[email protected]8caadeb2011-11-22 02:45:23240 bool ScheduleFileChooser(const content::FileChooserParams& params,
[email protected]6e24cf12011-03-18 19:57:02241 WebKit::WebFileChooserCompletion* completion);
242
[email protected]6e24cf12011-03-18 19:57:02243 // Sets whether the renderer should report load progress to the browser.
244 void SetReportLoadProgressEnabled(bool enabled);
245
[email protected]a2ef54c2011-10-10 16:20:31246 void LoadNavigationErrorPage(
[email protected]8d128d62011-09-13 22:11:57247 WebKit::WebFrame* frame,
248 const WebKit::WebURLRequest& failed_request,
249 const WebKit::WebURLError& error,
250 const std::string& html,
251 bool replace);
[email protected]9966325b2011-04-18 05:00:10252
[email protected]6e24cf12011-03-18 19:57:02253 // Plugin-related functions --------------------------------------------------
254 // (See also WebPluginPageDelegate implementation.)
255
256 // Notification that the given plugin has crashed.
257 void PluginCrashed(const FilePath& plugin_path);
258
[email protected]6e24cf12011-03-18 19:57:02259 // Creates a fullscreen container for a pepper plugin instance.
[email protected]ea192e82011-04-11 19:16:02260 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
[email protected]6e24cf12011-03-18 19:57:02261 webkit::ppapi::PluginInstance* plugin);
262
[email protected]56ea1a62011-05-30 07:05:57263 // Informs the render view that a PPAPI plugin has gained or lost focus.
264 void PpapiPluginFocusChanged();
265
[email protected]73bf95812011-10-12 11:38:32266 // Informs the render view that a PPAPI plugin has changed text input status.
267 void PpapiPluginTextInputTypeChanged();
[email protected]3f783362011-10-21 22:40:50268 void PpapiPluginCaretPositionChanged();
[email protected]73bf95812011-10-12 11:38:32269
270 // Cancels current composition.
271 void PpapiPluginCancelComposition();
272
[email protected]b25b3ee2012-01-13 05:19:54273 // Retrieves the current caret position if a PPAPI plugin has focus.
274 bool GetPpapiPluginCaretBounds(gfx::Rect* rect);
275
[email protected]e6ae0f6c2011-10-04 10:39:23276#if defined(OS_MACOSX) || defined(OS_WIN)
[email protected]6e24cf12011-03-18 19:57:02277 // Informs the render view that the given plugin has gained or lost focus.
278 void PluginFocusChanged(bool focused, int plugin_id);
[email protected]e6ae0f6c2011-10-04 10:39:23279#endif
[email protected]6e24cf12011-03-18 19:57:02280
[email protected]e6ae0f6c2011-10-04 10:39:23281#if defined(OS_MACOSX)
[email protected]6e24cf12011-03-18 19:57:02282 // Starts plugin IME.
283 void StartPluginIme();
284
285 // Helper routines for accelerated plugin support. Used by the
286 // WebPluginDelegateProxy, which has a pointer to the RenderView.
287 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque,
288 bool root);
289 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle window);
290 void AcceleratedSurfaceSetIOSurface(gfx::PluginWindowHandle window,
291 int32 width,
292 int32 height,
293 uint64 io_surface_identifier);
294 TransportDIB::Handle AcceleratedSurfaceAllocTransportDIB(size_t size);
295 void AcceleratedSurfaceFreeTransportDIB(TransportDIB::Id dib_id);
296 void AcceleratedSurfaceSetTransportDIB(gfx::PluginWindowHandle window,
297 int32 width,
298 int32 height,
299 TransportDIB::Handle transport_dib);
300 void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
301 uint64 surface_id);
302#endif
303
304 void RegisterPluginDelegate(WebPluginDelegateProxy* delegate);
305 void UnregisterPluginDelegate(WebPluginDelegateProxy* delegate);
306
[email protected]4a7d6392011-09-19 20:55:08307 // Helper function to retrieve information about a plugin for a URL and mime
308 // type. Returns false if no plugin was found.
309 // |actual_mime_type| is the actual mime type supported by the
310 // plugin found that match the URL given (one for each item in
311 // |info|).
[email protected]84c13c032011-09-23 00:12:22312 CONTENT_EXPORT bool GetPluginInfo(const GURL& url,
313 const GURL& page_url,
314 const std::string& mime_type,
315 webkit::WebPluginInfo* plugin_info,
316 std::string* actual_mime_type);
[email protected]4a7d6392011-09-19 20:55:08317
[email protected]6e24cf12011-03-18 19:57:02318 // IPC::Channel::Listener implementation -------------------------------------
319
[email protected]edc64de2011-11-17 20:07:38320 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02321
322 // WebKit::WebWidgetClient implementation ------------------------------------
323
324 // Most methods are handled by RenderWidget.
325 virtual void didFocus();
326 virtual void didBlur();
327 virtual void show(WebKit::WebNavigationPolicy policy);
328 virtual void runModal();
[email protected]2b624c562011-10-27 22:58:26329 virtual bool enterFullScreen();
330 virtual void exitFullScreen();
[email protected]217690d2012-01-27 07:33:11331 virtual bool requestPointerLock();
332 virtual void requestPointerUnlock();
333 virtual bool isPointerLocked();
[email protected]6e24cf12011-03-18 19:57:02334
335 // WebKit::WebViewClient implementation --------------------------------------
336
337 virtual WebKit::WebView* createView(
338 WebKit::WebFrame* creator,
339 const WebKit::WebURLRequest& request,
340 const WebKit::WebWindowFeatures& features,
341 const WebKit::WebString& frame_name);
342 virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
343 virtual WebKit::WebWidget* createPopupMenu(
344 const WebKit::WebPopupMenuInfo& info);
345 virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
346 const WebKit::WebPopupMenuInfo& popup_menu_info,
347 WebKit::WebExternalPopupMenuClient* popup_menu_client);
348 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
349 unsigned quota);
[email protected]7e8b4d12012-01-20 23:39:51350 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(
[email protected]01e69032012-01-31 05:39:06351 const WebKit::WebGraphicsContext3D::Attributes& attributes,
[email protected]7e8b4d12012-01-20 23:39:51352 bool direct);
[email protected]6e24cf12011-03-18 19:57:02353 virtual void didAddMessageToConsole(
354 const WebKit::WebConsoleMessage& message,
355 const WebKit::WebString& source_name,
356 unsigned source_line);
357 virtual void printPage(WebKit::WebFrame* frame);
358 virtual WebKit::WebNotificationPresenter* notificationPresenter();
[email protected]8a58c1c2011-04-19 18:40:12359 virtual bool enumerateChosenDirectory(
360 const WebKit::WebString& path,
361 WebKit::WebFileChooserCompletion* chooser_completion);
[email protected]6e24cf12011-03-18 19:57:02362 virtual void didStartLoading();
363 virtual void didStopLoading();
364 virtual void didChangeLoadProgress(WebKit::WebFrame* frame,
365 double load_progress);
366 virtual bool isSmartInsertDeleteEnabled();
367 virtual bool isSelectTrailingWhitespaceEnabled();
368 virtual void didChangeSelection(bool is_selection_empty);
369 virtual void didExecuteCommand(const WebKit::WebString& command_name);
370 virtual bool handleCurrentKeyboardEvent();
[email protected]6e24cf12011-03-18 19:57:02371 virtual bool runFileChooser(
372 const WebKit::WebFileChooserParams& params,
373 WebKit::WebFileChooserCompletion* chooser_completion);
374 virtual void runModalAlertDialog(WebKit::WebFrame* frame,
375 const WebKit::WebString& message);
376 virtual bool runModalConfirmDialog(WebKit::WebFrame* frame,
377 const WebKit::WebString& message);
378 virtual bool runModalPromptDialog(WebKit::WebFrame* frame,
379 const WebKit::WebString& message,
380 const WebKit::WebString& default_value,
381 WebKit::WebString* actual_value);
382 virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame* frame,
383 const WebKit::WebString& message);
384 virtual void showContextMenu(WebKit::WebFrame* frame,
385 const WebKit::WebContextMenuData& data);
[email protected]2b624c562011-10-27 22:58:26386 virtual void enterFullscreen();
387 virtual void exitFullscreen();
[email protected]6e24cf12011-03-18 19:57:02388 virtual void setStatusText(const WebKit::WebString& text);
389 virtual void setMouseOverURL(const WebKit::WebURL& url);
390 virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
[email protected]6e24cf12011-03-18 19:57:02391 virtual void startDragging(const WebKit::WebDragData& data,
392 WebKit::WebDragOperationsMask mask,
393 const WebKit::WebImage& image,
394 const WebKit::WebPoint& imageOffset);
395 virtual bool acceptsLoadDrops();
396 virtual void focusNext();
397 virtual void focusPrevious();
398 virtual void focusedNodeChanged(const WebKit::WebNode& node);
[email protected]169d4282011-11-30 19:33:59399 virtual void didUpdateLayout();
[email protected]6e24cf12011-03-18 19:57:02400 virtual void navigateBackForwardSoon(int offset);
401 virtual int historyBackListCount();
402 virtual int historyForwardListCount();
403 virtual void postAccessibilityNotification(
404 const WebKit::WebAccessibilityObject& obj,
405 WebKit::WebAccessibilityNotification notification);
406 virtual void didUpdateInspectorSetting(const WebKit::WebString& key,
407 const WebKit::WebString& value);
408 virtual WebKit::WebGeolocationClient* geolocationClient();
409 virtual WebKit::WebSpeechInputController* speechInputController(
410 WebKit::WebSpeechInputListener* listener);
411 virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient();
412 virtual void zoomLimitsChanged(double minimum_level, double maximum_level);
413 virtual void zoomLevelChanged();
414 virtual void registerProtocolHandler(const WebKit::WebString& scheme,
415 const WebKit::WebString& base_url,
416 const WebKit::WebString& url,
417 const WebKit::WebString& title);
[email protected]94dec932011-05-26 20:04:21418 virtual WebKit::WebPageVisibilityState visibilityState() const;
[email protected]273558fb2012-01-12 15:03:51419 virtual WebKit::WebUserMediaClient* userMediaClient();
[email protected]6e24cf12011-03-18 19:57:02420
421 // WebKit::WebFrameClient implementation -------------------------------------
422
423 virtual WebKit::WebPlugin* createPlugin(
424 WebKit::WebFrame* frame,
425 const WebKit::WebPluginParams& params);
[email protected]6e24cf12011-03-18 19:57:02426 virtual WebKit::WebSharedWorker* createSharedWorker(
427 WebKit::WebFrame* frame, const WebKit::WebURL& url,
428 const WebKit::WebString& name, unsigned long long documentId);
429 virtual WebKit::WebMediaPlayer* createMediaPlayer(
430 WebKit::WebFrame* frame,
431 WebKit::WebMediaPlayerClient* client);
432 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
433 WebKit::WebFrame* frame,
434 WebKit::WebApplicationCacheHostClient* client);
435 virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame);
436 virtual void frameDetached(WebKit::WebFrame* frame);
437 virtual void willClose(WebKit::WebFrame* frame);
[email protected]6e24cf12011-03-18 19:57:02438 virtual void loadURLExternally(WebKit::WebFrame* frame,
439 const WebKit::WebURLRequest& request,
440 WebKit::WebNavigationPolicy policy);
[email protected]0622875ab2011-07-27 12:10:34441 virtual void loadURLExternally(WebKit::WebFrame* frame,
442 const WebKit::WebURLRequest& request,
443 WebKit::WebNavigationPolicy policy,
444 const WebKit::WebString& suggested_name);
[email protected]6e24cf12011-03-18 19:57:02445 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
446 WebKit::WebFrame* frame,
447 const WebKit::WebURLRequest& request,
448 WebKit::WebNavigationType type,
449 const WebKit::WebNode&,
450 WebKit::WebNavigationPolicy default_policy,
451 bool is_redirect);
452 virtual bool canHandleRequest(WebKit::WebFrame* frame,
453 const WebKit::WebURLRequest& request);
454 virtual WebKit::WebURLError cannotHandleRequestError(
455 WebKit::WebFrame* frame,
456 const WebKit::WebURLRequest& request);
457 virtual WebKit::WebURLError cancelledError(
458 WebKit::WebFrame* frame,
459 const WebKit::WebURLRequest& request);
460 virtual void unableToImplementPolicyWithError(
461 WebKit::WebFrame* frame,
462 const WebKit::WebURLError& error);
463 virtual void willSendSubmitEvent(WebKit::WebFrame* frame,
464 const WebKit::WebFormElement& form);
465 virtual void willSubmitForm(WebKit::WebFrame* frame,
466 const WebKit::WebFormElement& form);
467 virtual void willPerformClientRedirect(WebKit::WebFrame* frame,
468 const WebKit::WebURL& from,
469 const WebKit::WebURL& to,
470 double interval,
471 double fire_time);
472 virtual void didCancelClientRedirect(WebKit::WebFrame* frame);
473 virtual void didCompleteClientRedirect(WebKit::WebFrame* frame,
474 const WebKit::WebURL& from);
475 virtual void didCreateDataSource(WebKit::WebFrame* frame,
476 WebKit::WebDataSource* datasource);
477 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame);
478 virtual void didReceiveServerRedirectForProvisionalLoad(
479 WebKit::WebFrame* frame);
480 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame,
481 const WebKit::WebURLError& error);
482 virtual void didReceiveDocumentData(WebKit::WebFrame* frame,
483 const char* data, size_t length,
484 bool& prevent_default);
485 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame,
486 bool is_new_navigation);
487 virtual void didClearWindowObject(WebKit::WebFrame* frame);
488 virtual void didCreateDocumentElement(WebKit::WebFrame* frame);
489 virtual void didReceiveTitle(WebKit::WebFrame* frame,
[email protected]a3bc4d12011-04-20 17:22:21490 const WebKit::WebString& title,
491 WebKit::WebTextDirection direction);
[email protected]42054a252011-05-17 18:02:13492 virtual void didChangeIcon(WebKit::WebFrame*,
493 WebKit::WebIconURL::Type) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02494 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame);
495 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame);
496 virtual void didFailLoad(WebKit::WebFrame* frame,
497 const WebKit::WebURLError& error);
498 virtual void didFinishLoad(WebKit::WebFrame* frame);
499 virtual void didNavigateWithinPage(WebKit::WebFrame* frame,
500 bool is_new_navigation);
501 virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame);
502 virtual void assignIdentifierToRequest(WebKit::WebFrame* frame,
503 unsigned identifier,
504 const WebKit::WebURLRequest& request);
505 virtual void willSendRequest(WebKit::WebFrame* frame,
506 unsigned identifier,
507 WebKit::WebURLRequest& request,
508 const WebKit::WebURLResponse& redirect_response);
509 virtual void didReceiveResponse(WebKit::WebFrame* frame,
510 unsigned identifier,
511 const WebKit::WebURLResponse& response);
512 virtual void didFinishResourceLoad(WebKit::WebFrame* frame,
513 unsigned identifier);
514 virtual void didFailResourceLoad(WebKit::WebFrame* frame,
515 unsigned identifier,
516 const WebKit::WebURLError& error);
517 virtual void didLoadResourceFromMemoryCache(
518 WebKit::WebFrame* frame,
519 const WebKit::WebURLRequest& request,
520 const WebKit::WebURLResponse&);
521 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame);
522 virtual void didRunInsecureContent(
523 WebKit::WebFrame* frame,
524 const WebKit::WebSecurityOrigin& origin,
525 const WebKit::WebURL& target);
[email protected]b00ba702011-08-17 01:41:03526 virtual void didAdoptURLLoader(WebKit::WebURLLoader* loader);
[email protected]6e24cf12011-03-18 19:57:02527 virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame* frame);
[email protected]5bc10932011-09-21 21:03:30528 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
529 v8::Handle<v8::Context>,
[email protected]a00fe692012-02-27 05:52:58530 int extension_group,
531 int world_id);
532 // TODO(koz): Remove once WebKit no longer calls this.
533 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
534 v8::Handle<v8::Context>,
[email protected]5bc10932011-09-21 21:03:30535 int world_id);
536 virtual void willReleaseScriptContext(WebKit::WebFrame* frame,
537 v8::Handle<v8::Context>,
538 int world_id);
[email protected]6e24cf12011-03-18 19:57:02539 virtual void didChangeScrollOffset(WebKit::WebFrame* frame);
[email protected]dd6afca2011-08-13 03:44:31540 virtual void numberOfWheelEventHandlersChanged(unsigned num_handlers);
[email protected]ea931252012-02-15 22:01:03541 virtual void numberOfTouchEventHandlersChanged(unsigned num_handlers);
[email protected]dd6afca2011-08-13 03:44:31542 virtual void didChangeContentsSize(WebKit::WebFrame* frame,
543 const WebKit::WebSize& size);
[email protected]6e24cf12011-03-18 19:57:02544 virtual void reportFindInPageMatchCount(int request_id,
545 int count,
546 bool final_update);
547 virtual void reportFindInPageSelection(int request_id,
548 int active_match_ordinal,
549 const WebKit::WebRect& sel);
550
551 virtual void openFileSystem(WebKit::WebFrame* frame,
552 WebKit::WebFileSystem::Type type,
553 long long size,
554 bool create,
555 WebKit::WebFileSystemCallbacks* callbacks);
556
[email protected]10e5cf12011-04-13 04:10:40557 virtual void queryStorageUsageAndQuota(
558 WebKit::WebFrame* frame,
559 WebKit::WebStorageQuotaType type,
560 WebKit::WebStorageQuotaCallbacks* callbacks);
561
562 virtual void requestStorageQuota(
563 WebKit::WebFrame* frame,
564 WebKit::WebStorageQuotaType type,
565 unsigned long long requested_size,
566 WebKit::WebStorageQuotaCallbacks* callbacks);
567
[email protected]8b5af492011-11-28 21:50:58568 virtual void registerIntentService(
569 WebKit::WebFrame* frame,
570 const WebKit::WebIntentServiceInfo& service);
571 virtual void dispatchIntent(WebKit::WebFrame* frame,
[email protected]ffc8bed2012-01-21 01:23:15572 const WebKit::WebIntentRequest& intentRequest);
[email protected]8b5af492011-11-28 21:50:58573
[email protected]18d5be92011-07-25 18:00:19574 // WebKit::WebPageSerializerClient implementation ----------------------------
575
576 virtual void didSerializeDataForFrame(
577 const WebKit::WebURL& frame_url,
578 const WebKit::WebCString& data,
579 PageSerializationStatus status) OVERRIDE;
580
[email protected]a2ef54c2011-10-10 16:20:31581 // content::RenderView implementation ----------------------------------------
582
583 virtual bool Send(IPC::Message* message) OVERRIDE;
584 virtual int GetRoutingId() const OVERRIDE;
585 virtual int GetPageId() OVERRIDE;
586 virtual gfx::Size GetSize() OVERRIDE;
587 virtual gfx::NativeViewId GetHostWindow() OVERRIDE;
588 virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
589 virtual WebKit::WebView* GetWebView() OVERRIDE;
590 virtual WebKit::WebNode GetFocusedNode() const OVERRIDE;
591 virtual WebKit::WebNode GetContextMenuNode() const OVERRIDE;
592 virtual bool IsEditableNode(const WebKit::WebNode& node) OVERRIDE;
593 virtual WebKit::WebPlugin* CreatePlugin(
594 WebKit::WebFrame* frame,
595 const webkit::WebPluginInfo& info,
596 const WebKit::WebPluginParams& params) OVERRIDE;
597 virtual void EvaluateScript(const string16& frame_xpath,
598 const string16& jscript,
599 int id,
600 bool notify_result) OVERRIDE;
601 virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE;
602 virtual int GetEnabledBindings() OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31603 virtual bool GetContentStateImmediately() OVERRIDE;
604 virtual float GetFilteredTimePerFrame() OVERRIDE;
605 virtual void ShowContextMenu(WebKit::WebFrame* frame,
606 const WebKit::WebContextMenuData& data) OVERRIDE;
607 virtual WebKit::WebPageVisibilityState GetVisibilityState() const OVERRIDE;
608 virtual void RunModalAlertDialog(WebKit::WebFrame* frame,
609 const WebKit::WebString& message) OVERRIDE;
610 virtual void LoadURLExternally(
611 WebKit::WebFrame* frame,
612 const WebKit::WebURLRequest& request,
613 WebKit::WebNavigationPolicy policy) OVERRIDE;
614
[email protected]6e24cf12011-03-18 19:57:02615 // webkit_glue::WebPluginPageDelegate implementation -------------------------
616
617 virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
618 const FilePath& file_path,
[email protected]edc64de2011-11-17 20:07:38619 const std::string& mime_type) OVERRIDE;
620 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
621 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
622 virtual void DidMovePlugin(
623 const webkit::npapi::WebPluginGeometry& move) OVERRIDE;
624 virtual void DidStartLoadingForPlugin() OVERRIDE;
625 virtual void DidStopLoadingForPlugin() OVERRIDE;
626 virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02627
[email protected]a9288f52011-11-17 05:18:16628 // webkit_media::WebMediaPlayerDelegate implementation -----------------------
[email protected]baff4512011-10-19 18:21:07629
[email protected]a9288f52011-11-17 05:18:16630 virtual void DidPlay(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
631 virtual void DidPause(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
632 virtual void PlayerGone(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
[email protected]baff4512011-10-19 18:21:07633
[email protected]6e24cf12011-03-18 19:57:02634 // Please do not add your stuff randomly to the end here. If there is an
635 // appropriate section, add it there. If not, there are some random functions
636 // nearer to the top you can add it to.
[email protected]6e24cf12011-03-18 19:57:02637
[email protected]38b592902011-04-16 02:08:42638 // Cannot use std::set unfortunately since linked_ptr<> does not support
639 // operator<.
640 typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> >
641 ImageResourceFetcherList;
642
[email protected]6e24cf12011-03-18 19:57:02643 protected:
644 // RenderWidget overrides:
[email protected]edc64de2011-11-17 20:07:38645 virtual void Close() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02646 virtual void OnResize(const gfx::Size& new_size,
[email protected]ee41e7d22011-10-14 19:34:09647 const gfx::Rect& resizer_rect,
[email protected]edc64de2011-11-17 20:07:38648 bool is_fullscreen) OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16649 virtual void WillInitiatePaint() OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38650 virtual void DidInitiatePaint() OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16651 virtual void DidFlushPaint() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02652 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
653 const gfx::Rect& paint_bounds,
654 TransportDIB** dib,
655 gfx::Rect* location,
[email protected]edc64de2011-11-17 20:07:38656 gfx::Rect* clip) OVERRIDE;
657 virtual gfx::Point GetScrollOffset() OVERRIDE;
658 virtual void DidHandleKeyEvent() OVERRIDE;
[email protected]67bfb83f2011-09-22 03:36:37659 virtual bool WillHandleMouseEvent(
660 const WebKit::WebMouseEvent& event) OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38661 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) OVERRIDE;
662 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) OVERRIDE;
663 virtual void OnSetFocus(bool enable) OVERRIDE;
664 virtual void OnWasHidden() OVERRIDE;
665 virtual void OnWasRestored(bool needs_repainting) OVERRIDE;
[email protected]65225772011-05-12 21:10:24666 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE;
[email protected]56ea1a62011-05-30 07:05:57667 virtual void OnImeSetComposition(
668 const string16& text,
669 const std::vector<WebKit::WebCompositionUnderline>& underlines,
670 int selection_start,
671 int selection_end) OVERRIDE;
[email protected]4de6d1692011-10-12 08:45:44672 virtual void OnImeConfirmComposition(
673 const string16& text, const ui::Range& replacement_range) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45674 virtual ui::TextInputType GetTextInputType() OVERRIDE;
[email protected]3f783362011-10-21 22:40:50675 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45676 virtual bool CanComposeInline() OVERRIDE;
[email protected]c3d45532011-10-07 19:20:40677 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02678
679 private:
[email protected]6e24cf12011-03-18 19:57:02680 // For unit tests.
681 friend class ExternalPopupMenuTest;
682 friend class PepperDeviceTest;
[email protected]c6d068ff2011-10-14 17:28:23683 friend class content::RenderViewTest;
[email protected]6e24cf12011-03-18 19:57:02684
685 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
686 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
687 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]068970d2011-10-11 00:05:16688 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
689 DontIgnoreBackAfterNavEntryLimit);
690 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
691 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
692 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
693 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
694 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
695 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeStateChanged);
696 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
697 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
698 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
[email protected]73eb2602012-02-09 19:50:55699 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
[email protected]068970d2011-10-11 00:05:16700 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
701 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
[email protected]6e24cf12011-03-18 19:57:02702#if defined(OS_MACOSX)
703 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
704#endif
[email protected]068970d2011-10-11 00:05:16705 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune);
[email protected]6e24cf12011-03-18 19:57:02706
[email protected]6e24cf12011-03-18 19:57:02707 typedef std::map<GURL, double> HostZoomLevels;
708
[email protected]6e24cf12011-03-18 19:57:02709 enum ErrorPageType {
710 DNS_ERROR,
711 HTTP_404,
712 CONNECTION_ERROR,
713 };
714
[email protected]310ebd6302011-10-10 19:06:28715 RenderViewImpl(gfx::NativeViewId parent_hwnd,
716 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31717 const content::RendererPreferences& renderer_prefs,
[email protected]310ebd6302011-10-10 19:06:28718 const WebPreferences& webkit_prefs,
719 SharedRenderViewCounter* counter,
720 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56721 int32 surface_id,
[email protected]310ebd6302011-10-10 19:06:28722 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46723 const string16& frame_name,
[email protected]6fd35b72012-03-01 19:46:41724 int32 next_page_id,
725 const WebKit::WebScreenInfo& screen_info);
[email protected]6e24cf12011-03-18 19:57:02726
727 // Do not delete directly. This class is reference counted.
[email protected]310ebd6302011-10-10 19:06:28728 virtual ~RenderViewImpl();
[email protected]6e24cf12011-03-18 19:57:02729
730 void UpdateURL(WebKit::WebFrame* frame);
[email protected]a49e10b2011-08-01 23:57:46731 void UpdateTitle(WebKit::WebFrame* frame, const string16& title,
732 WebKit::WebTextDirection title_direction);
[email protected]6e24cf12011-03-18 19:57:02733 void UpdateSessionHistory(WebKit::WebFrame* frame);
734
735 // Update current main frame's encoding and send it to browser window.
736 // Since we want to let users see the right encoding info from menu
737 // before finishing loading, we call the UpdateEncoding in
738 // a) function:DidCommitLoadForFrame. When this function is called,
739 // that means we have got first data. In here we try to get encoding
740 // of page if it has been specified in http header.
741 // b) function:DidReceiveTitle. When this function is called,
742 // that means we have got specified title. Because in most of webpages,
743 // title tags will follow meta tags. In here we try to get encoding of
744 // page if it has been specified in meta tag.
745 // c) function:DidFinishDocumentLoadForFrame. When this function is
746 // called, that means we have got whole html page. In here we should
747 // finally get right encoding of page.
748 void UpdateEncoding(WebKit::WebFrame* frame,
749 const std::string& encoding_name);
750
[email protected]ae5184d62011-10-06 19:25:58751 void OpenURL(WebKit::WebFrame* frame,
752 const GURL& url,
[email protected]445e1042011-12-03 21:03:15753 const content::Referrer& referrer,
[email protected]6e24cf12011-03-18 19:57:02754 WebKit::WebNavigationPolicy policy);
755
[email protected]269f86d2011-12-07 02:43:47756 bool RunJavaScriptMessage(ui::JavascriptMessageType type,
[email protected]4f5ce842011-05-27 19:34:41757 const string16& message,
758 const string16& default_value,
[email protected]6e24cf12011-03-18 19:57:02759 const GURL& frame_url,
[email protected]4f5ce842011-05-27 19:34:41760 string16* result);
[email protected]6e24cf12011-03-18 19:57:02761
762 // Sends a message and runs a nested message loop.
763 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
764
[email protected]dd6afca2011-08-13 03:44:31765 // Called when the "pinned to left/right edge" state needs to be updated.
766 void UpdateScrollState(WebKit::WebFrame* frame);
767
[email protected]6e24cf12011-03-18 19:57:02768 // IPC message handlers ------------------------------------------------------
769 //
770 // The documentation for these functions should be in
771 // render_messages_internal.h for the message that the function is handling.
772
[email protected]6e24cf12011-03-18 19:57:02773 void OnAllowBindings(int enabled_bindings_flags);
[email protected]6e24cf12011-03-18 19:57:02774 void OnAllowScriptToClose(bool script_can_close);
775 void OnAsyncFileOpened(base::PlatformFileError error_code,
776 IPC::PlatformFileForTransit file_for_transit,
777 int message_id);
[email protected]eb415bf0e2011-04-14 02:45:42778 void OnPpapiBrokerChannelCreated(int request_id,
[email protected]2b657fd2011-04-18 16:00:47779 base::ProcessHandle broker_process_handle,
[email protected]d54305072011-06-22 20:58:43780 const IPC::ChannelHandle& handle);
[email protected]6e24cf12011-03-18 19:57:02781 void OnCancelDownload(int32 download_id);
782 void OnClearFocusedNode();
[email protected]992db4c2011-05-12 15:37:15783 void OnClosePage();
[email protected]6e24cf12011-03-18 19:57:02784#if defined(ENABLE_FLAPPER_HACKS)
785 void OnConnectTcpACK(int request_id,
786 IPC::PlatformFileForTransit socket_for_transit,
[email protected]5a2b68f2011-11-10 00:00:49787 const PP_NetAddress_Private& local_addr,
788 const PP_NetAddress_Private& remote_addr);
[email protected]6e24cf12011-03-18 19:57:02789#endif
790 void OnContextMenuClosed(
[email protected]35be7ec2012-02-12 20:42:51791 const content::CustomContextMenuContext& custom_context);
[email protected]6e24cf12011-03-18 19:57:02792 void OnCopy();
793 void OnCopyImageAt(int x, int y);
794#if defined(OS_MACOSX)
795 void OnCopyToFindPboard();
796#endif
797 void OnCut();
[email protected]318bf5802011-08-08 17:12:41798 void OnCSSInsertRequest(const string16& frame_xpath,
[email protected]01cf589c2011-07-28 18:04:03799 const std::string& css);
[email protected]6e24cf12011-03-18 19:57:02800 void OnCustomContextMenuAction(
[email protected]35be7ec2012-02-12 20:42:51801 const content::CustomContextMenuContext& custom_context,
[email protected]6e24cf12011-03-18 19:57:02802 unsigned action);
803 void OnDelete();
804 void OnDeterminePageLanguage();
805 void OnDisableScrollbarsForSmallWindows(
806 const gfx::Size& disable_scrollbars_size_limit);
807 void OnDisassociateFromPopupCount();
[email protected]6e24cf12011-03-18 19:57:02808 void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
809 const gfx::Point& screen_point,
810 bool ended,
811 WebKit::WebDragOperation drag_operation);
812 void OnDragSourceSystemDragEnded();
813 void OnDragTargetDrop(const gfx::Point& client_pt,
814 const gfx::Point& screen_pt);
815 void OnDragTargetDragEnter(const WebDropData& drop_data,
816 const gfx::Point& client_pt,
817 const gfx::Point& screen_pt,
818 WebKit::WebDragOperationsMask operations_allowed);
819 void OnDragTargetDragLeave();
820 void OnDragTargetDragOver(const gfx::Point& client_pt,
821 const gfx::Point& screen_pt,
822 WebKit::WebDragOperationsMask operations_allowed);
[email protected]2bf834f2011-11-17 20:02:21823 void OnEnablePreferredSizeChangedMode();
[email protected]244ac1892011-12-02 17:04:47824 void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
[email protected]600ea402011-04-12 00:01:51825 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths);
[email protected]6e24cf12011-03-18 19:57:02826 void OnExecuteEditCommand(const std::string& name, const std::string& value);
[email protected]6e24cf12011-03-18 19:57:02827 void OnFileChooserResponse(const std::vector<FilePath>& paths);
828 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
829 void OnFindReplyAck();
[email protected]18d5be92011-07-25 18:00:19830 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
831 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
832 const std::vector<GURL>& links,
833 const std::vector<FilePath>& local_paths,
834 const FilePath& local_directory_name);
[email protected]6e24cf12011-03-18 19:57:02835 void OnMediaPlayerActionAt(const gfx::Point& location,
836 const WebKit::WebMediaPlayerAction& action);
[email protected]81375e872012-01-11 21:40:36837 void OnPluginActionAt(const gfx::Point& location,
838 const WebKit::WebPluginAction& action);
[email protected]6e24cf12011-03-18 19:57:02839 void OnMoveOrResizeStarted();
[email protected]f3112a52011-09-30 23:47:49840 CONTENT_EXPORT void OnNavigate(const ViewMsg_Navigate_Params& params);
[email protected]6e24cf12011-03-18 19:57:02841 void OnPaste();
[email protected]44bf7002011-10-16 02:46:15842 void OnPasteAndMatchStyle();
[email protected]6e24cf12011-03-18 19:57:02843#if defined(OS_MACOSX)
844 void OnPluginImeCompositionCompleted(const string16& text, int plugin_id);
845#endif
846 void OnRedo();
847 void OnReloadFrame();
848 void OnReplace(const string16& text);
[email protected]6e24cf12011-03-18 19:57:02849 void OnResetPageEncodingToDefault();
850 void OnScriptEvalRequest(const string16& frame_xpath,
851 const string16& jscript,
852 int id,
853 bool notify_result);
854 void OnSelectAll();
[email protected]4fb60142011-08-09 02:22:08855 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
[email protected]6e24cf12011-03-18 19:57:02856 void OnSetActive(bool active);
857 void OnSetAltErrorPageURL(const GURL& gurl);
858 void OnSetBackground(const SkBitmap& background);
[email protected]6e24cf12011-03-18 19:57:02859 void OnSetWebUIProperty(const std::string& name, const std::string& value);
860 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
[email protected]f3112a52011-09-30 23:47:49861 CONTENT_EXPORT void OnSetHistoryLengthAndPrune(int history_length,
862 int32 minimum_page_id);
[email protected]6e24cf12011-03-18 19:57:02863 void OnSetInitialFocus(bool reverse);
[email protected]54ca3ca892011-06-07 21:14:54864#if defined(OS_MACOSX)
865 void OnSetInLiveResize(bool in_live_resize);
866#endif
[email protected]333ec8d02011-09-16 18:59:19867 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
[email protected]6e24cf12011-03-18 19:57:02868 void OnSetPageEncoding(const std::string& encoding_name);
[email protected]daf82f82011-10-31 22:35:31869 void OnSetRendererPrefs(const content::RendererPreferences& renderer_prefs);
[email protected]6e24cf12011-03-18 19:57:02870#if defined(OS_MACOSX)
871 void OnSetWindowVisibility(bool visible);
872#endif
873 void OnSetZoomLevel(double zoom_level);
874 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
[email protected]8a5e0ca2011-08-25 06:30:47875 void OnExitFullscreen();
[email protected]6e24cf12011-03-18 19:57:02876 void OnShouldClose();
877 void OnStop();
[email protected]815dd9872011-11-23 18:40:30878 void OnStopFinding(content::StopFindAction action);
[email protected]73eb2602012-02-09 19:50:55879 CONTENT_EXPORT void OnSwapOut(const ViewMsg_SwapOut_Params& params);
[email protected]6e24cf12011-03-18 19:57:02880 void OnThemeChanged();
[email protected]6e24cf12011-03-18 19:57:02881 void OnUndo();
[email protected]6e24cf12011-03-18 19:57:02882 void OnUpdateTargetURLAck();
883 void OnUpdateWebPreferences(const WebPreferences& prefs);
[email protected]08bb1e722011-07-30 19:13:04884
[email protected]6e24cf12011-03-18 19:57:02885#if defined(OS_MACOSX)
886 void OnWindowFrameChanged(const gfx::Rect& window_frame,
887 const gfx::Rect& view_frame);
888 void OnSelectPopupMenuItem(int selected_index);
889#endif
[email protected]54087fe2011-10-28 22:02:48890 void OnZoom(content::PageZoom zoom);
[email protected]47578fa02011-11-02 19:34:41891 void OnZoomFactor(content::PageZoom zoom, int zoom_center_x,
892 int zoom_center_y);
893
[email protected]5a7b15a2011-08-22 22:48:18894 void OnEnableViewSourceMode();
[email protected]6e24cf12011-03-18 19:57:02895
[email protected]64d0e192011-12-09 14:44:20896 void OnJavaBridgeInit();
[email protected]7f3c7af2011-10-20 22:52:51897
[email protected]6e24cf12011-03-18 19:57:02898 // Adding a new message handler? Please add it in alphabetical order above
899 // and put it in the same position in the .cc file.
900
901 // Misc private functions ----------------------------------------------------
[email protected]47578fa02011-11-02 19:34:41902 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x,
903 int zoom_center_y, float scaling_increment);
[email protected]6e24cf12011-03-18 19:57:02904
[email protected]6e24cf12011-03-18 19:57:02905 void AltErrorPageFinished(WebKit::WebFrame* frame,
906 const WebKit::WebURLError& original_error,
907 const std::string& html);
908
[email protected]d812fd12011-05-27 23:05:07909 // Check whether the preferred size has changed.
[email protected]6e24cf12011-03-18 19:57:02910 void CheckPreferredSize();
911
[email protected]273558fb2012-01-12 15:03:51912 void EnsureMediaStreamImpl();
913
[email protected]5e56df82011-04-18 17:00:15914 // This callback is triggered when DownloadFavicon completes, either
915 // succesfully or with a failure. See DownloadFavicon for more
916 // details.
917 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher,
918 const SkBitmap& image);
[email protected]6e24cf12011-03-18 19:57:02919
[email protected]310ebd6302011-10-10 19:06:28920 // Requests to download a favicon image. When done, the RenderView is notified
921 // by way of DidDownloadFavicon. Returns true if the request was successfully
922 // started, false otherwise. id is used to uniquely identify the request and
923 // passed back to the DidDownloadFavicon method. If the image has multiple
924 // frames, the frame whose size is image_size is returned. If the image
925 // doesn't have a frame at the specified size, the first is returned.
[email protected]5e56df82011-04-18 17:00:15926 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
[email protected]6e24cf12011-03-18 19:57:02927
[email protected]6e24cf12011-03-18 19:57:02928 GURL GetAlternateErrorPageURL(const GURL& failed_url,
929 ErrorPageType error_type);
930
931 // Locates a sub frame with given xpath
[email protected]318bf5802011-08-08 17:12:41932 WebKit::WebFrame* GetChildFrame(const string16& frame_xpath) const;
[email protected]6e24cf12011-03-18 19:57:02933
[email protected]57b9396c2011-10-07 19:11:59934 // Returns the opener url if present, else an empty url.
935 GURL GetOpenerUrl() const;
936
[email protected]69ddf852012-02-21 23:21:31937 // Returns the URL being loaded by the given frame's request.
938 GURL GetLoadingUrl(WebKit::WebFrame* frame) const;
939
[email protected]6e24cf12011-03-18 19:57:02940 WebUIBindings* GetWebUIBindings();
941
[email protected]6e24cf12011-03-18 19:57:02942 // Should only be called if this object wraps a PluginDocument.
943 WebKit::WebPlugin* GetWebPluginFromPluginDocument();
944
[email protected]d466b8a2011-07-15 21:48:03945 // Returns true if the |params| navigation is to an entry that has been
946 // cropped due to a recent navigation the browser did not know about.
947 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params,
948 bool is_reload);
949
[email protected]6e24cf12011-03-18 19:57:02950 // Returns false unless this is a top-level navigation that crosses origins.
951 bool IsNonLocalTopLevelNavigation(const GURL& url,
952 WebKit::WebFrame* frame,
953 WebKit::WebNavigationType type);
954
[email protected]6e24cf12011-03-18 19:57:02955 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame,
956 const WebKit::WebURLError& error,
957 bool replace);
958
[email protected]007733c2011-11-17 00:34:07959 // If we initiated a navigation, this function will populate |document_state|
960 // with the navigation information saved in OnNavigate().
961 void PopulateStateFromPendingNavigationParams(
962 content::DocumentState* document_state);
963
[email protected]6e24cf12011-03-18 19:57:02964 // Starts nav_state_sync_timer_ if it isn't already running.
965 void StartNavStateSyncTimerIfNecessary();
966
967 // Dispatches the current navigation state to the browser. Called on a
968 // periodic timer so we don't send too many messages.
969 void SyncNavigationState();
970
[email protected]b781ff282011-08-20 06:19:36971 // Dispatches the current state of selection on the webpage to the browser if
972 // it has changed.
973 // TODO(varunjain): delete this method once we figure out how to keep
974 // selection handles in sync with the webpage.
975 void SyncSelectionIfRequired();
976
[email protected]c4dabe452012-02-08 23:58:12977#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
[email protected]6e24cf12011-03-18 19:57:02978 void UpdateFontRenderingFromRendererPrefs();
979#else
980 void UpdateFontRenderingFromRendererPrefs() {}
981#endif
982
983 // Update the target url and tell the browser that the target URL has changed.
984 // If |url| is empty, show |fallback_url|.
985 void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
986
[email protected]6e24cf12011-03-18 19:57:02987 // ---------------------------------------------------------------------------
988 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
989 // it in the same order in the .cc file as it was in the header.
990 // ---------------------------------------------------------------------------
991
992 // Settings ------------------------------------------------------------------
993
994 WebPreferences webkit_preferences_;
[email protected]daf82f82011-10-31 22:35:31995 content::RendererPreferences renderer_preferences_;
[email protected]6e24cf12011-03-18 19:57:02996
[email protected]6e24cf12011-03-18 19:57:02997 HostZoomLevels host_zoom_levels_;
998
999 // Whether content state (such as form state, scroll position and page
1000 // contents) should be sent to the browser immediately. This is normally
1001 // false, but set to true by some tests.
1002 bool send_content_state_immediately_;
1003
[email protected]6e24cf12011-03-18 19:57:021004 // Bitwise-ORed set of extra bindings that have been enabled. See
1005 // BindingsPolicy for details.
1006 int enabled_bindings_;
1007
1008 // The alternate error page URL, if one exists.
1009 GURL alternate_error_page_url_;
1010
1011 // If true, we send IPC messages when |preferred_size_| changes.
1012 bool send_preferred_size_changes_;
1013
1014 // If non-empty, and |send_preferred_size_changes_| is true, disable drawing
1015 // scroll bars on windows smaller than this size. Used for windows that the
1016 // browser resizes to the size of the content, such as browser action popups.
1017 // If a render view is set to the minimum size of its content, webkit may add
1018 // scroll bars. This makes sense for fixed sized windows, but it does not
1019 // make sense when the size of the view was chosen to fit the content.
1020 // This setting ensures that no scroll bars are drawn. The size limit exists
1021 // because if the view grows beyond a size known to the browser, scroll bars
1022 // should be drawn.
1023 gfx::Size disable_scrollbars_size_limit_;
1024
[email protected]6e24cf12011-03-18 19:57:021025 // Loading state -------------------------------------------------------------
1026
1027 // True if the top level frame is currently being loaded.
1028 bool is_loading_;
1029
1030 // The gesture that initiated the current navigation.
1031 NavigationGesture navigation_gesture_;
1032
1033 // Used for popups.
1034 bool opened_by_user_gesture_;
1035 GURL creator_url_;
1036
1037 // Whether this RenderView was created by a frame that was suppressing its
1038 // opener. If so, we may want to load pages in a separate process. See
1039 // decidePolicyForNavigation for details.
1040 bool opener_suppressed_;
1041
1042 // If we are handling a top-level client-side redirect, this tracks the URL
1043 // of the page that initiated it. Specifically, when a load is committed this
1044 // is used to determine if that load originated from a client-side redirect.
1045 // It is empty if there is no top-level client-side redirect.
[email protected]445e1042011-12-03 21:03:151046 content::Referrer completed_client_redirect_src_;
[email protected]6e24cf12011-03-18 19:57:021047
[email protected]6e24cf12011-03-18 19:57:021048 // Holds state pertaining to a navigation that we initiated. This is held by
1049 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_
1050 // as a temporary holder for the state until the WebDataSource corresponding
1051 // to the new navigation is created. See DidCreateDataSource.
[email protected]007733c2011-11-17 00:34:071052 scoped_ptr<ViewMsg_Navigate_Params> pending_navigation_params_;
[email protected]6e24cf12011-03-18 19:57:021053
1054 // Timer used to delay the updating of nav state (see SyncNavigationState).
[email protected]310ebd6302011-10-10 19:06:281055 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
[email protected]6e24cf12011-03-18 19:57:021056
[email protected]6e24cf12011-03-18 19:57:021057 // Page IDs ------------------------------------------------------------------
[email protected]a813c8e2011-10-08 01:34:111058 // See documentation in content::RenderView.
[email protected]6e24cf12011-03-18 19:57:021059 int32 page_id_;
1060
1061 // Indicates the ID of the last page that we sent a FrameNavigate to the
1062 // browser for. This is used to determine if the most recent transition
1063 // generated a history entry (less than page_id_), or not (equal to or
1064 // greater than). Note that this will be greater than page_id_ if the user
1065 // goes back.
1066 int32 last_page_id_sent_to_browser_;
1067
[email protected]74ce1ad2011-12-16 21:51:461068 // The next available page ID to use for this RenderView. These IDs are
1069 // specific to a given RenderView and the frames within it.
1070 int32 next_page_id_;
[email protected]6e24cf12011-03-18 19:57:021071
[email protected]d466b8a2011-07-15 21:48:031072 // The offset of the current item in the history list.
1073 int history_list_offset_;
1074
1075 // The RenderView's current impression of the history length. This includes
1076 // any items that have committed in this process, but because of cross-process
1077 // navigations, the history may have some entries that were committed in other
1078 // processes. We won't know about them until the next navigation in this
1079 // process.
1080 int history_list_length_;
1081
1082 // The list of page IDs for each history item this RenderView knows about.
1083 // Some entries may be -1 if they were rendered by other processes or were
1084 // restored from a previous session. This lets us detect attempts to
1085 // navigate to stale entries that have been cropped from our history.
1086 std::vector<int32> history_page_ids_;
1087
[email protected]6e24cf12011-03-18 19:57:021088 // Page info -----------------------------------------------------------------
1089
1090 // The last gotten main frame's encoding.
1091 std::string last_encoding_name_;
1092
[email protected]6e24cf12011-03-18 19:57:021093 // UI state ------------------------------------------------------------------
1094
1095 // The state of our target_url transmissions. When we receive a request to
1096 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
1097 // comes back - if a new request comes in before the ACK, we store the new
1098 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
1099 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
1100 // revert to TARGET_INFLIGHT.
1101 //
1102 // We don't need a queue of URLs to send, as only the latest is useful.
1103 enum {
1104 TARGET_NONE,
1105 TARGET_INFLIGHT, // We have a request in-flight, waiting for an ACK
1106 TARGET_PENDING // INFLIGHT + we have a URL waiting to be sent
1107 } target_url_status_;
1108
1109 // The URL we show the user in the status bar. We use this to determine if we
1110 // want to send a new one (we do not need to send duplicates). It will be
1111 // equal to either |mouse_over_url_| or |focus_url_|, depending on which was
1112 // updated last.
1113 GURL target_url_;
1114
1115 // The URL the user's mouse is hovering over.
1116 GURL mouse_over_url_;
1117
1118 // The URL that has keyboard focus.
1119 GURL focus_url_;
1120
1121 // The next target URL we want to send to the browser.
1122 GURL pending_target_url_;
1123
[email protected]6e24cf12011-03-18 19:57:021124 // The text selection the last time DidChangeSelection got called.
[email protected]e99ef6f2011-10-16 01:13:001125 string16 selection_text_;
1126 size_t selection_text_offset_;
1127 ui::Range selection_range_;
[email protected]6e24cf12011-03-18 19:57:021128
1129 // View ----------------------------------------------------------------------
1130
[email protected]6e24cf12011-03-18 19:57:021131 // Cache the preferred size of the page in order to prevent sending the IPC
1132 // when layout() recomputes but doesn't actually change sizes.
1133 gfx::Size preferred_size_;
1134
[email protected]1e0c8e02011-05-25 07:49:371135 // Used to delay determining the preferred size (to avoid intermediate
1136 // states for the sizes).
[email protected]310ebd6302011-10-10 19:06:281137 base::OneShotTimer<RenderViewImpl> check_preferred_size_timer_;
[email protected]1e0c8e02011-05-25 07:49:371138
[email protected]dd6afca2011-08-13 03:44:311139 // These store the "is main frame is scrolled all the way to the left
1140 // or right" state that was last sent to the browser.
1141 bool cached_is_main_frame_pinned_to_left_;
1142 bool cached_is_main_frame_pinned_to_right_;
1143
1144 // These store the "has scrollbars" state last sent to the browser.
1145 bool cached_has_main_frame_horizontal_scrollbar_;
1146 bool cached_has_main_frame_vertical_scrollbar_;
1147
[email protected]6e24cf12011-03-18 19:57:021148#if defined(OS_MACOSX)
1149 // Track the fake plugin window handles allocated on the browser side for
1150 // the accelerated compositor and (currently) accelerated plugins so that
1151 // we can discard them when the view goes away.
1152 std::set<gfx::PluginWindowHandle> fake_plugin_window_handles_;
1153#endif
1154
[email protected]05a980d7a2012-02-07 22:16:421155 // When this view is composited, the context used for compositing may or may
1156 // not support the GL_CHROMIUM_swapbuffers_complete_callback extension. Since
1157 // querying for the existence of this extension is expensive we cache the
1158 // result. These are used to implement SupportsAsynchronousSwapBuffers().
1159 bool context_has_swapbuffers_complete_callback_;
1160 bool queried_for_swapbuffers_complete_callback_;
1161
[email protected]6e24cf12011-03-18 19:57:021162 // Helper objects ------------------------------------------------------------
1163
[email protected]6e24cf12011-03-18 19:57:021164 RendererWebCookieJarImpl cookie_jar_;
1165
1166 // The next group of objects all implement RenderViewObserver, so are deleted
[email protected]310ebd6302011-10-10 19:06:281167 // along with the RenderView automatically. This is why we just store
1168 // weak references.
[email protected]6e24cf12011-03-18 19:57:021169
[email protected]6e24cf12011-03-18 19:57:021170 // Holds a reference to the service which provides desktop notifications.
1171 NotificationProvider* notification_provider_;
1172
1173 // The geolocation dispatcher attached to this view, lazily initialized.
1174 GeolocationDispatcher* geolocation_dispatcher_;
1175
[email protected]0d9989d2011-12-21 20:26:001176 // The intents host attached to this view. Not lazily initialized.
1177 WebIntentsHost* intents_host_;
[email protected]1ef93132011-09-16 18:33:471178
[email protected]6e24cf12011-03-18 19:57:021179 // The speech dispatcher attached to this view, lazily initialized.
1180 SpeechInputDispatcher* speech_input_dispatcher_;
1181
1182 // Device orientation dispatcher attached to this view; lazily initialized.
1183 DeviceOrientationDispatcher* device_orientation_dispatcher_;
1184
[email protected]273558fb2012-01-12 15:03:511185 // MediaStream dispatcher attached to this view; lazily initialized.
1186 MediaStreamDispatcher* media_stream_dispatcher_;
1187
[email protected]ab2c4732011-07-20 19:57:401188 // MediaStreamImpl attached to this view; lazily initialized.
1189 scoped_refptr<MediaStreamImpl> media_stream_impl_;
1190
[email protected]6e24cf12011-03-18 19:57:021191 // Dispatches all P2P socket used by the renderer.
[email protected]b3f8f9722011-08-25 20:56:071192 content::P2PSocketDispatcher* p2p_socket_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021193
[email protected]c5c1d6d2011-07-28 18:42:411194 DevToolsAgent* devtools_agent_;
1195
[email protected]063afcb2011-09-29 07:54:321196 RendererAccessibility* renderer_accessibility_;
1197
[email protected]7f3c7af2011-10-20 22:52:511198 // Java Bridge dispatcher attached to this view; lazily initialized.
1199 scoped_ptr<JavaBridgeDispatcher> java_bridge_dispatcher_;
1200
[email protected]217690d2012-01-27 07:33:111201 // Mouse Lock dispatcher attached to this view.
1202 MouseLockDispatcher* mouse_lock_dispatcher_;
1203
[email protected]6e24cf12011-03-18 19:57:021204 // Misc ----------------------------------------------------------------------
1205
1206 // The current and pending file chooser completion objects. If the queue is
1207 // nonempty, the first item represents the currently running file chooser
1208 // callback, and the remaining elements are the other file chooser completion
1209 // still waiting to be run (in order).
1210 struct PendingFileChooser;
1211 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_;
1212
[email protected]600ea402011-04-12 00:01:511213 // The current directory enumeration callback
1214 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_;
1215 int enumeration_completion_id_;
1216
[email protected]6e24cf12011-03-18 19:57:021217 // The SessionStorage namespace that we're assigned to has an ID, and that ID
1218 // is passed to us upon creation. WebKit asks for this ID upon first use and
1219 // uses it whenever asking the browser process to allocate new storage areas.
1220 int64 session_storage_namespace_id_;
1221
1222 // The total number of unrequested popups that exist and can be followed back
[email protected]310ebd6302011-10-10 19:06:281223 // to a common opener. This count is shared among all RenderViews created with
1224 // createView(). All popups are treated as unrequested until specifically
1225 // instructed otherwise by the Browser process.
[email protected]6e24cf12011-03-18 19:57:021226 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_;
1227
1228 // Whether this is a top level window (instead of a popup). Top level windows
1229 // shouldn't count against their own |shared_popup_counter_|.
1230 bool decrement_shared_popup_at_destruction_;
1231
1232 // If the browser hasn't sent us an ACK for the last FindReply we sent
1233 // to it, then we need to queue up the message (keeping only the most
1234 // recent message if new ones come in).
1235 scoped_ptr<IPC::Message> queued_find_reply_message_;
1236
1237 // Stores edit commands associated to the next key event.
1238 // Shall be cleared as soon as the next key event is processed.
1239 EditCommands edit_commands_;
1240
[email protected]6e24cf12011-03-18 19:57:021241 // Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS
1242 // object is only exposed when Web UI bindings are enabled.
1243 scoped_ptr<WebUIBindings> web_ui_bindings_;
1244
[email protected]6e24cf12011-03-18 19:57:021245 // The external popup for the currently showing select popup.
1246 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
1247
1248 // The node that the context menu was pressed over.
1249 WebKit::WebNode context_menu_node_;
1250
1251 // Reports load progress to the browser.
1252 scoped_ptr<LoadProgressTracker> load_progress_tracker_;
1253
1254 // All the registered observers. We expect this list to be small, so vector
1255 // is fine.
[email protected]3a034ebb2011-10-03 19:19:441256 ObserverList<content::RenderViewObserver> observers_;
[email protected]6e24cf12011-03-18 19:57:021257
[email protected]4fb60142011-08-09 02:22:081258 // Used to inform didChangeSelection() when it is called in the context
1259 // of handling a ViewMsg_SelectRange IPC.
1260 bool handling_select_range_;
1261
[email protected]217690d2012-01-27 07:33:111262 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
1263 scoped_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
1264
[email protected]ef5e98e2011-12-06 09:49:181265 // Plugins -------------------------------------------------------------------
1266
1267 // All the currently active plugin delegates for this RenderView; kept so
1268 // that we can enumerate them to send updates about things like window
1269 // location or tab focus and visibily. These are non-owning references.
1270 std::set<WebPluginDelegateProxy*> plugin_delegates_;
1271
1272#if defined(OS_WIN)
1273 // The ID of the focused NPAPI plug-in.
1274 int focused_plugin_id_;
1275#endif
1276
[email protected]766a7082012-02-03 23:39:151277 // Allows JS to access DOM automation. The JS object is only exposed when the
1278 // DOM automation bindings are enabled.
1279 scoped_ptr<DomAutomationController> dom_automation_controller_;
1280
[email protected]ef5e98e2011-12-06 09:49:181281 // NOTE: pepper_delegate_ should be last member because its constructor calls
1282 // AddObservers method of RenderViewImpl from c-tor.
1283 PepperPluginDelegateImpl pepper_delegate_;
1284
[email protected]6e24cf12011-03-18 19:57:021285 // ---------------------------------------------------------------------------
1286 // ADDING NEW DATA? Please see if it fits appropriately in one of the above
1287 // sections rather than throwing it randomly at the end. If you're adding a
1288 // bunch of stuff, you should probably create a helper class and put your
[email protected]310ebd6302011-10-10 19:06:281289 // data and methods on that to avoid bloating RenderView more. You can
1290 // use the Observer interface to filter IPC messages and receive frame change
[email protected]6e24cf12011-03-18 19:57:021291 // notifications.
1292 // ---------------------------------------------------------------------------
1293
[email protected]310ebd6302011-10-10 19:06:281294 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
[email protected]6e24cf12011-03-18 19:57:021295};
1296
[email protected]310ebd6302011-10-10 19:06:281297#endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_