blob: 4863460d6fa04a24ce4446835ff569e889881c8f [file] [log] [blame]
[email protected]227692c52013-05-31 22:43:041// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
6#define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
7
[email protected]7a4e2532013-12-02 21:30:028#include <vector>
9
[email protected]227692c52013-05-31 22:43:0410#include "base/basictypes.h"
[email protected]7a4e2532013-12-02 21:30:0211#include "base/files/file_path.h"
[email protected]a09d53ce2014-01-31 00:46:4212#include "base/gtest_prod_util.h"
13#include "base/id_map.h"
xhwang430baee2015-01-22 05:46:2014#include "base/memory/scoped_ptr.h"
[email protected]abc501e2014-01-27 19:27:2615#include "base/memory/weak_ptr.h"
[email protected]2e2d9632013-12-03 00:55:2616#include "base/observer_list.h"
[email protected]7a4e2532013-12-02 21:30:0217#include "base/process/process_handle.h"
[email protected]95640212014-07-26 18:14:3018#include "content/common/accessibility_mode_enums.h"
clamyda97e8322014-10-07 21:57:2519#include "content/common/frame_message_enums.h"
[email protected]c52a1412014-06-25 06:09:2520#include "content/common/mojo/service_registry_impl.h"
[email protected]87de04b02014-04-08 22:14:4921#include "content/public/common/javascript_message_type.h"
[email protected]65920f332014-03-04 21:14:1822#include "content/public/common/referrer.h"
[email protected]227692c52013-05-31 22:43:0423#include "content/public/renderer/render_frame.h"
[email protected]5a7100d2014-05-19 01:29:0424#include "content/renderer/render_frame_proxy.h"
[email protected]f3add922013-12-20 23:17:1625#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0426#include "ipc/ipc_message.h"
acolwell9e0840d2014-09-06 19:01:3227#include "media/blink/webmediaplayer_delegate.h"
[email protected]95640212014-07-26 18:14:3028#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4129#include "third_party/WebKit/public/web/WebDataSource.h"
30#include "third_party/WebKit/public/web/WebFrameClient.h"
[email protected]680575542014-04-03 17:12:5231#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
zhenwd47fd722014-11-13 00:43:4732#include "third_party/WebKit/public/web/WebTransitionElementData.h"
[email protected]4ee64622014-03-21 22:34:1533#include "ui/gfx/range/range.h"
[email protected]227692c52013-05-31 22:43:0434
tommyclid481c482014-12-03 01:50:4135#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3836#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4137#endif
38
[email protected]a017938b2014-05-27 21:17:1739#if defined(OS_ANDROID)
40#include "content/renderer/media/android/renderer_media_player_manager.h"
41#endif
42
clamy9bfeef42014-09-30 20:50:4243class GURL;
[email protected]7a4e2532013-12-02 21:30:0244class TransportDIB;
zhenw70986bd2014-10-20 18:50:2645struct FrameHostMsg_AddNavigationTransitionData_Params;
kenrba7199832015-01-22 23:44:5946struct FrameMsg_NewFrame_WidgetParams;
[email protected]7a4e2532013-12-02 21:30:0247
48namespace blink {
[email protected]5ee7f182014-04-25 19:45:2649class WebGeolocationClient;
[email protected]7a4e2532013-12-02 21:30:0250class WebMouseEvent;
[email protected]82ce5b92014-03-22 05:15:2651class WebContentDecryptionModule;
[email protected]96307312014-05-04 01:00:1952class WebMediaPlayer;
avayvodbca35fad2015-01-29 20:20:5753class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0254class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2655class WebSecurityOrigin;
[email protected]7a4e2532013-12-02 21:30:0256struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4257struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0258struct WebCursorInfo;
zhenwd47fd722014-11-13 00:43:4759struct WebTransitionElementData;
[email protected]7a4e2532013-12-02 21:30:0260}
61
62namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4263class Point;
[email protected]7a4e2532013-12-02 21:30:0264class Range;
65class Rect;
66}
67
jrummell109c3a602014-12-18 01:08:5068namespace media {
xhwang60b430a2015-02-01 05:20:4669class MediaPermission;
jrummell109c3a602014-12-18 01:08:5070class WebEncryptedMediaClientImpl;
71}
72
[email protected]227692c52013-05-31 22:43:0473namespace content {
74
[email protected]bffc8302014-01-23 20:52:1675class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:5976class CompositorDependencies;
avi485e5fd62014-08-25 23:26:1477class ExternalPopupMenu;
[email protected]8eae0802014-06-02 21:35:5578class GeolocationDispatcher;
mlamouriefdca9d2014-09-16 16:55:4079class ManifestManager;
[email protected]977db4a42014-07-17 08:04:3280class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:0881class MediaStreamRendererFactory;
xhwang36b1f3b2015-01-27 17:54:0182class MediaPermissionDispatcher;
[email protected]52d3e172014-06-16 16:57:0283class MidiDispatcher;
[email protected]4459599e2014-07-29 22:40:0984class NotificationPermissionDispatcher;
clamyda97e8322014-10-07 21:57:2585class PageState;
[email protected]7a4e2532013-12-02 21:30:0286class PepperPluginInstanceImpl;
avayvodbca35fad2015-01-29 20:20:5787class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:0288class PushMessagingDispatcher;
[email protected]95640212014-07-26 18:14:3089class RendererAccessibility;
[email protected]4b556cf2014-06-10 23:21:5390class RendererCdmManager;
91class RendererMediaPlayerManager;
[email protected]7a4e2532013-12-02 21:30:0292class RendererPpapiHost;
[email protected]2e2d9632013-12-03 00:55:2693class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:0494class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:0295class RenderWidget;
96class RenderWidgetFullscreenPepper;
[email protected]cf78eda2014-06-13 16:57:4197class ScreenOrientationDispatcher;
perkj1a2d0432014-09-03 13:52:3398class UserMediaClientImpl;
alexmose48b1df932015-01-16 01:34:1799enum class SandboxFlags;
clamy9bfeef42014-09-30 20:50:42100struct CommitNavigationParams;
101struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42102struct CustomContextMenuContext;
alexmosbc7eafa2014-12-06 01:38:09103struct FrameReplicationState;
clamycbe86a0c2015-03-05 17:40:02104struct HistoryNavigationParams;
clamy79b3da62014-10-14 08:50:37105struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04106struct ResourceResponseHead;
clamy34e12782015-03-12 11:26:13107struct StartNavigationParams;
[email protected]227692c52013-05-31 22:43:04108
[email protected]85d85fd2013-06-19 00:57:41109class CONTENT_EXPORT RenderFrameImpl
110 : public RenderFrame,
[email protected]96307312014-05-04 01:00:19111 NON_EXPORTED_BASE(public blink::WebFrameClient),
acolwell9e0840d2014-09-06 19:01:32112 NON_EXPORTED_BASE(public media::WebMediaPlayerDelegate) {
[email protected]227692c52013-05-31 22:43:04113 public:
[email protected]2f61bdd2013-07-02 18:38:47114 // Creates a new RenderFrame. |render_view| is the RenderView object that this
115 // frame belongs to.
[email protected]b70da4c2014-01-06 19:57:09116 // Callers *must* call |SetWebFrame| immediately after creation.
[email protected]82307f6b2014-08-07 03:30:12117 // Note: This is called only when RenderFrame is created by Blink through
118 // createChildFrame.
[email protected]b70da4c2014-01-06 19:57:09119 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed.
[email protected]2f61bdd2013-07-02 18:38:47120 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
121
[email protected]82307f6b2014-08-07 03:30:12122 // Creates a new RenderFrame with |routing_id| as a child of the RenderFrame
123 // identified by |parent_routing_id| or as the top-level frame if the latter
japhete6adf142014-10-31 00:01:49124 // is MSG_ROUTING_NONE. If |proxy_routing_id| is MSG_ROUTING_NONE, it creates
125 // the Blink WebLocalFrame and inserts it in the proper place in the frame
126 // tree. Otherwise, the frame is semi-orphaned until it commits, at which
127 // point it replaces the proxy identified by |proxy_routing_id|.
[email protected]82307f6b2014-08-07 03:30:12128 // Note: This is called only when RenderFrame is being created in response to
129 // IPC message from the browser process. All other frame creation is driven
130 // through Blink and Create.
japhete6adf142014-10-31 00:01:49131 static void CreateFrame(int routing_id,
132 int parent_routing_id,
alexmose48b1df932015-01-16 01:34:17133 int proxy_routing_id,
kenrba7199832015-01-22 23:44:59134 const FrameReplicationState& replicated_state,
135 CompositorDependencies* compositor_deps,
136 const FrameMsg_NewFrame_WidgetParams& params);
[email protected]82307f6b2014-08-07 03:30:12137
[email protected]5a7100d2014-05-19 01:29:04138 // Returns the RenderFrameImpl for the given routing ID.
139 static RenderFrameImpl* FromRoutingID(int routing_id);
140
[email protected]a5ac6dc2014-01-15 07:02:14141 // Just like RenderFrame::FromWebFrame but returns the implementation.
142 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09143
[email protected]2f61bdd2013-07-02 18:38:47144 // Used by content_layouttest_support to hook into the creation of
145 // RenderFrameImpls.
dongseong.hwangb721ddf2014-12-10 21:22:50146 using CreateRenderFrameImplFunction = RenderFrameImpl* (*)(RenderViewImpl*,
147 int32);
[email protected]2f61bdd2013-07-02 18:38:47148 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50149 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47150
alexmose48b1df932015-01-16 01:34:17151 static content::SandboxFlags WebToContentSandboxFlags(
152 blink::WebSandboxFlags flags);
153
154 static blink::WebSandboxFlags ContentToWebSandboxFlags(
155 content::SandboxFlags flags);
156
[email protected]227692c52013-05-31 22:43:04157 virtual ~RenderFrameImpl();
158
[email protected]b70da4c2014-01-06 19:57:09159 bool is_swapped_out() const {
160 return is_swapped_out_;
161 }
162
[email protected]5a7100d2014-05-19 01:29:04163 // TODO(nasko): This can be removed once we don't have a swapped out state on
164 // RenderFrames. See https://crbug.com/357747.
165 void set_render_frame_proxy(RenderFrameProxy* proxy) {
166 render_frame_proxy_ = proxy;
167 }
168
[email protected]bffc8302014-01-23 20:52:16169 // Out-of-process child frames receive a signal from RenderWidgetCompositor
170 // when a compositor frame has committed.
171 void DidCommitCompositorFrame();
172
[email protected]7a4e2532013-12-02 21:30:02173 // TODO(jam): this is a temporary getter until all the code is transitioned
174 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26175 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02176
[email protected]f3add922013-12-20 23:17:16177 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
178
[email protected]7a4e2532013-12-02 21:30:02179 // Returns the RenderWidget associated with this frame.
180 RenderWidget* GetRenderWidget();
181
[email protected]35b2a972014-04-04 15:50:22182 // This is called right after creation with the WebLocalFrame for this
[email protected]0287e762014-04-11 13:07:58183 // RenderFrame. It must be called before Initialize.
[email protected]35b2a972014-04-04 15:50:22184 void SetWebFrame(blink::WebLocalFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09185
[email protected]0287e762014-04-11 13:07:58186 // This method must be called after the frame has been added to the frame
187 // tree. It creates all objects that depend on the frame being at its proper
188 // spot.
189 void Initialize();
190
[email protected]de3c5d82014-05-28 22:12:59191 // Notifications from RenderWidget.
192 void WasHidden();
193 void WasShown();
194
[email protected]723971b2014-02-12 11:08:25195 // Start/Stop loading notifications.
196 // TODO(nasko): Those are page-level methods at this time and come from
197 // WebViewClient. We should move them to be WebFrameClient calls and put
198 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09199 // |to_different_document| will be true unless the load is a fragment
200 // navigation, or triggered by history.pushState/replaceState.
[email protected]6dd5c322014-03-12 07:58:46201 virtual void didStartLoading(bool to_different_document);
202 virtual void didStopLoading();
203 virtual void didChangeLoadProgress(double load_progress);
[email protected]723971b2014-02-12 11:08:25204
[email protected]95640212014-07-26 18:14:30205 AccessibilityMode accessibility_mode() {
206 return accessibility_mode_;
207 }
208
209 RendererAccessibility* renderer_accessibility() {
210 return renderer_accessibility_;
211 }
212
213 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
214 blink::WebAXEvent event);
215
estade31c54342015-01-23 03:34:36216 // The focused node changed to |node|. If focus was lost from this frame,
217 // |node| will be null.
[email protected]95640212014-07-26 18:14:30218 void FocusedNodeChanged(const blink::WebNode& node);
219
estade31c54342015-01-23 03:34:36220 // TODO(dmazzoni): the only reason this is here is to plumb it through to
221 // RendererAccessibility. It should use the RenderFrameObserver method, once
222 // blink has a separate accessibility tree per frame.
223 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
224
[email protected]7a4e2532013-12-02 21:30:02225#if defined(ENABLE_PLUGINS)
[email protected]271ff5792013-12-04 22:29:31226 // Notification that a PPAPI plugin has been created.
227 void PepperPluginCreated(RendererPpapiHost* host);
228
[email protected]7a4e2532013-12-02 21:30:02229 // Notifies that |instance| has changed the cursor.
230 // This will update the cursor appearance if it is currently over the plugin
231 // instance.
232 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
233 const blink::WebCursorInfo& cursor);
234
235 // Notifies that |instance| has received a mouse event.
236 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
237
[email protected]7a4e2532013-12-02 21:30:02238 // Informs the render view that a PPAPI plugin has changed text input status.
239 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
240 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
241
242 // Cancels current composition.
243 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
244
245 // Informs the render view that a PPAPI plugin has changed selection.
246 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
247
248 // Creates a fullscreen container for a pepper plugin instance.
249 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
250 PepperPluginInstanceImpl* plugin);
251
[email protected]7a4e2532013-12-02 21:30:02252 bool IsPepperAcceptingCompositionEvents() const;
253
254 // Notification that the given plugin has crashed.
255 void PluginCrashed(const base::FilePath& plugin_path,
256 base::ProcessId plugin_pid);
257
[email protected]7a4e2532013-12-02 21:30:02258 // Simulates IME events for testing purpose.
259 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26260 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02261 const std::vector<blink::WebCompositionUnderline>& underlines,
262 int selection_start,
263 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26264 void SimulateImeConfirmComposition(const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02265 const gfx::Range& replacement_range);
266
267 // TODO(jam): remove these once the IPC handler moves from RenderView to
268 // RenderFrame.
269 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42270 const base::string16& text,
271 const std::vector<blink::WebCompositionUnderline>& underlines,
272 int selection_start,
273 int selection_end);
274 void OnImeConfirmComposition(const base::string16& text,
275 const gfx::Range& replacement_range,
276 bool keep_selection);
277#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02278
[email protected]977db4a42014-07-17 08:04:32279 // May return NULL in some cases, especially if userMediaClient() returns
280 // NULL.
281 MediaStreamDispatcher* GetMediaStreamDispatcher();
282
avi485e5fd62014-08-25 23:26:14283#if defined(OS_MACOSX) || defined(OS_ANDROID)
284 void DidHideExternalPopupMenu();
285#endif
286
[email protected]227692c52013-05-31 22:43:04287 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52288 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04289
290 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52291 bool OnMessageReceived(const IPC::Message& msg) override;
[email protected]227692c52013-05-31 22:43:04292
[email protected]271ff5792013-12-04 22:29:31293 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52294 RenderView* GetRenderView() override;
295 int GetRoutingID() override;
296 blink::WebLocalFrame* GetWebFrame() override;
estade78d655f82015-01-30 01:55:08297 blink::WebElement GetFocusedElement() const override;
dcheng6d18e402014-10-21 12:32:52298 WebPreferences& GetWebkitPreferences() override;
299 int ShowContextMenu(ContextMenuClient* client,
300 const ContextMenuParams& params) override;
301 void CancelContextMenu(int request_id) override;
302 blink::WebNode GetContextMenuNode() const override;
tommycli59bd86c2014-12-10 02:09:38303 blink::WebPlugin* CreatePlugin(
304 blink::WebFrame* frame,
305 const WebPluginInfo& info,
306 const blink::WebPluginParams& params,
tommyclie8722702015-01-16 11:40:41307 scoped_ptr<PluginInstanceThrottler> throttler) override;
dcheng6d18e402014-10-21 12:32:52308 void LoadURLExternally(blink::WebLocalFrame* frame,
309 const blink::WebURLRequest& request,
310 blink::WebNavigationPolicy policy) override;
311 void ExecuteJavaScript(const base::string16& javascript) override;
312 bool IsHidden() override;
313 ServiceRegistry* GetServiceRegistry() override;
tommyclid481c482014-12-03 01:50:41314#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38315 void RegisterPeripheralPlugin(
316 const GURL& content_origin,
317 const base::Closure& unthrottle_callback) override;
tommyclid7798e12015-02-09 21:08:56318 PluginPowerSaverHelper* plugin_power_saver_helper() {
319 return plugin_power_saver_helper_;
320 }
tommyclid481c482014-12-03 01:50:41321#endif
dcheng6d18e402014-10-21 12:32:52322 bool IsFTPDirectoryListing() override;
323 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52324 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52325 void SetSelectedText(const base::string16& selection_text,
326 size_t offset,
327 const gfx::Range& range) override;
328 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
329 v8::Handle<v8::Context> context) override;
[email protected]271ff5792013-12-04 22:29:31330
[email protected]96307312014-05-04 01:00:19331 // blink::WebFrameClient implementation:
jbroman73e9f7962014-10-30 00:43:45332 blink::WebPluginPlaceholder* createPluginPlaceholder(
333 blink::WebLocalFrame*,
334 const blink::WebPluginParams&) override;
[email protected]35b2a972014-04-04 15:50:22335 virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
336 const blink::WebPluginParams& params);
jrummell65b7d272014-09-24 20:49:27337 // TODO(jrummell): Remove this method once blink updated.
[email protected]180ef242013-11-07 06:50:46338 virtual blink::WebMediaPlayer* createMediaPlayer(
[email protected]35b2a972014-04-04 15:50:22339 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46340 const blink::WebURL& url,
341 blink::WebMediaPlayerClient* client);
jrummell65b7d272014-09-24 20:49:27342 virtual blink::WebMediaPlayer* createMediaPlayer(
343 blink::WebLocalFrame* frame,
344 const blink::WebURL& url,
345 blink::WebMediaPlayerClient* client,
346 blink::WebContentDecryptionModule* initial_cdm);
[email protected]180ef242013-11-07 06:50:46347 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
[email protected]35b2a972014-04-04 15:50:22348 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46349 blink::WebApplicationCacheHostClient* client);
mlamouria5b294552015-03-09 16:16:36350 virtual blink::WebWorkerContentSettingsClientProxy*
351 createWorkerContentSettingsClientProxy(blink::WebLocalFrame* frame);
[email protected]b20c3222014-08-22 00:50:22352 virtual blink::WebExternalPopupMenu* createExternalPopupMenu(
353 const blink::WebPopupMenuInfo& popup_menu_info,
354 blink::WebExternalPopupMenuClient* popup_menu_client);
[email protected]35b2a972014-04-04 15:50:22355 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame);
[email protected]180ef242013-11-07 06:50:46356 virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider(
[email protected]35b2a972014-04-04 15:50:22357 blink::WebLocalFrame* frame);
358 virtual void didAccessInitialDocument(blink::WebLocalFrame* frame);
alexmose48b1df932015-01-16 01:34:17359 virtual blink::WebFrame* createChildFrame(
360 blink::WebLocalFrame* parent,
361 const blink::WebString& name,
362 blink::WebSandboxFlags sandboxFlags);
[email protected]35b2a972014-04-04 15:50:22363 virtual void didDisownOpener(blink::WebLocalFrame* frame);
[email protected]180ef242013-11-07 06:50:46364 virtual void frameDetached(blink::WebFrame* frame);
[email protected]9c9343b2014-03-08 02:56:07365 virtual void frameFocused();
[email protected]180ef242013-11-07 06:50:46366 virtual void willClose(blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22367 virtual void didChangeName(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46368 const blink::WebString& name);
alexmos6b294562015-03-05 19:24:10369 virtual void didChangeSandboxFlags(blink::WebFrame* child_frame,
370 blink::WebSandboxFlags flags);
[email protected]f5b6dd1122013-10-04 02:42:50371 virtual void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22372 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46373 const blink::WebVector<blink::WebString>& newly_matching_selectors,
374 const blink::WebVector<blink::WebString>& stopped_matching_selectors);
[email protected]c31a84802014-04-03 15:55:49375 virtual bool shouldReportDetailedMessageForSource(
376 const blink::WebString& source);
377 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
378 const blink::WebString& source_name,
379 unsigned source_line,
380 const blink::WebString& stack_trace);
[email protected]35b2a972014-04-04 15:50:22381 virtual void loadURLExternally(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46382 const blink::WebURLRequest& request,
[email protected]35b2a972014-04-04 15:50:22383 blink::WebNavigationPolicy policy,
384 const blink::WebString& suggested_name);
[email protected]1a4e9752013-12-31 20:10:58385 // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass.
[email protected]180ef242013-11-07 06:50:46386 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
[email protected]0c3c54f2014-07-31 01:29:00387 const NavigationPolicyInfo& info);
[email protected]680575542014-04-03 17:12:52388 virtual blink::WebHistoryItem historyItemForNewChildFrame(
389 blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22390 virtual void willSendSubmitEvent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46391 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22392 virtual void willSubmitForm(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46393 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22394 virtual void didCreateDataSource(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46395 blink::WebDataSource* datasource);
[email protected]0c3c54f2014-07-31 01:29:00396 virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame,
japhet69a06302014-12-12 19:37:14397 bool is_transition_navigation,
398 double triggering_event_time);
[email protected]85d85fd2013-06-19 00:57:41399 virtual void didReceiveServerRedirectForProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22400 blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41401 virtual void didFailProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22402 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46403 const blink::WebURLError& error);
[email protected]680575542014-04-03 17:12:52404 virtual void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22405 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52406 const blink::WebHistoryItem& item,
407 blink::WebHistoryCommitType commit_type);
rob5ef11ff2014-11-17 23:56:20408 virtual void didCreateNewDocument(blink::WebLocalFrame* frame);
[email protected]06181e52014-05-10 11:59:09409 virtual void didClearWindowObject(blink::WebLocalFrame* frame);
[email protected]35b2a972014-04-04 15:50:22410 virtual void didCreateDocumentElement(blink::WebLocalFrame* frame);
411 virtual void didReceiveTitle(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46412 const blink::WebString& title,
413 blink::WebTextDirection direction);
[email protected]35b2a972014-04-04 15:50:22414 virtual void didChangeIcon(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46415 blink::WebIconURL::Type icon_type);
[email protected]35b2a972014-04-04 15:50:22416 virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame);
417 virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame);
418 virtual void didFailLoad(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46419 const blink::WebURLError& error);
[email protected]45d877f2014-04-05 07:36:22420 virtual void didFinishLoad(blink::WebLocalFrame* frame);
421 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52422 const blink::WebHistoryItem& item,
423 blink::WebHistoryCommitType commit_type);
[email protected]35b2a972014-04-04 15:50:22424 virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
[email protected]9e6bea412014-08-08 06:35:25425 virtual void addNavigationTransitionData(
zhenwd47fd722014-11-13 00:43:47426 const blink::WebTransitionElementData& data);
[email protected]37b64c52014-07-11 21:14:05427 virtual void didChangeThemeColor();
alexmosf40ce5b02015-02-25 20:19:56428 virtual void dispatchLoad();
[email protected]4459599e2014-07-29 22:40:09429 virtual void requestNotificationPermission(
430 const blink::WebSecurityOrigin& origin,
431 blink::WebNotificationPermissionCallback* callback);
[email protected]c3f2c702014-03-19 23:39:48432 virtual void didChangeSelection(bool is_empty_selection);
[email protected]f3c59d62014-04-09 16:33:55433 virtual blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19434 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55435 const blink::WebColor& initial_color,
436 const blink::WebVector<blink::WebColorSuggestion>& suggestions);
[email protected]87de04b02014-04-08 22:14:49437 virtual void runModalAlertDialog(const blink::WebString& message);
438 virtual bool runModalConfirmDialog(const blink::WebString& message);
439 virtual bool runModalPromptDialog(const blink::WebString& message,
440 const blink::WebString& default_value,
441 blink::WebString* actual_value);
442 virtual bool runModalBeforeUnloadDialog(bool is_reload,
443 const blink::WebString& message);
[email protected]12cc5112014-03-03 17:01:10444 virtual void showContextMenu(const blink::WebContextMenuData& data);
[email protected]91070342014-03-07 00:29:02445 virtual void clearContextMenu();
[email protected]35b2a972014-04-04 15:50:22446 virtual void willSendRequest(blink::WebLocalFrame* frame,
447 unsigned identifier,
448 blink::WebURLRequest& request,
449 const blink::WebURLResponse& redirect_response);
450 virtual void didReceiveResponse(blink::WebLocalFrame* frame,
451 unsigned identifier,
452 const blink::WebURLResponse& response);
453 virtual void didFinishResourceLoad(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14454 unsigned identifier);
[email protected]85d85fd2013-06-19 00:57:41455 virtual void didLoadResourceFromMemoryCache(
[email protected]35b2a972014-04-04 15:50:22456 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46457 const blink::WebURLRequest& request,
458 const blink::WebURLResponse& response);
[email protected]35b2a972014-04-04 15:50:22459 virtual void didDisplayInsecureContent(blink::WebLocalFrame* frame);
460 virtual void didRunInsecureContent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46461 const blink::WebSecurityOrigin& origin,
462 const blink::WebURL& target);
[email protected]35b2a972014-04-04 15:50:22463 virtual void didAbortLoading(blink::WebLocalFrame* frame);
464 virtual void didCreateScriptContext(blink::WebLocalFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41465 v8::Handle<v8::Context> context,
466 int extension_group,
[email protected]255eea092013-06-28 17:19:14467 int world_id);
[email protected]35b2a972014-04-04 15:50:22468 virtual void willReleaseScriptContext(blink::WebLocalFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41469 v8::Handle<v8::Context> context,
[email protected]255eea092013-06-28 17:19:14470 int world_id);
[email protected]35b2a972014-04-04 15:50:22471 virtual void didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame* frame);
[email protected]35b2a972014-04-04 15:50:22472 virtual void didChangeScrollOffset(blink::WebLocalFrame* frame);
473 virtual void willInsertBody(blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41474 virtual void reportFindInPageMatchCount(int request_id,
475 int count,
[email protected]255eea092013-06-28 17:19:14476 bool final_update);
[email protected]85d85fd2013-06-19 00:57:41477 virtual void reportFindInPageSelection(int request_id,
478 int active_match_ordinal,
[email protected]180ef242013-11-07 06:50:46479 const blink::WebRect& sel);
[email protected]35b2a972014-04-04 15:50:22480 virtual void requestStorageQuota(blink::WebLocalFrame* frame,
481 blink::WebStorageQuotaType type,
482 unsigned long long requested_size,
483 blink::WebStorageQuotaCallbacks callbacks);
[email protected]a14903e02014-06-02 07:35:12484 virtual void willOpenWebSocket(blink::WebSocketHandle* handle);
[email protected]5ee7f182014-04-25 19:45:26485 virtual blink::WebGeolocationClient* geolocationClient();
[email protected]45920862014-07-02 12:53:02486 virtual blink::WebPushClient* pushClient();
avayvodbca35fad2015-01-29 20:20:57487 virtual blink::WebPresentationClient* presentationClient();
[email protected]85d85fd2013-06-19 00:57:41488 virtual void willStartUsingPeerConnectionHandler(
[email protected]35b2a972014-04-04 15:50:22489 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46490 blink::WebRTCPeerConnectionHandler* handler);
[email protected]bfe45e22014-04-25 16:47:53491 virtual blink::WebUserMediaClient* userMediaClient();
jrummell109c3a602014-12-18 01:08:50492 virtual blink::WebEncryptedMediaClient* encryptedMediaClient();
[email protected]8538385f2014-04-25 19:45:04493 virtual blink::WebMIDIClient* webMIDIClient();
[email protected]85d85fd2013-06-19 00:57:41494 virtual bool willCheckAndDispatchMessageEvent(
[email protected]ce5064f2014-05-07 22:49:20495 blink::WebLocalFrame* source_frame,
496 blink::WebFrame* target_frame,
497 blink::WebSecurityOrigin target_origin,
[email protected]180ef242013-11-07 06:50:46498 blink::WebDOMMessageEvent event);
[email protected]35b2a972014-04-04 15:50:22499 virtual blink::WebString userAgentOverride(blink::WebLocalFrame* frame,
500 const blink::WebURL& url);
501 virtual blink::WebString doNotTrackValue(blink::WebLocalFrame* frame);
502 virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value);
503 virtual void didLoseWebGLContext(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14504 int arb_robustness_status_code);
[email protected]cf78eda2014-06-13 16:57:41505 virtual blink::WebScreenOrientationClient* webScreenOrientationClient();
nhirokifebadeed2014-10-29 04:02:47506 virtual bool isControlledByServiceWorker(blink::WebDataSource& data_source);
507 virtual int64_t serviceWorkerID(blink::WebDataSource& data_source);
dmazzoni0b5d2482014-09-10 19:45:57508 virtual void postAccessibilityEvent(const blink::WebAXObject& obj,
509 blink::WebAXEvent event);
dmazzoni1a69e2b32014-11-06 20:34:28510 virtual void handleAccessibilityFindInPageResult(
511 int identifier,
512 int match_index,
513 const blink::WebAXObject& start_object,
514 int start_offset,
515 const blink::WebAXObject& end_object,
516 int end_offset);
mlamouriefdca9d2014-09-16 16:55:40517 virtual void didChangeManifest(blink::WebLocalFrame*);
avayvod5efd9a922015-03-13 15:41:02518 virtual void didChangeDefaultPresentation(blink::WebLocalFrame*);
mlamouri7a78d6fd2015-01-17 13:23:53519 virtual bool enterFullscreen();
520 virtual bool exitFullscreen();
clamydf1975e2015-02-05 19:12:24521 void suddenTerminationDisablerChanged(
522 bool present,
523 blink::WebFrameClient::SuddenTerminationDisablerType type) override;
[email protected]85d85fd2013-06-19 00:57:41524
[email protected]96307312014-05-04 01:00:19525 // WebMediaPlayerDelegate implementation:
dcheng6d18e402014-10-21 12:32:52526 void DidPlay(blink::WebMediaPlayer* player) override;
527 void DidPause(blink::WebMediaPlayer* player) override;
528 void PlayerGone(blink::WebMediaPlayer* player) override;
[email protected]96307312014-05-04 01:00:19529
[email protected]c6bc20332014-02-28 18:30:39530 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
531 // this back to private member.
clamy34e12782015-03-12 11:26:13532 void OnNavigate(const CommonNavigationParams& common_params,
533 const StartNavigationParams& start_params,
534 const CommitNavigationParams& commit_params,
535 const HistoryNavigationParams& history_params);
[email protected]c6bc20332014-02-28 18:30:39536
nasko78f06bc2014-11-18 18:18:57537 // Make this frame show an empty, unscriptable page.
538 // TODO(nasko): Remove this method once swapped out state is no longer used.
539 void NavigateToSwappedOutURL();
540
rockot775ce0d2015-01-27 18:35:01541 // Binds this render frame's service registry.
[email protected]c52a1412014-06-25 06:09:25542 void BindServiceRegistry(
rockot775ce0d2015-01-27 18:35:01543 mojo::InterfaceRequest<mojo::ServiceProvider> services,
544 mojo::ServiceProviderPtr exposed_services);
[email protected]c52a1412014-06-25 06:09:25545
mlamouri4fff1992014-09-30 11:22:46546 ManifestManager* manifest_manager();
547
[email protected]2f61bdd2013-07-02 18:38:47548 protected:
549 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
550
[email protected]227692c52013-05-31 22:43:04551 private:
[email protected]2e2d9632013-12-03 00:55:26552 friend class RenderFrameObserver;
[email protected]95640212014-07-26 18:14:30553 friend class RendererAccessibilityTest;
avi485e5fd62014-08-25 23:26:14554 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
555 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
556 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
557 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]66bbadaf2014-03-28 16:25:54558 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
559 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]4ee64622014-03-21 22:34:15560 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
561 OnExtendSelectionAndDelete);
[email protected]66bbadaf2014-03-28 16:25:54562 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut);
563 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
alexmosbc7eafa2014-12-06 01:38:09564 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OriginReplicationForSwapOut);
[email protected]4ee64622014-03-21 22:34:15565 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
566 SetEditableSelectionAndComposition);
[email protected]95640212014-07-26 18:14:30567 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
568 OnSetAccessibilityMode);
[email protected]2e2d9632013-12-03 00:55:26569
[email protected]37567b432014-02-12 01:12:22570 typedef std::map<GURL, double> HostZoomLevels;
571
[email protected]2e2d9632013-12-03 00:55:26572 // Functions to add and remove observers for this object.
573 void AddObserver(RenderFrameObserver* observer);
574 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34575
[email protected]f0906a02014-08-07 07:18:55576 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35577 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
578 blink::WebHistoryCommitType commit_type);
[email protected]37567b432014-02-12 01:12:22579
[email protected]b70da4c2014-01-06 19:57:09580 // IPC message handlers ------------------------------------------------------
581 //
582 // The documentation for these functions should be in
583 // content/common/*_messages.h for the message that the function is handling.
[email protected]f76f32232014-03-11 17:36:17584 void OnBeforeUnload();
alexmosbc7eafa2014-12-06 01:38:09585 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56586 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09587 const FrameReplicationState& replicated_frame_state);
Nasko Oskov85f60222014-08-28 22:53:30588 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42589 void OnShowContextMenu(const gfx::Point& location);
590 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
591 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
592 unsigned action);
[email protected]4ee64622014-03-21 22:34:15593 void OnUndo();
594 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07595 void OnCut();
596 void OnCopy();
597 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15598 void OnPasteAndMatchStyle();
599 void OnDelete();
600 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14601 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
[email protected]4ee64622014-03-21 22:34:15602 void OnUnselect();
christiankaeed9862014-11-05 10:49:14603 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17604 void OnReplace(const base::string16& text);
605 void OnReplaceMisspelling(const base::string16& text);
[email protected]e31b8ebb2014-03-07 17:59:34606 void OnCSSInsertRequest(const std::string& css);
[email protected]f13ab892014-03-12 06:48:52607 void OnJavaScriptExecuteRequest(const base::string16& javascript,
608 int id,
609 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28610 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
611 int id,
612 bool notify_result);
igsolla1cea67b72015-02-11 16:25:04613 void OnVisualStateRequest(uint64 key);
[email protected]4ee64622014-03-21 22:34:15614 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16615 void OnSetCompositionFromExistingText(
616 int start, int end,
617 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24618 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16619 void OnExtendSelectionAndDelete(int before, int after);
[email protected]4fed3702014-04-01 09:08:00620 void OnReload(bool ignore_cache);
[email protected]96bb6132014-06-16 17:22:19621 void OnTextSurroundingSelectionRequest(size_t max_length);
[email protected]2e531f72014-06-20 23:23:39622 void OnAddStyleSheetByURL(const std::string& url);
[email protected]9e6bea412014-08-08 06:35:25623 void OnSetupTransitionView(const std::string& markup);
zhenwe8f14fc2014-11-25 01:00:54624 void OnBeginExitTransition(const std::string& css_selector,
625 bool exit_to_native_app);
zhenw5a707892014-12-10 02:31:03626 void OnRevertExitTransition();
zhenwabf9b9d2014-11-15 04:04:18627 void OnHideTransitionElements(const std::string& css_selector);
628 void OnShowTransitionElements(const std::string& css_selector);
[email protected]95640212014-07-26 18:14:30629 void OnSetAccessibilityMode(AccessibilityMode new_mode);
creisbbbeb062014-08-25 18:20:31630 void OnDisownOpener();
alexmos6b294562015-03-05 19:24:10631 void OnDidUpdateSandboxFlags(SandboxFlags flags);
avi485e5fd62014-08-25 23:26:14632#if defined(OS_ANDROID)
633 void OnSelectPopupMenuItems(bool canceled,
634 const std::vector<int>& selected_indices);
635#elif defined(OS_MACOSX)
636 void OnSelectPopupMenuItem(int selected_index);
[email protected]4ee64622014-03-21 22:34:15637 void OnCopyToFindPboard();
638#endif
[email protected]9c9343b2014-03-08 02:56:07639
davidbena5496d62014-10-07 18:52:04640 void OnCommitNavigation(const ResourceResponseHead& response,
641 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42642 const CommonNavigationParams& common_params,
clamycbe86a0c2015-03-05 17:40:02643 const CommitNavigationParams& commit_params,
644 const HistoryNavigationParams& history_params);
clamy9bfeef42014-09-30 20:50:42645
[email protected]65920f332014-03-04 21:14:18646 // Virtual since overridden by WebTestProxy for layout tests.
647 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
648 RenderFrame* render_frame,
[email protected]0c3c54f2014-07-31 01:29:00649 const NavigationPolicyInfo& info);
[email protected]65920f332014-03-04 21:14:18650 void OpenURL(blink::WebFrame* frame,
651 const GURL& url,
652 const Referrer& referrer,
653 blink::WebNavigationPolicy policy);
[email protected]a09d53ce2014-01-31 00:46:42654
[email protected]ef3adfc2014-05-11 00:04:54655 // Update current main frame's encoding and send it to browser window.
656 // Since we want to let users see the right encoding info from menu
657 // before finishing loading, we call the UpdateEncoding in
658 // a) function:DidCommitLoadForFrame. When this function is called,
659 // that means we have got first data. In here we try to get encoding
660 // of page if it has been specified in http header.
661 // b) function:DidReceiveTitle. When this function is called,
662 // that means we have got specified title. Because in most of webpages,
663 // title tags will follow meta tags. In here we try to get encoding of
664 // page if it has been specified in meta tag.
665 // c) function:DidFinishDocumentLoadForFrame. When this function is
666 // called, that means we have got whole html page. In here we should
667 // finally get right encoding of page.
668 void UpdateEncoding(blink::WebFrame* frame,
669 const std::string& encoding_name);
670
[email protected]4ee64622014-03-21 22:34:15671 // Dispatches the current state of selection on the webpage to the browser if
672 // it has changed.
673 // TODO(varunjain): delete this method once we figure out how to keep
674 // selection handles in sync with the webpage.
675 void SyncSelectionIfRequired();
676
[email protected]87de04b02014-04-08 22:14:49677 bool RunJavaScriptMessage(JavaScriptMessageType type,
678 const base::string16& message,
679 const base::string16& default_value,
680 const GURL& frame_url,
681 base::string16* result);
682
[email protected]457736d2014-04-30 15:54:27683 // Loads the appropriate error page for the specified failure into the frame.
684 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
685 const blink::WebURLError& error,
686 bool replace);
687
zeeshanq3454e9c2014-09-04 21:30:28688 void HandleJavascriptExecutionResult(const base::string16& javascript,
689 int id,
690 bool notify_result,
691 v8::Handle<v8::Value> result);
692
[email protected]977db4a42014-07-17 08:04:32693 // Initializes |web_user_media_client_|. If this fails, because it wasn't
694 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
695 // |web_user_media_client_| will remain NULL.
696 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19697
698 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
699 const blink::WebURL& url,
700 blink::WebMediaPlayerClient* client);
701
[email protected]ae2477e2014-05-27 23:47:08702 // Creates a factory object used for creating audio and video renderers.
703 // The method is virtual so that layouttests can override it.
704 virtual scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
705
clamyda97e8322014-10-07 21:57:25706 // Checks that the RenderView is ready to display the navigation to |url|. If
sungmann.cho12349f0e2014-12-05 23:42:19707 // the return value is false, the navigation should be abandoned.
clamyda97e8322014-10-07 21:57:25708 bool PrepareRenderViewForNavigation(
709 const GURL& url,
avi2b177592014-12-10 02:08:02710 bool is_history_navigation,
clamycbe86a0c2015-03-05 17:40:02711 const HistoryNavigationParams& history_params,
clamyda97e8322014-10-07 21:57:25712 bool* is_reload,
713 blink::WebURLRequest::CachePolicy* cache_policy);
714
clamyece38882014-11-19 15:00:20715 // PlzNavigate
716 // Sends a FrameHostMsg_BeginNavigation to the browser based on the contents
717 // of the WebURLRequest.
718 void BeginNavigation(blink::WebURLRequest* request);
719
clamy4cc9b8202015-03-02 13:51:36720 // Loads a data url.
721 void LoadDataURL(const CommonNavigationParams& params,
722 blink::WebFrame* frame);
723
[email protected]f3a95312014-06-12 16:46:58724 // Returns the URL being loaded by the |frame_|'s request.
725 GURL GetLoadingUrl() const;
726
[email protected]96307312014-05-04 01:00:19727#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:00728 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
[email protected]96307312014-05-04 01:00:19729 const blink::WebURL& url,
jrummell65b7d272014-09-24 20:49:27730 blink::WebMediaPlayerClient* client,
xhwang60b430a2015-02-01 05:20:46731 media::MediaPermission* media_permission,
jrummell65b7d272014-09-24 20:49:27732 blink::WebContentDecryptionModule* initial_cdm);
[email protected]a017938b2014-05-27 21:17:17733
[email protected]65f3d1aa2014-05-29 01:57:00734 RendererMediaPlayerManager* GetMediaPlayerManager();
[email protected]4b556cf2014-06-10 23:21:53735#endif
736
737#if defined(ENABLE_BROWSER_CDMS)
[email protected]65f3d1aa2014-05-29 01:57:00738 RendererCdmManager* GetCdmManager();
[email protected]96307312014-05-04 01:00:19739#endif
740
[email protected]35b2a972014-04-04 15:50:22741 // Stores the WebLocalFrame we are associated with.
742 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:09743
[email protected]abc501e2014-01-27 19:27:26744 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:04745 int routing_id_;
[email protected]1c2052f2013-08-28 08:24:34746 bool is_swapped_out_;
[email protected]5a7100d2014-05-19 01:29:04747 // RenderFrameProxy exists only when is_swapped_out_ is true.
748 // TODO(nasko): This can be removed once we don't have a swapped out state on
749 // RenderFrame. See https://crbug.com/357747.
750 RenderFrameProxy* render_frame_proxy_;
[email protected]1c2052f2013-08-28 08:24:34751 bool is_detaching_;
[email protected]227692c52013-05-31 22:43:04752
japhete6adf142014-10-31 00:01:49753 // If this frame was created to replace a proxy, this will store the routing
754 // id of the proxy to replace at commit-time, at which time it will be
755 // cleared.
756 // TODO(creis): Remove this after switching to PlzNavigate.
757 int proxy_routing_id_;
758
kenrba7199832015-01-22 23:44:59759 // Used when the RenderFrame is a local root. For now, RenderWidgets are
760 // added only when a child frame is in a different process from its parent
761 // frame, but eventually this will also apply to top-level frames.
762 // TODO(kenrb): Correct the above statement when top-level frames have their
763 // own RenderWidgets.
764 scoped_refptr<RenderWidget> render_widget_;
765
[email protected]7a4e2532013-12-02 21:30:02766#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02767 // Current text input composition text. Empty if no composition is in
768 // progress.
[email protected]fcf75d42013-12-03 20:11:26769 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:09770
tommycli59bd86c2014-12-10 02:09:38771 PluginPowerSaverHelper* plugin_power_saver_helper_;
[email protected]7a4e2532013-12-02 21:30:02772#endif
773
[email protected]f3add922013-12-20 23:17:16774 RendererWebCookieJarImpl cookie_jar_;
775
[email protected]2e2d9632013-12-03 00:55:26776 // All the registered observers.
777 ObserverList<RenderFrameObserver> observers_;
778
[email protected]bffc8302014-01-23 20:52:16779 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
780
[email protected]4ecee352014-03-11 21:12:19781 // The node that the context menu was pressed over.
782 blink::WebNode context_menu_node_;
783
[email protected]a09d53ce2014-01-31 00:46:42784 // External context menu requests we're waiting for. "Internal"
785 // (WebKit-originated) context menu events will have an ID of 0 and will not
786 // be in this map.
787 //
788 // We don't want to add internal ones since some of the "special" page
789 // handlers in the browser process just ignore the context menu requests so
790 // avoid showing context menus, and so this will cause right clicks to leak
791 // entries in this map. Most users of the custom context menu (e.g. Pepper
792 // plugins) are normally only on "regular" pages and the regular pages will
793 // always respond properly to the request, so we don't have to worry so
794 // much about leaks.
795 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
796
[email protected]4ee64622014-03-21 22:34:15797 // The text selection the last time DidChangeSelection got called. May contain
798 // additional characters before and after the selected text, for IMEs. The
799 // portion of this string that is the actual selected text starts at index
800 // |selection_range_.GetMin() - selection_text_offset_| and has length
801 // |selection_range_.length()|.
802 base::string16 selection_text_;
803 // The offset corresponding to the start of |selection_text_| in the document.
804 size_t selection_text_offset_;
805 // Range over the document corresponding to the actual selected text (which
806 // could correspond to a substring of |selection_text_|; see above).
807 gfx::Range selection_range_;
808 // Used to inform didChangeSelection() when it is called in the context
809 // of handling a InputMsg_SelectRange IPC.
810 bool handling_select_range_;
811
[email protected]2626d142014-04-22 17:24:02812 // The next group of objects all implement RenderFrameObserver, so are deleted
813 // along with the RenderFrame automatically. This is why we just store weak
814 // references.
815
[email protected]4459599e2014-07-29 22:40:09816 // Dispatches permission requests for Web Notifications.
817 NotificationPermissionDispatcher* notification_permission_dispatcher_;
818
[email protected]977db4a42014-07-17 08:04:32819 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:33820 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:19821
jrummell109c3a602014-12-18 01:08:50822 // EncryptedMediaClient attached to this frame; lazily initialized.
xhwang430baee2015-01-22 05:46:20823 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:50824
xhwang36b1f3b2015-01-27 17:54:01825 // The media permission dispatcher attached to this frame, lazily initialized.
826 MediaPermissionDispatcher* media_permission_dispatcher_;
827
[email protected]52d3e172014-06-16 16:57:02828 // MidiClient attached to this frame; lazily initialized.
829 MidiDispatcher* midi_dispatcher_;
830
[email protected]a017938b2014-05-27 21:17:17831#if defined(OS_ANDROID)
[email protected]4b556cf2014-06-10 23:21:53832 // Manages all media players in this render frame for communicating with the
833 // real media player in the browser process. It's okay to use a raw pointer
834 // since it's a RenderFrameObserver.
[email protected]a017938b2014-05-27 21:17:17835 RendererMediaPlayerManager* media_player_manager_;
[email protected]4b556cf2014-06-10 23:21:53836#endif
837
838#if defined(ENABLE_BROWSER_CDMS)
839 // Manage all CDMs in this render frame for communicating with the real CDM in
840 // the browser process. It's okay to use a raw pointer since it's a
841 // RenderFrameObserver.
[email protected]65f3d1aa2014-05-29 01:57:00842 RendererCdmManager* cdm_manager_;
[email protected]a017938b2014-05-27 21:17:17843#endif
844
[email protected]a6e21c372014-07-12 02:27:21845#if defined(VIDEO_HOLE)
846 // Whether or not this RenderFrameImpl contains a media player. Used to
847 // register as an observer for video-hole-specific events.
848 bool contains_media_player_;
849#endif
850
[email protected]45920862014-07-02 12:53:02851 // The geolocation dispatcher attached to this frame, lazily initialized.
[email protected]8eae0802014-06-02 21:35:55852 GeolocationDispatcher* geolocation_dispatcher_;
853
[email protected]45920862014-07-02 12:53:02854 // The push messaging dispatcher attached to this frame, lazily initialized.
855 PushMessagingDispatcher* push_messaging_dispatcher_;
856
avayvodbca35fad2015-01-29 20:20:57857 // The presentation dispatcher implementation attached to this frame, lazily
858 // initialized.
859 PresentationDispatcher* presentation_dispatcher_;
860
[email protected]c52a1412014-06-25 06:09:25861 ServiceRegistryImpl service_registry_;
862
[email protected]45920862014-07-02 12:53:02863 // The screen orientation dispatcher attached to the frame, lazily
864 // initialized.
[email protected]cf78eda2014-06-13 16:57:41865 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
866
mlamouriefdca9d2014-09-16 16:55:40867 // The Manifest Manager handles the manifest requests from the browser
868 // process.
869 ManifestManager* manifest_manager_;
870
[email protected]95640212014-07-26 18:14:30871 // The current accessibility mode.
872 AccessibilityMode accessibility_mode_;
873
874 // Only valid if |accessibility_mode_| is anything other than
875 // AccessibilityModeOff.
876 RendererAccessibility* renderer_accessibility_;
877
avi485e5fd62014-08-25 23:26:14878#if defined(OS_MACOSX) || defined(OS_ANDROID)
879 // The external popup for the currently showing select popup.
880 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
881#endif
882
[email protected]96307312014-05-04 01:00:19883 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
884
[email protected]227692c52013-05-31 22:43:04885 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
886};
887
888} // namespace content
889
[email protected]85d85fd2013-06-19 00:57:41890#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_