blob: a7c893b8fb2404e25790cc4f83fc9d252165d922 [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;
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,
[email protected]916dfb62012-03-05 03:39:37341 const WebKit::WebString& frame_name,
342 WebKit::WebNavigationPolicy policy);
[email protected]6e24cf12011-03-18 19:57:02343 virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
344 virtual WebKit::WebWidget* createPopupMenu(
345 const WebKit::WebPopupMenuInfo& info);
346 virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
347 const WebKit::WebPopupMenuInfo& popup_menu_info,
348 WebKit::WebExternalPopupMenuClient* popup_menu_client);
349 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
350 unsigned quota);
[email protected]7e8b4d12012-01-20 23:39:51351 virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(
[email protected]01e69032012-01-31 05:39:06352 const WebKit::WebGraphicsContext3D::Attributes& attributes,
[email protected]7e8b4d12012-01-20 23:39:51353 bool direct);
[email protected]6e24cf12011-03-18 19:57:02354 virtual void didAddMessageToConsole(
355 const WebKit::WebConsoleMessage& message,
356 const WebKit::WebString& source_name,
357 unsigned source_line);
358 virtual void printPage(WebKit::WebFrame* frame);
359 virtual WebKit::WebNotificationPresenter* notificationPresenter();
[email protected]8a58c1c2011-04-19 18:40:12360 virtual bool enumerateChosenDirectory(
361 const WebKit::WebString& path,
362 WebKit::WebFileChooserCompletion* chooser_completion);
[email protected]6e24cf12011-03-18 19:57:02363 virtual void didStartLoading();
364 virtual void didStopLoading();
365 virtual void didChangeLoadProgress(WebKit::WebFrame* frame,
366 double load_progress);
367 virtual bool isSmartInsertDeleteEnabled();
368 virtual bool isSelectTrailingWhitespaceEnabled();
369 virtual void didChangeSelection(bool is_selection_empty);
370 virtual void didExecuteCommand(const WebKit::WebString& command_name);
371 virtual bool handleCurrentKeyboardEvent();
[email protected]6e24cf12011-03-18 19:57:02372 virtual bool runFileChooser(
373 const WebKit::WebFileChooserParams& params,
374 WebKit::WebFileChooserCompletion* chooser_completion);
375 virtual void runModalAlertDialog(WebKit::WebFrame* frame,
376 const WebKit::WebString& message);
377 virtual bool runModalConfirmDialog(WebKit::WebFrame* frame,
378 const WebKit::WebString& message);
379 virtual bool runModalPromptDialog(WebKit::WebFrame* frame,
380 const WebKit::WebString& message,
381 const WebKit::WebString& default_value,
382 WebKit::WebString* actual_value);
383 virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame* frame,
384 const WebKit::WebString& message);
385 virtual void showContextMenu(WebKit::WebFrame* frame,
386 const WebKit::WebContextMenuData& data);
[email protected]2b624c562011-10-27 22:58:26387 virtual void enterFullscreen();
388 virtual void exitFullscreen();
[email protected]6e24cf12011-03-18 19:57:02389 virtual void setStatusText(const WebKit::WebString& text);
390 virtual void setMouseOverURL(const WebKit::WebURL& url);
391 virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
[email protected]6e24cf12011-03-18 19:57:02392 virtual void startDragging(const WebKit::WebDragData& data,
393 WebKit::WebDragOperationsMask mask,
394 const WebKit::WebImage& image,
395 const WebKit::WebPoint& imageOffset);
396 virtual bool acceptsLoadDrops();
397 virtual void focusNext();
398 virtual void focusPrevious();
399 virtual void focusedNodeChanged(const WebKit::WebNode& node);
[email protected]169d4282011-11-30 19:33:59400 virtual void didUpdateLayout();
[email protected]6e24cf12011-03-18 19:57:02401 virtual void navigateBackForwardSoon(int offset);
402 virtual int historyBackListCount();
403 virtual int historyForwardListCount();
404 virtual void postAccessibilityNotification(
405 const WebKit::WebAccessibilityObject& obj,
406 WebKit::WebAccessibilityNotification notification);
407 virtual void didUpdateInspectorSetting(const WebKit::WebString& key,
408 const WebKit::WebString& value);
409 virtual WebKit::WebGeolocationClient* geolocationClient();
410 virtual WebKit::WebSpeechInputController* speechInputController(
411 WebKit::WebSpeechInputListener* listener);
412 virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient();
413 virtual void zoomLimitsChanged(double minimum_level, double maximum_level);
414 virtual void zoomLevelChanged();
415 virtual void registerProtocolHandler(const WebKit::WebString& scheme,
416 const WebKit::WebString& base_url,
417 const WebKit::WebString& url,
418 const WebKit::WebString& title);
[email protected]94dec932011-05-26 20:04:21419 virtual WebKit::WebPageVisibilityState visibilityState() const;
[email protected]273558fb2012-01-12 15:03:51420 virtual WebKit::WebUserMediaClient* userMediaClient();
[email protected]6e24cf12011-03-18 19:57:02421
422 // WebKit::WebFrameClient implementation -------------------------------------
423
424 virtual WebKit::WebPlugin* createPlugin(
425 WebKit::WebFrame* frame,
426 const WebKit::WebPluginParams& params);
[email protected]6e24cf12011-03-18 19:57:02427 virtual WebKit::WebSharedWorker* createSharedWorker(
428 WebKit::WebFrame* frame, const WebKit::WebURL& url,
429 const WebKit::WebString& name, unsigned long long documentId);
430 virtual WebKit::WebMediaPlayer* createMediaPlayer(
431 WebKit::WebFrame* frame,
432 WebKit::WebMediaPlayerClient* client);
433 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
434 WebKit::WebFrame* frame,
435 WebKit::WebApplicationCacheHostClient* client);
436 virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame);
437 virtual void frameDetached(WebKit::WebFrame* frame);
438 virtual void willClose(WebKit::WebFrame* frame);
[email protected]6e24cf12011-03-18 19:57:02439 virtual void loadURLExternally(WebKit::WebFrame* frame,
440 const WebKit::WebURLRequest& request,
441 WebKit::WebNavigationPolicy policy);
[email protected]0622875ab2011-07-27 12:10:34442 virtual void loadURLExternally(WebKit::WebFrame* frame,
443 const WebKit::WebURLRequest& request,
444 WebKit::WebNavigationPolicy policy,
445 const WebKit::WebString& suggested_name);
[email protected]6e24cf12011-03-18 19:57:02446 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
447 WebKit::WebFrame* frame,
448 const WebKit::WebURLRequest& request,
449 WebKit::WebNavigationType type,
450 const WebKit::WebNode&,
451 WebKit::WebNavigationPolicy default_policy,
452 bool is_redirect);
453 virtual bool canHandleRequest(WebKit::WebFrame* frame,
454 const WebKit::WebURLRequest& request);
455 virtual WebKit::WebURLError cannotHandleRequestError(
456 WebKit::WebFrame* frame,
457 const WebKit::WebURLRequest& request);
458 virtual WebKit::WebURLError cancelledError(
459 WebKit::WebFrame* frame,
460 const WebKit::WebURLRequest& request);
461 virtual void unableToImplementPolicyWithError(
462 WebKit::WebFrame* frame,
463 const WebKit::WebURLError& error);
464 virtual void willSendSubmitEvent(WebKit::WebFrame* frame,
465 const WebKit::WebFormElement& form);
466 virtual void willSubmitForm(WebKit::WebFrame* frame,
467 const WebKit::WebFormElement& form);
468 virtual void willPerformClientRedirect(WebKit::WebFrame* frame,
469 const WebKit::WebURL& from,
470 const WebKit::WebURL& to,
471 double interval,
472 double fire_time);
473 virtual void didCancelClientRedirect(WebKit::WebFrame* frame);
474 virtual void didCompleteClientRedirect(WebKit::WebFrame* frame,
475 const WebKit::WebURL& from);
476 virtual void didCreateDataSource(WebKit::WebFrame* frame,
477 WebKit::WebDataSource* datasource);
478 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame);
479 virtual void didReceiveServerRedirectForProvisionalLoad(
480 WebKit::WebFrame* frame);
481 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame,
482 const WebKit::WebURLError& error);
483 virtual void didReceiveDocumentData(WebKit::WebFrame* frame,
484 const char* data, size_t length,
485 bool& prevent_default);
486 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame,
487 bool is_new_navigation);
488 virtual void didClearWindowObject(WebKit::WebFrame* frame);
489 virtual void didCreateDocumentElement(WebKit::WebFrame* frame);
490 virtual void didReceiveTitle(WebKit::WebFrame* frame,
[email protected]a3bc4d12011-04-20 17:22:21491 const WebKit::WebString& title,
492 WebKit::WebTextDirection direction);
[email protected]42054a252011-05-17 18:02:13493 virtual void didChangeIcon(WebKit::WebFrame*,
494 WebKit::WebIconURL::Type) OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02495 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame);
496 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame);
497 virtual void didFailLoad(WebKit::WebFrame* frame,
498 const WebKit::WebURLError& error);
499 virtual void didFinishLoad(WebKit::WebFrame* frame);
500 virtual void didNavigateWithinPage(WebKit::WebFrame* frame,
501 bool is_new_navigation);
502 virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame);
503 virtual void assignIdentifierToRequest(WebKit::WebFrame* frame,
504 unsigned identifier,
505 const WebKit::WebURLRequest& request);
506 virtual void willSendRequest(WebKit::WebFrame* frame,
507 unsigned identifier,
508 WebKit::WebURLRequest& request,
509 const WebKit::WebURLResponse& redirect_response);
510 virtual void didReceiveResponse(WebKit::WebFrame* frame,
511 unsigned identifier,
512 const WebKit::WebURLResponse& response);
513 virtual void didFinishResourceLoad(WebKit::WebFrame* frame,
514 unsigned identifier);
515 virtual void didFailResourceLoad(WebKit::WebFrame* frame,
516 unsigned identifier,
517 const WebKit::WebURLError& error);
518 virtual void didLoadResourceFromMemoryCache(
519 WebKit::WebFrame* frame,
520 const WebKit::WebURLRequest& request,
521 const WebKit::WebURLResponse&);
522 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame);
523 virtual void didRunInsecureContent(
524 WebKit::WebFrame* frame,
525 const WebKit::WebSecurityOrigin& origin,
526 const WebKit::WebURL& target);
[email protected]b00ba702011-08-17 01:41:03527 virtual void didAdoptURLLoader(WebKit::WebURLLoader* loader);
[email protected]6e24cf12011-03-18 19:57:02528 virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame* frame);
[email protected]5bc10932011-09-21 21:03:30529 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
530 v8::Handle<v8::Context>,
[email protected]a00fe692012-02-27 05:52:58531 int extension_group,
532 int world_id);
533 // TODO(koz): Remove once WebKit no longer calls this.
534 virtual void didCreateScriptContext(WebKit::WebFrame* frame,
535 v8::Handle<v8::Context>,
[email protected]5bc10932011-09-21 21:03:30536 int world_id);
537 virtual void willReleaseScriptContext(WebKit::WebFrame* frame,
538 v8::Handle<v8::Context>,
539 int world_id);
[email protected]6e24cf12011-03-18 19:57:02540 virtual void didChangeScrollOffset(WebKit::WebFrame* frame);
[email protected]dd6afca2011-08-13 03:44:31541 virtual void numberOfWheelEventHandlersChanged(unsigned num_handlers);
[email protected]ea931252012-02-15 22:01:03542 virtual void numberOfTouchEventHandlersChanged(unsigned num_handlers);
[email protected]dd6afca2011-08-13 03:44:31543 virtual void didChangeContentsSize(WebKit::WebFrame* frame,
544 const WebKit::WebSize& size);
[email protected]6e24cf12011-03-18 19:57:02545 virtual void reportFindInPageMatchCount(int request_id,
546 int count,
547 bool final_update);
548 virtual void reportFindInPageSelection(int request_id,
549 int active_match_ordinal,
550 const WebKit::WebRect& sel);
551
552 virtual void openFileSystem(WebKit::WebFrame* frame,
553 WebKit::WebFileSystem::Type type,
554 long long size,
555 bool create,
556 WebKit::WebFileSystemCallbacks* callbacks);
557
[email protected]10e5cf12011-04-13 04:10:40558 virtual void queryStorageUsageAndQuota(
559 WebKit::WebFrame* frame,
560 WebKit::WebStorageQuotaType type,
561 WebKit::WebStorageQuotaCallbacks* callbacks);
562
563 virtual void requestStorageQuota(
564 WebKit::WebFrame* frame,
565 WebKit::WebStorageQuotaType type,
566 unsigned long long requested_size,
567 WebKit::WebStorageQuotaCallbacks* callbacks);
568
[email protected]8b5af492011-11-28 21:50:58569 virtual void registerIntentService(
570 WebKit::WebFrame* frame,
571 const WebKit::WebIntentServiceInfo& service);
572 virtual void dispatchIntent(WebKit::WebFrame* frame,
[email protected]ffc8bed2012-01-21 01:23:15573 const WebKit::WebIntentRequest& intentRequest);
[email protected]8b5af492011-11-28 21:50:58574
[email protected]18d5be92011-07-25 18:00:19575 // WebKit::WebPageSerializerClient implementation ----------------------------
576
577 virtual void didSerializeDataForFrame(
578 const WebKit::WebURL& frame_url,
579 const WebKit::WebCString& data,
580 PageSerializationStatus status) OVERRIDE;
581
[email protected]a2ef54c2011-10-10 16:20:31582 // content::RenderView implementation ----------------------------------------
583
584 virtual bool Send(IPC::Message* message) OVERRIDE;
[email protected]9f76c1e2012-03-05 15:15:58585 virtual int GetRoutingID() const OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31586 virtual int GetPageId() OVERRIDE;
587 virtual gfx::Size GetSize() OVERRIDE;
588 virtual gfx::NativeViewId GetHostWindow() OVERRIDE;
589 virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
590 virtual WebKit::WebView* GetWebView() OVERRIDE;
591 virtual WebKit::WebNode GetFocusedNode() const OVERRIDE;
592 virtual WebKit::WebNode GetContextMenuNode() const OVERRIDE;
593 virtual bool IsEditableNode(const WebKit::WebNode& node) OVERRIDE;
594 virtual WebKit::WebPlugin* CreatePlugin(
595 WebKit::WebFrame* frame,
596 const webkit::WebPluginInfo& info,
597 const WebKit::WebPluginParams& params) OVERRIDE;
598 virtual void EvaluateScript(const string16& frame_xpath,
599 const string16& jscript,
600 int id,
601 bool notify_result) OVERRIDE;
602 virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE;
603 virtual int GetEnabledBindings() OVERRIDE;
[email protected]a2ef54c2011-10-10 16:20:31604 virtual bool GetContentStateImmediately() OVERRIDE;
605 virtual float GetFilteredTimePerFrame() OVERRIDE;
606 virtual void ShowContextMenu(WebKit::WebFrame* frame,
607 const WebKit::WebContextMenuData& data) OVERRIDE;
608 virtual WebKit::WebPageVisibilityState GetVisibilityState() const OVERRIDE;
609 virtual void RunModalAlertDialog(WebKit::WebFrame* frame,
610 const WebKit::WebString& message) OVERRIDE;
611 virtual void LoadURLExternally(
612 WebKit::WebFrame* frame,
613 const WebKit::WebURLRequest& request,
614 WebKit::WebNavigationPolicy policy) OVERRIDE;
615
[email protected]6e24cf12011-03-18 19:57:02616 // webkit_glue::WebPluginPageDelegate implementation -------------------------
617
618 virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
619 const FilePath& file_path,
[email protected]edc64de2011-11-17 20:07:38620 const std::string& mime_type) OVERRIDE;
621 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
622 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) OVERRIDE;
623 virtual void DidMovePlugin(
624 const webkit::npapi::WebPluginGeometry& move) OVERRIDE;
625 virtual void DidStartLoadingForPlugin() OVERRIDE;
626 virtual void DidStopLoadingForPlugin() OVERRIDE;
627 virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02628
[email protected]a9288f52011-11-17 05:18:16629 // webkit_media::WebMediaPlayerDelegate implementation -----------------------
[email protected]baff4512011-10-19 18:21:07630
[email protected]a9288f52011-11-17 05:18:16631 virtual void DidPlay(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
632 virtual void DidPause(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
633 virtual void PlayerGone(webkit_media::WebMediaPlayerImpl* player) OVERRIDE;
[email protected]baff4512011-10-19 18:21:07634
[email protected]6e24cf12011-03-18 19:57:02635 // Please do not add your stuff randomly to the end here. If there is an
636 // appropriate section, add it there. If not, there are some random functions
637 // nearer to the top you can add it to.
[email protected]6e24cf12011-03-18 19:57:02638
[email protected]38b592902011-04-16 02:08:42639 // Cannot use std::set unfortunately since linked_ptr<> does not support
640 // operator<.
641 typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> >
642 ImageResourceFetcherList;
643
[email protected]6e24cf12011-03-18 19:57:02644 protected:
645 // RenderWidget overrides:
[email protected]edc64de2011-11-17 20:07:38646 virtual void Close() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02647 virtual void OnResize(const gfx::Size& new_size,
[email protected]ee41e7d22011-10-14 19:34:09648 const gfx::Rect& resizer_rect,
[email protected]edc64de2011-11-17 20:07:38649 bool is_fullscreen) OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16650 virtual void WillInitiatePaint() OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38651 virtual void DidInitiatePaint() OVERRIDE;
[email protected]29ed96a2012-02-04 18:12:16652 virtual void DidFlushPaint() OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02653 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
654 const gfx::Rect& paint_bounds,
655 TransportDIB** dib,
656 gfx::Rect* location,
[email protected]edc64de2011-11-17 20:07:38657 gfx::Rect* clip) OVERRIDE;
658 virtual gfx::Point GetScrollOffset() OVERRIDE;
659 virtual void DidHandleKeyEvent() OVERRIDE;
[email protected]67bfb83f2011-09-22 03:36:37660 virtual bool WillHandleMouseEvent(
661 const WebKit::WebMouseEvent& event) OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38662 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) OVERRIDE;
663 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) OVERRIDE;
664 virtual void OnSetFocus(bool enable) OVERRIDE;
665 virtual void OnWasHidden() OVERRIDE;
666 virtual void OnWasRestored(bool needs_repainting) OVERRIDE;
[email protected]65225772011-05-12 21:10:24667 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE;
[email protected]56ea1a62011-05-30 07:05:57668 virtual void OnImeSetComposition(
669 const string16& text,
670 const std::vector<WebKit::WebCompositionUnderline>& underlines,
671 int selection_start,
672 int selection_end) OVERRIDE;
[email protected]4de6d1692011-10-12 08:45:44673 virtual void OnImeConfirmComposition(
674 const string16& text, const ui::Range& replacement_range) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45675 virtual ui::TextInputType GetTextInputType() OVERRIDE;
[email protected]3f783362011-10-21 22:40:50676 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE;
[email protected]ad26ef42011-06-17 07:59:45677 virtual bool CanComposeInline() OVERRIDE;
[email protected]c3d45532011-10-07 19:20:40678 virtual bool WebWidgetHandlesCompositorScheduling() const OVERRIDE;
[email protected]6e24cf12011-03-18 19:57:02679
680 private:
[email protected]6e24cf12011-03-18 19:57:02681 // For unit tests.
682 friend class ExternalPopupMenuTest;
683 friend class PepperDeviceTest;
[email protected]c6d068ff2011-10-14 17:28:23684 friend class content::RenderViewTest;
[email protected]6e24cf12011-03-18 19:57:02685
686 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
687 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
688 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]068970d2011-10-11 00:05:16689 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
690 DontIgnoreBackAfterNavEntryLimit);
691 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
692 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
693 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
694 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
695 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
696 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeStateChanged);
697 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
698 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
699 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
[email protected]73eb2602012-02-09 19:50:55700 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
[email protected]068970d2011-10-11 00:05:16701 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
702 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
[email protected]6e24cf12011-03-18 19:57:02703#if defined(OS_MACOSX)
704 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
705#endif
[email protected]068970d2011-10-11 00:05:16706 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune);
[email protected]6e24cf12011-03-18 19:57:02707
[email protected]6e24cf12011-03-18 19:57:02708 typedef std::map<GURL, double> HostZoomLevels;
709
[email protected]6e24cf12011-03-18 19:57:02710 enum ErrorPageType {
711 DNS_ERROR,
712 HTTP_404,
713 CONNECTION_ERROR,
714 };
715
[email protected]310ebd6302011-10-10 19:06:28716 RenderViewImpl(gfx::NativeViewId parent_hwnd,
717 int32 opener_id,
[email protected]daf82f82011-10-31 22:35:31718 const content::RendererPreferences& renderer_prefs,
[email protected]310ebd6302011-10-10 19:06:28719 const WebPreferences& webkit_prefs,
720 SharedRenderViewCounter* counter,
721 int32 routing_id,
[email protected]9f4f3322012-01-18 22:29:56722 int32 surface_id,
[email protected]310ebd6302011-10-10 19:06:28723 int64 session_storage_namespace_id,
[email protected]74ce1ad2011-12-16 21:51:46724 const string16& frame_name,
[email protected]6fd35b72012-03-01 19:46:41725 int32 next_page_id,
726 const WebKit::WebScreenInfo& screen_info);
[email protected]6e24cf12011-03-18 19:57:02727
728 // Do not delete directly. This class is reference counted.
[email protected]310ebd6302011-10-10 19:06:28729 virtual ~RenderViewImpl();
[email protected]6e24cf12011-03-18 19:57:02730
731 void UpdateURL(WebKit::WebFrame* frame);
[email protected]a49e10b2011-08-01 23:57:46732 void UpdateTitle(WebKit::WebFrame* frame, const string16& title,
733 WebKit::WebTextDirection title_direction);
[email protected]6e24cf12011-03-18 19:57:02734 void UpdateSessionHistory(WebKit::WebFrame* frame);
735
736 // Update current main frame's encoding and send it to browser window.
737 // Since we want to let users see the right encoding info from menu
738 // before finishing loading, we call the UpdateEncoding in
739 // a) function:DidCommitLoadForFrame. When this function is called,
740 // that means we have got first data. In here we try to get encoding
741 // of page if it has been specified in http header.
742 // b) function:DidReceiveTitle. When this function is called,
743 // that means we have got specified title. Because in most of webpages,
744 // title tags will follow meta tags. In here we try to get encoding of
745 // page if it has been specified in meta tag.
746 // c) function:DidFinishDocumentLoadForFrame. When this function is
747 // called, that means we have got whole html page. In here we should
748 // finally get right encoding of page.
749 void UpdateEncoding(WebKit::WebFrame* frame,
750 const std::string& encoding_name);
751
[email protected]ae5184d62011-10-06 19:25:58752 void OpenURL(WebKit::WebFrame* frame,
753 const GURL& url,
[email protected]445e1042011-12-03 21:03:15754 const content::Referrer& referrer,
[email protected]6e24cf12011-03-18 19:57:02755 WebKit::WebNavigationPolicy policy);
756
[email protected]269f86d2011-12-07 02:43:47757 bool RunJavaScriptMessage(ui::JavascriptMessageType type,
[email protected]4f5ce842011-05-27 19:34:41758 const string16& message,
759 const string16& default_value,
[email protected]6e24cf12011-03-18 19:57:02760 const GURL& frame_url,
[email protected]4f5ce842011-05-27 19:34:41761 string16* result);
[email protected]6e24cf12011-03-18 19:57:02762
763 // Sends a message and runs a nested message loop.
764 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
765
[email protected]dd6afca2011-08-13 03:44:31766 // Called when the "pinned to left/right edge" state needs to be updated.
767 void UpdateScrollState(WebKit::WebFrame* frame);
768
[email protected]6e24cf12011-03-18 19:57:02769 // IPC message handlers ------------------------------------------------------
770 //
771 // The documentation for these functions should be in
772 // render_messages_internal.h for the message that the function is handling.
773
[email protected]6e24cf12011-03-18 19:57:02774 void OnAllowBindings(int enabled_bindings_flags);
[email protected]6e24cf12011-03-18 19:57:02775 void OnAllowScriptToClose(bool script_can_close);
776 void OnAsyncFileOpened(base::PlatformFileError error_code,
777 IPC::PlatformFileForTransit file_for_transit,
778 int message_id);
[email protected]eb415bf0e2011-04-14 02:45:42779 void OnPpapiBrokerChannelCreated(int request_id,
[email protected]2b657fd2011-04-18 16:00:47780 base::ProcessHandle broker_process_handle,
[email protected]d54305072011-06-22 20:58:43781 const IPC::ChannelHandle& handle);
[email protected]6e24cf12011-03-18 19:57:02782 void OnCancelDownload(int32 download_id);
783 void OnClearFocusedNode();
[email protected]992db4c2011-05-12 15:37:15784 void OnClosePage();
[email protected]6e24cf12011-03-18 19:57:02785#if defined(ENABLE_FLAPPER_HACKS)
786 void OnConnectTcpACK(int request_id,
787 IPC::PlatformFileForTransit socket_for_transit,
[email protected]5a2b68f2011-11-10 00:00:49788 const PP_NetAddress_Private& local_addr,
789 const PP_NetAddress_Private& remote_addr);
[email protected]6e24cf12011-03-18 19:57:02790#endif
791 void OnContextMenuClosed(
[email protected]35be7ec2012-02-12 20:42:51792 const content::CustomContextMenuContext& custom_context);
[email protected]6e24cf12011-03-18 19:57:02793 void OnCopy();
794 void OnCopyImageAt(int x, int y);
795#if defined(OS_MACOSX)
796 void OnCopyToFindPboard();
797#endif
798 void OnCut();
[email protected]318bf5802011-08-08 17:12:41799 void OnCSSInsertRequest(const string16& frame_xpath,
[email protected]01cf589c2011-07-28 18:04:03800 const std::string& css);
[email protected]6e24cf12011-03-18 19:57:02801 void OnCustomContextMenuAction(
[email protected]35be7ec2012-02-12 20:42:51802 const content::CustomContextMenuContext& custom_context,
[email protected]6e24cf12011-03-18 19:57:02803 unsigned action);
804 void OnDelete();
805 void OnDeterminePageLanguage();
806 void OnDisableScrollbarsForSmallWindows(
807 const gfx::Size& disable_scrollbars_size_limit);
808 void OnDisassociateFromPopupCount();
[email protected]6e24cf12011-03-18 19:57:02809 void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
810 const gfx::Point& screen_point,
811 bool ended,
812 WebKit::WebDragOperation drag_operation);
813 void OnDragSourceSystemDragEnded();
814 void OnDragTargetDrop(const gfx::Point& client_pt,
815 const gfx::Point& screen_pt);
816 void OnDragTargetDragEnter(const WebDropData& drop_data,
817 const gfx::Point& client_pt,
818 const gfx::Point& screen_pt,
819 WebKit::WebDragOperationsMask operations_allowed);
820 void OnDragTargetDragLeave();
821 void OnDragTargetDragOver(const gfx::Point& client_pt,
822 const gfx::Point& screen_pt,
823 WebKit::WebDragOperationsMask operations_allowed);
[email protected]2bf834f2011-11-17 20:02:21824 void OnEnablePreferredSizeChangedMode();
[email protected]244ac1892011-12-02 17:04:47825 void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
[email protected]61e2b3cc2012-03-02 16:13:34826 void OnDisableAutoResize(const gfx::Size& new_size);
[email protected]600ea402011-04-12 00:01:51827 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths);
[email protected]6e24cf12011-03-18 19:57:02828 void OnExecuteEditCommand(const std::string& name, const std::string& value);
[email protected]6e24cf12011-03-18 19:57:02829 void OnFileChooserResponse(const std::vector<FilePath>& paths);
830 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
831 void OnFindReplyAck();
[email protected]18d5be92011-07-25 18:00:19832 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
833 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
834 const std::vector<GURL>& links,
835 const std::vector<FilePath>& local_paths,
836 const FilePath& local_directory_name);
[email protected]6e24cf12011-03-18 19:57:02837 void OnMediaPlayerActionAt(const gfx::Point& location,
838 const WebKit::WebMediaPlayerAction& action);
[email protected]81375e872012-01-11 21:40:36839 void OnPluginActionAt(const gfx::Point& location,
840 const WebKit::WebPluginAction& action);
[email protected]6e24cf12011-03-18 19:57:02841 void OnMoveOrResizeStarted();
[email protected]f3112a52011-09-30 23:47:49842 CONTENT_EXPORT void OnNavigate(const ViewMsg_Navigate_Params& params);
[email protected]6e24cf12011-03-18 19:57:02843 void OnPaste();
[email protected]44bf7002011-10-16 02:46:15844 void OnPasteAndMatchStyle();
[email protected]6e24cf12011-03-18 19:57:02845#if defined(OS_MACOSX)
846 void OnPluginImeCompositionCompleted(const string16& text, int plugin_id);
847#endif
848 void OnRedo();
849 void OnReloadFrame();
850 void OnReplace(const string16& text);
[email protected]6e24cf12011-03-18 19:57:02851 void OnResetPageEncodingToDefault();
852 void OnScriptEvalRequest(const string16& frame_xpath,
853 const string16& jscript,
854 int id,
855 bool notify_result);
856 void OnSelectAll();
[email protected]4fb60142011-08-09 02:22:08857 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
[email protected]6e24cf12011-03-18 19:57:02858 void OnSetActive(bool active);
859 void OnSetAltErrorPageURL(const GURL& gurl);
860 void OnSetBackground(const SkBitmap& background);
[email protected]6e24cf12011-03-18 19:57:02861 void OnSetWebUIProperty(const std::string& name, const std::string& value);
862 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
[email protected]f3112a52011-09-30 23:47:49863 CONTENT_EXPORT void OnSetHistoryLengthAndPrune(int history_length,
864 int32 minimum_page_id);
[email protected]6e24cf12011-03-18 19:57:02865 void OnSetInitialFocus(bool reverse);
[email protected]54ca3ca892011-06-07 21:14:54866#if defined(OS_MACOSX)
867 void OnSetInLiveResize(bool in_live_resize);
868#endif
[email protected]333ec8d02011-09-16 18:59:19869 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
[email protected]6e24cf12011-03-18 19:57:02870 void OnSetPageEncoding(const std::string& encoding_name);
[email protected]daf82f82011-10-31 22:35:31871 void OnSetRendererPrefs(const content::RendererPreferences& renderer_prefs);
[email protected]6e24cf12011-03-18 19:57:02872#if defined(OS_MACOSX)
873 void OnSetWindowVisibility(bool visible);
874#endif
875 void OnSetZoomLevel(double zoom_level);
876 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
[email protected]8a5e0ca2011-08-25 06:30:47877 void OnExitFullscreen();
[email protected]6e24cf12011-03-18 19:57:02878 void OnShouldClose();
879 void OnStop();
[email protected]815dd9872011-11-23 18:40:30880 void OnStopFinding(content::StopFindAction action);
[email protected]73eb2602012-02-09 19:50:55881 CONTENT_EXPORT void OnSwapOut(const ViewMsg_SwapOut_Params& params);
[email protected]6e24cf12011-03-18 19:57:02882 void OnThemeChanged();
[email protected]6e24cf12011-03-18 19:57:02883 void OnUndo();
[email protected]6e24cf12011-03-18 19:57:02884 void OnUpdateTargetURLAck();
885 void OnUpdateWebPreferences(const WebPreferences& prefs);
[email protected]08bb1e722011-07-30 19:13:04886
[email protected]6e24cf12011-03-18 19:57:02887#if defined(OS_MACOSX)
888 void OnWindowFrameChanged(const gfx::Rect& window_frame,
889 const gfx::Rect& view_frame);
890 void OnSelectPopupMenuItem(int selected_index);
891#endif
[email protected]54087fe2011-10-28 22:02:48892 void OnZoom(content::PageZoom zoom);
[email protected]47578fa02011-11-02 19:34:41893 void OnZoomFactor(content::PageZoom zoom, int zoom_center_x,
894 int zoom_center_y);
895
[email protected]5a7b15a2011-08-22 22:48:18896 void OnEnableViewSourceMode();
[email protected]6e24cf12011-03-18 19:57:02897
[email protected]64d0e192011-12-09 14:44:20898 void OnJavaBridgeInit();
[email protected]7f3c7af2011-10-20 22:52:51899
[email protected]6e24cf12011-03-18 19:57:02900 // Adding a new message handler? Please add it in alphabetical order above
901 // and put it in the same position in the .cc file.
902
903 // Misc private functions ----------------------------------------------------
[email protected]47578fa02011-11-02 19:34:41904 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x,
905 int zoom_center_y, float scaling_increment);
[email protected]6e24cf12011-03-18 19:57:02906
[email protected]6e24cf12011-03-18 19:57:02907 void AltErrorPageFinished(WebKit::WebFrame* frame,
908 const WebKit::WebURLError& original_error,
909 const std::string& html);
910
[email protected]d812fd12011-05-27 23:05:07911 // Check whether the preferred size has changed.
[email protected]6e24cf12011-03-18 19:57:02912 void CheckPreferredSize();
913
[email protected]273558fb2012-01-12 15:03:51914 void EnsureMediaStreamImpl();
915
[email protected]5e56df82011-04-18 17:00:15916 // This callback is triggered when DownloadFavicon completes, either
917 // succesfully or with a failure. See DownloadFavicon for more
918 // details.
919 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher,
920 const SkBitmap& image);
[email protected]6e24cf12011-03-18 19:57:02921
[email protected]310ebd6302011-10-10 19:06:28922 // Requests to download a favicon image. When done, the RenderView is notified
923 // by way of DidDownloadFavicon. Returns true if the request was successfully
924 // started, false otherwise. id is used to uniquely identify the request and
925 // passed back to the DidDownloadFavicon method. If the image has multiple
926 // frames, the frame whose size is image_size is returned. If the image
927 // doesn't have a frame at the specified size, the first is returned.
[email protected]5e56df82011-04-18 17:00:15928 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
[email protected]6e24cf12011-03-18 19:57:02929
[email protected]6e24cf12011-03-18 19:57:02930 GURL GetAlternateErrorPageURL(const GURL& failed_url,
931 ErrorPageType error_type);
932
933 // Locates a sub frame with given xpath
[email protected]318bf5802011-08-08 17:12:41934 WebKit::WebFrame* GetChildFrame(const string16& frame_xpath) const;
[email protected]6e24cf12011-03-18 19:57:02935
[email protected]57b9396c2011-10-07 19:11:59936 // Returns the opener url if present, else an empty url.
937 GURL GetOpenerUrl() const;
938
[email protected]69ddf852012-02-21 23:21:31939 // Returns the URL being loaded by the given frame's request.
940 GURL GetLoadingUrl(WebKit::WebFrame* frame) const;
941
[email protected]6e24cf12011-03-18 19:57:02942 WebUIBindings* GetWebUIBindings();
943
[email protected]6e24cf12011-03-18 19:57:02944 // Should only be called if this object wraps a PluginDocument.
945 WebKit::WebPlugin* GetWebPluginFromPluginDocument();
946
[email protected]d466b8a2011-07-15 21:48:03947 // Returns true if the |params| navigation is to an entry that has been
948 // cropped due to a recent navigation the browser did not know about.
949 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params,
950 bool is_reload);
951
[email protected]6e24cf12011-03-18 19:57:02952 // Returns false unless this is a top-level navigation that crosses origins.
953 bool IsNonLocalTopLevelNavigation(const GURL& url,
954 WebKit::WebFrame* frame,
955 WebKit::WebNavigationType type);
956
[email protected]6e24cf12011-03-18 19:57:02957 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame,
958 const WebKit::WebURLError& error,
959 bool replace);
960
[email protected]007733c2011-11-17 00:34:07961 // If we initiated a navigation, this function will populate |document_state|
962 // with the navigation information saved in OnNavigate().
963 void PopulateStateFromPendingNavigationParams(
964 content::DocumentState* document_state);
965
[email protected]6e24cf12011-03-18 19:57:02966 // Starts nav_state_sync_timer_ if it isn't already running.
967 void StartNavStateSyncTimerIfNecessary();
968
969 // Dispatches the current navigation state to the browser. Called on a
970 // periodic timer so we don't send too many messages.
971 void SyncNavigationState();
972
[email protected]b781ff282011-08-20 06:19:36973 // Dispatches the current state of selection on the webpage to the browser if
974 // it has changed.
975 // TODO(varunjain): delete this method once we figure out how to keep
976 // selection handles in sync with the webpage.
977 void SyncSelectionIfRequired();
978
[email protected]c4dabe452012-02-08 23:58:12979#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
[email protected]6e24cf12011-03-18 19:57:02980 void UpdateFontRenderingFromRendererPrefs();
981#else
982 void UpdateFontRenderingFromRendererPrefs() {}
983#endif
984
985 // Update the target url and tell the browser that the target URL has changed.
986 // If |url| is empty, show |fallback_url|.
987 void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
988
[email protected]6e24cf12011-03-18 19:57:02989 // ---------------------------------------------------------------------------
990 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
991 // it in the same order in the .cc file as it was in the header.
992 // ---------------------------------------------------------------------------
993
994 // Settings ------------------------------------------------------------------
995
996 WebPreferences webkit_preferences_;
[email protected]daf82f82011-10-31 22:35:31997 content::RendererPreferences renderer_preferences_;
[email protected]6e24cf12011-03-18 19:57:02998
[email protected]6e24cf12011-03-18 19:57:02999 HostZoomLevels host_zoom_levels_;
1000
1001 // Whether content state (such as form state, scroll position and page
1002 // contents) should be sent to the browser immediately. This is normally
1003 // false, but set to true by some tests.
1004 bool send_content_state_immediately_;
1005
[email protected]6e24cf12011-03-18 19:57:021006 // Bitwise-ORed set of extra bindings that have been enabled. See
1007 // BindingsPolicy for details.
1008 int enabled_bindings_;
1009
1010 // The alternate error page URL, if one exists.
1011 GURL alternate_error_page_url_;
1012
1013 // If true, we send IPC messages when |preferred_size_| changes.
1014 bool send_preferred_size_changes_;
1015
1016 // If non-empty, and |send_preferred_size_changes_| is true, disable drawing
1017 // scroll bars on windows smaller than this size. Used for windows that the
1018 // browser resizes to the size of the content, such as browser action popups.
1019 // If a render view is set to the minimum size of its content, webkit may add
1020 // scroll bars. This makes sense for fixed sized windows, but it does not
1021 // make sense when the size of the view was chosen to fit the content.
1022 // This setting ensures that no scroll bars are drawn. The size limit exists
1023 // because if the view grows beyond a size known to the browser, scroll bars
1024 // should be drawn.
1025 gfx::Size disable_scrollbars_size_limit_;
1026
[email protected]6e24cf12011-03-18 19:57:021027 // Loading state -------------------------------------------------------------
1028
1029 // True if the top level frame is currently being loaded.
1030 bool is_loading_;
1031
1032 // The gesture that initiated the current navigation.
1033 NavigationGesture navigation_gesture_;
1034
1035 // Used for popups.
1036 bool opened_by_user_gesture_;
1037 GURL creator_url_;
1038
1039 // Whether this RenderView was created by a frame that was suppressing its
1040 // opener. If so, we may want to load pages in a separate process. See
1041 // decidePolicyForNavigation for details.
1042 bool opener_suppressed_;
1043
1044 // If we are handling a top-level client-side redirect, this tracks the URL
1045 // of the page that initiated it. Specifically, when a load is committed this
1046 // is used to determine if that load originated from a client-side redirect.
1047 // It is empty if there is no top-level client-side redirect.
[email protected]445e1042011-12-03 21:03:151048 content::Referrer completed_client_redirect_src_;
[email protected]6e24cf12011-03-18 19:57:021049
[email protected]6e24cf12011-03-18 19:57:021050 // Holds state pertaining to a navigation that we initiated. This is held by
1051 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_
1052 // as a temporary holder for the state until the WebDataSource corresponding
1053 // to the new navigation is created. See DidCreateDataSource.
[email protected]007733c2011-11-17 00:34:071054 scoped_ptr<ViewMsg_Navigate_Params> pending_navigation_params_;
[email protected]6e24cf12011-03-18 19:57:021055
1056 // Timer used to delay the updating of nav state (see SyncNavigationState).
[email protected]310ebd6302011-10-10 19:06:281057 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
[email protected]6e24cf12011-03-18 19:57:021058
[email protected]6e24cf12011-03-18 19:57:021059 // Page IDs ------------------------------------------------------------------
[email protected]a813c8e2011-10-08 01:34:111060 // See documentation in content::RenderView.
[email protected]6e24cf12011-03-18 19:57:021061 int32 page_id_;
1062
1063 // Indicates the ID of the last page that we sent a FrameNavigate to the
1064 // browser for. This is used to determine if the most recent transition
1065 // generated a history entry (less than page_id_), or not (equal to or
1066 // greater than). Note that this will be greater than page_id_ if the user
1067 // goes back.
1068 int32 last_page_id_sent_to_browser_;
1069
[email protected]74ce1ad2011-12-16 21:51:461070 // The next available page ID to use for this RenderView. These IDs are
1071 // specific to a given RenderView and the frames within it.
1072 int32 next_page_id_;
[email protected]6e24cf12011-03-18 19:57:021073
[email protected]d466b8a2011-07-15 21:48:031074 // The offset of the current item in the history list.
1075 int history_list_offset_;
1076
1077 // The RenderView's current impression of the history length. This includes
1078 // any items that have committed in this process, but because of cross-process
1079 // navigations, the history may have some entries that were committed in other
1080 // processes. We won't know about them until the next navigation in this
1081 // process.
1082 int history_list_length_;
1083
1084 // The list of page IDs for each history item this RenderView knows about.
1085 // Some entries may be -1 if they were rendered by other processes or were
1086 // restored from a previous session. This lets us detect attempts to
1087 // navigate to stale entries that have been cropped from our history.
1088 std::vector<int32> history_page_ids_;
1089
[email protected]6e24cf12011-03-18 19:57:021090 // Page info -----------------------------------------------------------------
1091
1092 // The last gotten main frame's encoding.
1093 std::string last_encoding_name_;
1094
[email protected]6e24cf12011-03-18 19:57:021095 // UI state ------------------------------------------------------------------
1096
1097 // The state of our target_url transmissions. When we receive a request to
1098 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
1099 // comes back - if a new request comes in before the ACK, we store the new
1100 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
1101 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
1102 // revert to TARGET_INFLIGHT.
1103 //
1104 // We don't need a queue of URLs to send, as only the latest is useful.
1105 enum {
1106 TARGET_NONE,
1107 TARGET_INFLIGHT, // We have a request in-flight, waiting for an ACK
1108 TARGET_PENDING // INFLIGHT + we have a URL waiting to be sent
1109 } target_url_status_;
1110
1111 // The URL we show the user in the status bar. We use this to determine if we
1112 // want to send a new one (we do not need to send duplicates). It will be
1113 // equal to either |mouse_over_url_| or |focus_url_|, depending on which was
1114 // updated last.
1115 GURL target_url_;
1116
1117 // The URL the user's mouse is hovering over.
1118 GURL mouse_over_url_;
1119
1120 // The URL that has keyboard focus.
1121 GURL focus_url_;
1122
1123 // The next target URL we want to send to the browser.
1124 GURL pending_target_url_;
1125
[email protected]6e24cf12011-03-18 19:57:021126 // The text selection the last time DidChangeSelection got called.
[email protected]e99ef6f2011-10-16 01:13:001127 string16 selection_text_;
1128 size_t selection_text_offset_;
1129 ui::Range selection_range_;
[email protected]6e24cf12011-03-18 19:57:021130
1131 // View ----------------------------------------------------------------------
1132
[email protected]6e24cf12011-03-18 19:57:021133 // Cache the preferred size of the page in order to prevent sending the IPC
1134 // when layout() recomputes but doesn't actually change sizes.
1135 gfx::Size preferred_size_;
1136
[email protected]1e0c8e02011-05-25 07:49:371137 // Used to delay determining the preferred size (to avoid intermediate
1138 // states for the sizes).
[email protected]310ebd6302011-10-10 19:06:281139 base::OneShotTimer<RenderViewImpl> check_preferred_size_timer_;
[email protected]1e0c8e02011-05-25 07:49:371140
[email protected]dd6afca2011-08-13 03:44:311141 // These store the "is main frame is scrolled all the way to the left
1142 // or right" state that was last sent to the browser.
1143 bool cached_is_main_frame_pinned_to_left_;
1144 bool cached_is_main_frame_pinned_to_right_;
1145
1146 // These store the "has scrollbars" state last sent to the browser.
1147 bool cached_has_main_frame_horizontal_scrollbar_;
1148 bool cached_has_main_frame_vertical_scrollbar_;
1149
[email protected]6e24cf12011-03-18 19:57:021150#if defined(OS_MACOSX)
1151 // Track the fake plugin window handles allocated on the browser side for
1152 // the accelerated compositor and (currently) accelerated plugins so that
1153 // we can discard them when the view goes away.
1154 std::set<gfx::PluginWindowHandle> fake_plugin_window_handles_;
1155#endif
1156
[email protected]05a980d7a2012-02-07 22:16:421157 // When this view is composited, the context used for compositing may or may
1158 // not support the GL_CHROMIUM_swapbuffers_complete_callback extension. Since
1159 // querying for the existence of this extension is expensive we cache the
1160 // result. These are used to implement SupportsAsynchronousSwapBuffers().
1161 bool context_has_swapbuffers_complete_callback_;
1162 bool queried_for_swapbuffers_complete_callback_;
1163
[email protected]6e24cf12011-03-18 19:57:021164 // Helper objects ------------------------------------------------------------
1165
[email protected]6e24cf12011-03-18 19:57:021166 RendererWebCookieJarImpl cookie_jar_;
1167
1168 // The next group of objects all implement RenderViewObserver, so are deleted
[email protected]310ebd6302011-10-10 19:06:281169 // along with the RenderView automatically. This is why we just store
1170 // weak references.
[email protected]6e24cf12011-03-18 19:57:021171
[email protected]6e24cf12011-03-18 19:57:021172 // Holds a reference to the service which provides desktop notifications.
1173 NotificationProvider* notification_provider_;
1174
1175 // The geolocation dispatcher attached to this view, lazily initialized.
1176 GeolocationDispatcher* geolocation_dispatcher_;
1177
[email protected]0d9989d2011-12-21 20:26:001178 // The intents host attached to this view. Not lazily initialized.
1179 WebIntentsHost* intents_host_;
[email protected]1ef93132011-09-16 18:33:471180
[email protected]6e24cf12011-03-18 19:57:021181 // The speech dispatcher attached to this view, lazily initialized.
1182 SpeechInputDispatcher* speech_input_dispatcher_;
1183
1184 // Device orientation dispatcher attached to this view; lazily initialized.
1185 DeviceOrientationDispatcher* device_orientation_dispatcher_;
1186
[email protected]273558fb2012-01-12 15:03:511187 // MediaStream dispatcher attached to this view; lazily initialized.
1188 MediaStreamDispatcher* media_stream_dispatcher_;
1189
[email protected]ab2c4732011-07-20 19:57:401190 // MediaStreamImpl attached to this view; lazily initialized.
1191 scoped_refptr<MediaStreamImpl> media_stream_impl_;
1192
[email protected]6e24cf12011-03-18 19:57:021193 // Dispatches all P2P socket used by the renderer.
[email protected]b3f8f9722011-08-25 20:56:071194 content::P2PSocketDispatcher* p2p_socket_dispatcher_;
[email protected]6e24cf12011-03-18 19:57:021195
[email protected]c5c1d6d2011-07-28 18:42:411196 DevToolsAgent* devtools_agent_;
1197
[email protected]063afcb2011-09-29 07:54:321198 RendererAccessibility* renderer_accessibility_;
1199
[email protected]7f3c7af2011-10-20 22:52:511200 // Java Bridge dispatcher attached to this view; lazily initialized.
1201 scoped_ptr<JavaBridgeDispatcher> java_bridge_dispatcher_;
1202
[email protected]217690d2012-01-27 07:33:111203 // Mouse Lock dispatcher attached to this view.
1204 MouseLockDispatcher* mouse_lock_dispatcher_;
1205
[email protected]6e24cf12011-03-18 19:57:021206 // Misc ----------------------------------------------------------------------
1207
1208 // The current and pending file chooser completion objects. If the queue is
1209 // nonempty, the first item represents the currently running file chooser
1210 // callback, and the remaining elements are the other file chooser completion
1211 // still waiting to be run (in order).
1212 struct PendingFileChooser;
1213 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_;
1214
[email protected]600ea402011-04-12 00:01:511215 // The current directory enumeration callback
1216 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_;
1217 int enumeration_completion_id_;
1218
[email protected]6e24cf12011-03-18 19:57:021219 // The SessionStorage namespace that we're assigned to has an ID, and that ID
1220 // is passed to us upon creation. WebKit asks for this ID upon first use and
1221 // uses it whenever asking the browser process to allocate new storage areas.
1222 int64 session_storage_namespace_id_;
1223
1224 // The total number of unrequested popups that exist and can be followed back
[email protected]310ebd6302011-10-10 19:06:281225 // to a common opener. This count is shared among all RenderViews created with
1226 // createView(). All popups are treated as unrequested until specifically
1227 // instructed otherwise by the Browser process.
[email protected]6e24cf12011-03-18 19:57:021228 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_;
1229
1230 // Whether this is a top level window (instead of a popup). Top level windows
1231 // shouldn't count against their own |shared_popup_counter_|.
1232 bool decrement_shared_popup_at_destruction_;
1233
1234 // If the browser hasn't sent us an ACK for the last FindReply we sent
1235 // to it, then we need to queue up the message (keeping only the most
1236 // recent message if new ones come in).
1237 scoped_ptr<IPC::Message> queued_find_reply_message_;
1238
1239 // Stores edit commands associated to the next key event.
1240 // Shall be cleared as soon as the next key event is processed.
1241 EditCommands edit_commands_;
1242
[email protected]6e24cf12011-03-18 19:57:021243 // Allows Web UI pages (new tab page, etc.) to talk to the browser. The JS
1244 // object is only exposed when Web UI bindings are enabled.
1245 scoped_ptr<WebUIBindings> web_ui_bindings_;
1246
[email protected]6e24cf12011-03-18 19:57:021247 // The external popup for the currently showing select popup.
1248 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
1249
1250 // The node that the context menu was pressed over.
1251 WebKit::WebNode context_menu_node_;
1252
1253 // Reports load progress to the browser.
1254 scoped_ptr<LoadProgressTracker> load_progress_tracker_;
1255
1256 // All the registered observers. We expect this list to be small, so vector
1257 // is fine.
[email protected]3a034ebb2011-10-03 19:19:441258 ObserverList<content::RenderViewObserver> observers_;
[email protected]6e24cf12011-03-18 19:57:021259
[email protected]4fb60142011-08-09 02:22:081260 // Used to inform didChangeSelection() when it is called in the context
1261 // of handling a ViewMsg_SelectRange IPC.
1262 bool handling_select_range_;
1263
[email protected]217690d2012-01-27 07:33:111264 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
1265 scoped_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
1266
[email protected]ef5e98e2011-12-06 09:49:181267 // Plugins -------------------------------------------------------------------
1268
1269 // All the currently active plugin delegates for this RenderView; kept so
1270 // that we can enumerate them to send updates about things like window
1271 // location or tab focus and visibily. These are non-owning references.
1272 std::set<WebPluginDelegateProxy*> plugin_delegates_;
1273
1274#if defined(OS_WIN)
1275 // The ID of the focused NPAPI plug-in.
1276 int focused_plugin_id_;
1277#endif
1278
[email protected]766a7082012-02-03 23:39:151279 // Allows JS to access DOM automation. The JS object is only exposed when the
1280 // DOM automation bindings are enabled.
1281 scoped_ptr<DomAutomationController> dom_automation_controller_;
1282
[email protected]ef5e98e2011-12-06 09:49:181283 // NOTE: pepper_delegate_ should be last member because its constructor calls
1284 // AddObservers method of RenderViewImpl from c-tor.
1285 PepperPluginDelegateImpl pepper_delegate_;
1286
[email protected]6e24cf12011-03-18 19:57:021287 // ---------------------------------------------------------------------------
1288 // ADDING NEW DATA? Please see if it fits appropriately in one of the above
1289 // sections rather than throwing it randomly at the end. If you're adding a
1290 // bunch of stuff, you should probably create a helper class and put your
[email protected]310ebd6302011-10-10 19:06:281291 // data and methods on that to avoid bloating RenderView more. You can
1292 // use the Observer interface to filter IPC messages and receive frame change
[email protected]6e24cf12011-03-18 19:57:021293 // notifications.
1294 // ---------------------------------------------------------------------------
1295
[email protected]310ebd6302011-10-10 19:06:281296 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
[email protected]6e24cf12011-03-18 19:57:021297};
1298
[email protected]310ebd6302011-10-10 19:06:281299#endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_