blob: a6bd1de01e8c7e0b43bc6665f999a60af35dd673 [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"
peter4eb242002015-06-02 12:45:1321#include "content/public/common/console_message_level.h"
[email protected]87de04b02014-04-08 22:14:4922#include "content/public/common/javascript_message_type.h"
[email protected]65920f332014-03-04 21:14:1823#include "content/public/common/referrer.h"
[email protected]227692c52013-05-31 22:43:0424#include "content/public/renderer/render_frame.h"
[email protected]5a7100d2014-05-19 01:29:0425#include "content/renderer/render_frame_proxy.h"
[email protected]f3add922013-12-20 23:17:1626#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0427#include "ipc/ipc_message.h"
acolwell9e0840d2014-09-06 19:01:3228#include "media/blink/webmediaplayer_delegate.h"
dalecurtis49f363882015-08-25 21:05:3829#include "media/blink/webmediaplayer_params.h"
rockotd9260982015-08-21 22:26:3030#include "mojo/application/public/interfaces/service_provider.mojom.h"
31#include "mojo/application/public/interfaces/shell.mojom.h"
benwells04ab5b962015-05-06 08:29:4032#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h"
[email protected]95640212014-07-26 18:14:3033#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4134#include "third_party/WebKit/public/web/WebDataSource.h"
35#include "third_party/WebKit/public/web/WebFrameClient.h"
lazyboy70605c32015-11-03 01:27:3136#include "third_party/WebKit/public/web/WebFrameOwnerProperties.h"
[email protected]680575542014-04-03 17:12:5237#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
skyostilc3ed5652015-10-19 16:28:4638#include "third_party/WebKit/public/web/WebMeaningfulLayout.h"
lukasza2e296c32015-09-28 23:29:4839#include "third_party/WebKit/public/web/WebPageSerializerClient.h"
twellington376424ad2015-05-04 18:57:2540#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
[email protected]4ee64622014-03-21 22:34:1541#include "ui/gfx/range/range.h"
[email protected]227692c52013-05-31 22:43:0442
tommyclid481c482014-12-03 01:50:4143#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3844#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4145#endif
46
[email protected]a017938b2014-05-27 21:17:1747#if defined(OS_ANDROID)
48#include "content/renderer/media/android/renderer_media_player_manager.h"
49#endif
50
xhwangc0299ae32015-07-21 23:39:5051#if defined(ENABLE_MOJO_MEDIA)
52#include "media/mojo/interfaces/service_factory.mojom.h"
53#endif
54
clamy9bfeef42014-09-30 20:50:4255class GURL;
[email protected]7a4e2532013-12-02 21:30:0256class TransportDIB;
kenrba7199832015-01-22 23:44:5957struct FrameMsg_NewFrame_WidgetParams;
alexmose7da5a12015-04-09 02:22:1658struct FrameMsg_PostMessage_Params;
dspelle736c9db2015-04-03 04:53:1659struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0260
61namespace blink {
[email protected]5ee7f182014-04-25 19:45:2662class WebGeolocationClient;
[email protected]7a4e2532013-12-02 21:30:0263class WebMouseEvent;
[email protected]82ce5b92014-03-22 05:15:2664class WebContentDecryptionModule;
[email protected]96307312014-05-04 01:00:1965class WebMediaPlayer;
avayvodbca35fad2015-01-29 20:20:5766class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0267class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2668class WebSecurityOrigin;
alogvinovf50445a2015-10-30 13:00:1269class WebWakeLockClient;
[email protected]7a4e2532013-12-02 21:30:0270struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4271struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0272struct WebCursorInfo;
dcheng3ce04b62015-10-26 23:30:5573struct WebScreenInfo;
[email protected]7a4e2532013-12-02 21:30:0274}
75
76namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4277class Point;
[email protected]7a4e2532013-12-02 21:30:0278class Range;
79class Rect;
80}
81
jrummell109c3a602014-12-18 01:08:5082namespace media {
xhwangd7180832015-04-03 05:38:1583class CdmFactory;
xhwang60b430a2015-02-01 05:20:4684class MediaPermission;
dalecurtisa12e6062015-11-10 23:13:1485class RendererWebMediaPlayerDelegate;
jrummell109c3a602014-12-18 01:08:5086class WebEncryptedMediaClientImpl;
87}
88
xhwang33f939e2015-06-23 04:33:4289namespace mojo {
90class ServiceProvider;
91}
92
tommycli58e3172c2015-09-15 18:18:2693namespace url {
94class Origin;
95}
96
[email protected]227692c52013-05-31 22:43:0497namespace content {
98
[email protected]bffc8302014-01-23 20:52:1699class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:59100class CompositorDependencies;
dgozman358ba322015-03-26 15:05:30101class DevToolsAgent;
avi0392dbf52015-03-25 16:55:45102class DocumentState;
avi485e5fd62014-08-25 23:26:14103class ExternalPopupMenu;
[email protected]8eae0802014-06-02 21:35:55104class GeolocationDispatcher;
mlamouriefdca9d2014-09-16 16:55:40105class ManifestManager;
[email protected]977db4a42014-07-17 08:04:32106class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:08107class MediaStreamRendererFactory;
guoweisf4282b02015-09-24 23:05:22108class MediaPermissionDispatcherImpl;
[email protected]52d3e172014-06-16 16:57:02109class MidiDispatcher;
avi0392dbf52015-03-25 16:55:45110class NavigationState;
[email protected]4459599e2014-07-29 22:40:09111class NotificationPermissionDispatcher;
clamyda97e8322014-10-07 21:57:25112class PageState;
[email protected]7a4e2532013-12-02 21:30:02113class PepperPluginInstanceImpl;
mlamouric6d31db2015-03-28 17:48:14114class PermissionDispatcher;
avayvodbca35fad2015-01-29 20:20:57115class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:02116class PushMessagingDispatcher;
[email protected]95640212014-07-26 18:14:30117class RendererAccessibility;
[email protected]4b556cf2014-06-10 23:21:53118class RendererCdmManager;
119class RendererMediaPlayerManager;
[email protected]7a4e2532013-12-02 21:30:02120class RendererPpapiHost;
[email protected]2e2d9632013-12-03 00:55:26121class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04122class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02123class RenderWidget;
124class RenderWidgetFullscreenPepper;
[email protected]cf78eda2014-06-13 16:57:41125class ScreenOrientationDispatcher;
perkj1a2d0432014-09-03 13:52:33126class UserMediaClientImpl;
alogvinovf50445a2015-10-30 13:00:12127class WakeLockDispatcher;
clamy9bfeef42014-09-30 20:50:42128struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42129struct CustomContextMenuContext;
alexmosbc7eafa2014-12-06 01:38:09130struct FrameReplicationState;
avi0392dbf52015-03-25 16:55:45131struct NavigationParams;
clamy79b3da62014-10-14 08:50:37132struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04133struct ResourceResponseHead;
clamy34e12782015-03-12 11:26:13134struct StartNavigationParams;
clamyd6983032015-04-29 14:48:12135struct StreamOverrideParameters;
bajones02443532015-06-22 21:17:40136class VRDispatcher;
[email protected]227692c52013-05-31 22:43:04137
[email protected]85d85fd2013-06-19 00:57:41138class CONTENT_EXPORT RenderFrameImpl
139 : public RenderFrame,
[email protected]96307312014-05-04 01:00:19140 NON_EXPORTED_BASE(public blink::WebFrameClient),
lukasza2e296c32015-09-28 23:29:48141 NON_EXPORTED_BASE(public blink::WebPageSerializerClient) {
[email protected]227692c52013-05-31 22:43:04142 public:
dchengc5ef1a52015-08-26 20:58:30143 // Creates a new RenderFrame as the main frame of |render_view|.
dcheng3ce04b62015-10-26 23:30:55144 static RenderFrameImpl* CreateMainFrame(
145 RenderViewImpl* render_view,
146 int32_t routing_id,
147 int32_t widget_routing_id,
148 bool hidden,
149 const blink::WebScreenInfo& screen_info,
150 CompositorDependencies* compositor_deps);
[email protected]2f61bdd2013-07-02 18:38:47151
alexmosa181efc2015-09-03 00:39:04152 // Creates a new RenderFrame with |routing_id|. If |proxy_routing_id| is
153 // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into
154 // the frame tree after the frame identified by
155 // |previous_sibling_routing_id|, or as the first child if
alexmos9f8705a2015-05-06 19:58:59156 // |previous_sibling_routing_id| is MSG_ROUTING_NONE. Otherwise, the frame is
157 // semi-orphaned until it commits, at which point it replaces the proxy
alexmosa181efc2015-09-03 00:39:04158 // identified by |proxy_routing_id|. The frame's opener is set to the frame
159 // identified by |opener_routing_id|. The frame is created as a child of the
160 // RenderFrame identified by |parent_routing_id| or as the top-level frame if
161 // the latter is MSG_ROUTING_NONE. Note: This is called only when
alexmos9f8705a2015-05-06 19:58:59162 // RenderFrame is being created in response to IPC message from the browser
163 // process. All other frame creation is driven through Blink and Create.
lazyboy70605c32015-11-03 01:27:31164 static void CreateFrame(
165 int routing_id,
166 int proxy_routing_id,
167 int opener_routing_id,
168 int parent_routing_id,
169 int previous_sibling_routing_id,
170 const FrameReplicationState& replicated_state,
171 CompositorDependencies* compositor_deps,
172 const FrameMsg_NewFrame_WidgetParams& params,
173 const blink::WebFrameOwnerProperties& frameOwner_properties);
[email protected]82307f6b2014-08-07 03:30:12174
[email protected]5a7100d2014-05-19 01:29:04175 // Returns the RenderFrameImpl for the given routing ID.
176 static RenderFrameImpl* FromRoutingID(int routing_id);
177
[email protected]a5ac6dc2014-01-15 07:02:14178 // Just like RenderFrame::FromWebFrame but returns the implementation.
179 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09180
[email protected]2f61bdd2013-07-02 18:38:47181 // Used by content_layouttest_support to hook into the creation of
182 // RenderFrameImpls.
jochen664198b2015-06-25 14:13:00183 struct CreateParams {
184 CreateParams(RenderViewImpl* render_view, int32 routing_id)
185 : render_view(render_view), routing_id(routing_id) {}
186 ~CreateParams() {}
187
188 RenderViewImpl* render_view;
189 int32 routing_id;
190 };
191
192 using CreateRenderFrameImplFunction =
193 RenderFrameImpl* (*)(const CreateParams&);
[email protected]2f61bdd2013-07-02 18:38:47194 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50195 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47196
alexmos95733002015-08-24 16:38:09197 // Looks up and returns the WebFrame corresponding to a given opener frame
198 // routing ID. Also stores the opener's RenderView routing ID into
199 // |opener_view_routing_id|.
200 //
201 // TODO(alexmos): remove RenderViewImpl's dependency on
202 // opener_view_routing_id.
203 static blink::WebFrame* ResolveOpener(int opener_frame_routing_id,
204 int* opener_view_routing_id);
205
avi5c77d212015-09-25 20:08:25206 ~RenderFrameImpl() override;
[email protected]227692c52013-05-31 22:43:04207
[email protected]b70da4c2014-01-06 19:57:09208 bool is_swapped_out() const {
209 return is_swapped_out_;
210 }
211
[email protected]5a7100d2014-05-19 01:29:04212 // TODO(nasko): This can be removed once we don't have a swapped out state on
213 // RenderFrames. See https://crbug.com/357747.
214 void set_render_frame_proxy(RenderFrameProxy* proxy) {
215 render_frame_proxy_ = proxy;
216 }
217
dglazkovf0e1d6d2015-10-10 02:13:48218 // Called by RenderWidget when meaningful layout has happened.
219 // See RenderFrameObserver::DidMeaningfulLayout declaration for details.
220 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type);
221
[email protected]bffc8302014-01-23 20:52:16222 // Out-of-process child frames receive a signal from RenderWidgetCompositor
223 // when a compositor frame has committed.
224 void DidCommitCompositorFrame();
225
[email protected]7a4e2532013-12-02 21:30:02226 // TODO(jam): this is a temporary getter until all the code is transitioned
227 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26228 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02229
[email protected]f3add922013-12-20 23:17:16230 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
231
[email protected]7a4e2532013-12-02 21:30:02232 // Returns the RenderWidget associated with this frame.
233 RenderWidget* GetRenderWidget();
234
dgozmancf9039cd2015-04-06 12:01:31235 DevToolsAgent* devtools_agent() { return devtools_agent_; }
236
[email protected]35b2a972014-04-04 15:50:22237 // This is called right after creation with the WebLocalFrame for this
[email protected]0287e762014-04-11 13:07:58238 // RenderFrame. It must be called before Initialize.
[email protected]35b2a972014-04-04 15:50:22239 void SetWebFrame(blink::WebLocalFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09240
[email protected]0287e762014-04-11 13:07:58241 // This method must be called after the frame has been added to the frame
242 // tree. It creates all objects that depend on the frame being at its proper
243 // spot.
244 void Initialize();
245
[email protected]de3c5d82014-05-28 22:12:59246 // Notifications from RenderWidget.
247 void WasHidden();
248 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31249 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59250
[email protected]723971b2014-02-12 11:08:25251 // Start/Stop loading notifications.
252 // TODO(nasko): Those are page-level methods at this time and come from
253 // WebViewClient. We should move them to be WebFrameClient calls and put
254 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09255 // |to_different_document| will be true unless the load is a fragment
256 // navigation, or triggered by history.pushState/replaceState.
avi5c77d212015-09-25 20:08:25257 void didStartLoading(bool to_different_document) override;
258 void didStopLoading() override;
259 void didChangeLoadProgress(double load_progress) override;
[email protected]723971b2014-02-12 11:08:25260
[email protected]95640212014-07-26 18:14:30261 AccessibilityMode accessibility_mode() {
262 return accessibility_mode_;
263 }
264
265 RendererAccessibility* renderer_accessibility() {
266 return renderer_accessibility_;
267 }
268
269 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
270 blink::WebAXEvent event);
271
estade31c54342015-01-23 03:34:36272 // The focused node changed to |node|. If focus was lost from this frame,
273 // |node| will be null.
[email protected]95640212014-07-26 18:14:30274 void FocusedNodeChanged(const blink::WebNode& node);
275
estade31c54342015-01-23 03:34:36276 // TODO(dmazzoni): the only reason this is here is to plumb it through to
277 // RendererAccessibility. It should use the RenderFrameObserver method, once
278 // blink has a separate accessibility tree per frame.
279 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
280
[email protected]7a4e2532013-12-02 21:30:02281#if defined(ENABLE_PLUGINS)
[email protected]271ff5792013-12-04 22:29:31282 // Notification that a PPAPI plugin has been created.
283 void PepperPluginCreated(RendererPpapiHost* host);
284
[email protected]7a4e2532013-12-02 21:30:02285 // Notifies that |instance| has changed the cursor.
286 // This will update the cursor appearance if it is currently over the plugin
287 // instance.
288 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
289 const blink::WebCursorInfo& cursor);
290
291 // Notifies that |instance| has received a mouse event.
292 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
293
[email protected]7a4e2532013-12-02 21:30:02294 // Informs the render view that a PPAPI plugin has changed text input status.
295 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
296 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
297
298 // Cancels current composition.
299 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
300
301 // Informs the render view that a PPAPI plugin has changed selection.
302 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
303
304 // Creates a fullscreen container for a pepper plugin instance.
305 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
306 PepperPluginInstanceImpl* plugin);
307
[email protected]7a4e2532013-12-02 21:30:02308 bool IsPepperAcceptingCompositionEvents() const;
309
310 // Notification that the given plugin has crashed.
311 void PluginCrashed(const base::FilePath& plugin_path,
312 base::ProcessId plugin_pid);
313
[email protected]7a4e2532013-12-02 21:30:02314 // Simulates IME events for testing purpose.
315 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26316 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02317 const std::vector<blink::WebCompositionUnderline>& underlines,
318 int selection_start,
319 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26320 void SimulateImeConfirmComposition(const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02321 const gfx::Range& replacement_range);
322
323 // TODO(jam): remove these once the IPC handler moves from RenderView to
324 // RenderFrame.
325 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42326 const base::string16& text,
327 const std::vector<blink::WebCompositionUnderline>& underlines,
328 int selection_start,
329 int selection_end);
330 void OnImeConfirmComposition(const base::string16& text,
331 const gfx::Range& replacement_range,
332 bool keep_selection);
333#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02334
[email protected]977db4a42014-07-17 08:04:32335 // May return NULL in some cases, especially if userMediaClient() returns
336 // NULL.
337 MediaStreamDispatcher* GetMediaStreamDispatcher();
338
avi485e5fd62014-08-25 23:26:14339#if defined(OS_MACOSX) || defined(OS_ANDROID)
340 void DidHideExternalPopupMenu();
341#endif
342
[email protected]227692c52013-05-31 22:43:04343 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52344 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04345
346 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52347 bool OnMessageReceived(const IPC::Message& msg) override;
[email protected]227692c52013-05-31 22:43:04348
[email protected]271ff5792013-12-04 22:29:31349 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52350 RenderView* GetRenderView() override;
351 int GetRoutingID() override;
352 blink::WebLocalFrame* GetWebFrame() override;
estade78d655f82015-01-30 01:55:08353 blink::WebElement GetFocusedElement() const override;
dcheng6d18e402014-10-21 12:32:52354 WebPreferences& GetWebkitPreferences() override;
355 int ShowContextMenu(ContextMenuClient* client,
356 const ContextMenuParams& params) override;
357 void CancelContextMenu(int request_id) override;
358 blink::WebNode GetContextMenuNode() const override;
tommycli59bd86c2014-12-10 02:09:38359 blink::WebPlugin* CreatePlugin(
360 blink::WebFrame* frame,
361 const WebPluginInfo& info,
362 const blink::WebPluginParams& params,
tommyclie8722702015-01-16 11:40:41363 scoped_ptr<PluginInstanceThrottler> throttler) override;
japhetb0bae9d82015-10-19 20:43:40364 void LoadURLExternally(const blink::WebURLRequest& request,
dcheng6d18e402014-10-21 12:32:52365 blink::WebNavigationPolicy policy) override;
366 void ExecuteJavaScript(const base::string16& javascript) override;
dglazkov2e140f52015-09-28 16:10:07367 bool IsMainFrame() override;
dcheng6d18e402014-10-21 12:32:52368 bool IsHidden() override;
369 ServiceRegistry* GetServiceRegistry() override;
tommyclid481c482014-12-03 01:50:41370#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38371 void RegisterPeripheralPlugin(
tommycli58e3172c2015-09-15 18:18:26372 const url::Origin& content_origin,
tommycli59bd86c2014-12-10 02:09:38373 const base::Closure& unthrottle_callback) override;
tommyclibae63b92015-10-23 02:56:20374 bool ShouldThrottleContent(const url::Origin& main_frame_origin,
375 const url::Origin& content_origin,
tommyclibae63b92015-10-23 02:56:20376 int width,
377 int height,
378 bool* cross_origin_main_content) const override;
379 void WhitelistContentOrigin(const url::Origin& content_origin) override;
tommyclid481c482014-12-03 01:50:41380#endif
dcheng6d18e402014-10-21 12:32:52381 bool IsFTPDirectoryListing() override;
382 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52383 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52384 void SetSelectedText(const base::string16& selection_text,
385 size_t offset,
386 const gfx::Range& range) override;
387 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19388 v8::Local<v8::Context> context) override;
rdevlin.croninb2cec912015-06-24 20:36:01389 void AddMessageToConsole(ConsoleMessageLevel level,
390 const std::string& message) override;
megjablond5ac7d52015-10-22 23:56:12391 bool IsUsingLoFi() const override;
[email protected]271ff5792013-12-04 22:29:31392
[email protected]96307312014-05-04 01:00:19393 // blink::WebFrameClient implementation:
avi5c77d212015-09-25 20:08:25394 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
395 const blink::WebPluginParams& params) override;
396 blink::WebMediaPlayer* createMediaPlayer(
srirama.m26f864d02015-07-14 05:21:46397 blink::WebLocalFrame* frame,
398 const blink::WebURL& url,
399 blink::WebMediaPlayerClient* client,
400 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
guidou9c3cc3e2015-10-27 13:38:15401 blink::WebContentDecryptionModule* initial_cdm,
402 const blink::WebString& sink_id) override;
davve50137b62015-10-23 12:15:21403 blink::WebMediaSession* createMediaSession() override;
avi5c77d212015-09-25 20:08:25404 blink::WebApplicationCacheHost* createApplicationCacheHost(
[email protected]35b2a972014-04-04 15:50:22405 blink::WebLocalFrame* frame,
avi5c77d212015-09-25 20:08:25406 blink::WebApplicationCacheHostClient* client) override;
407 blink::WebWorkerContentSettingsClientProxy*
408 createWorkerContentSettingsClientProxy(blink::WebLocalFrame* frame) override;
409 blink::WebExternalPopupMenu* createExternalPopupMenu(
[email protected]b20c3222014-08-22 00:50:22410 const blink::WebPopupMenuInfo& popup_menu_info,
avi5c77d212015-09-25 20:08:25411 blink::WebExternalPopupMenuClient* popup_menu_client) override;
412 blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame) override;
413 blink::WebServiceWorkerProvider* createServiceWorkerProvider(
414 blink::WebLocalFrame* frame) override;
415 void didAccessInitialDocument(blink::WebLocalFrame* frame) override;
416 blink::WebFrame* createChildFrame(
alexmose48b1df932015-01-16 01:34:17417 blink::WebLocalFrame* parent,
dcheng860817a2015-05-22 03:16:56418 blink::WebTreeScopeType scope,
419 const blink::WebString& name,
lazyboy70605c32015-11-03 01:27:31420 blink::WebSandboxFlags sandboxFlags,
421 const blink::WebFrameOwnerProperties& frameOwnerProperties) override;
avi5c77d212015-09-25 20:08:25422 void didChangeOpener(blink::WebFrame* frame) override;
423 void frameDetached(blink::WebFrame* frame, DetachType type) override;
424 void frameFocused() override;
425 void willClose(blink::WebFrame* frame) override;
426 void didChangeName(blink::WebLocalFrame* frame,
427 const blink::WebString& name) override;
428 void didChangeSandboxFlags(blink::WebFrame* child_frame,
429 blink::WebSandboxFlags flags) override;
lazyboy70605c32015-11-03 01:27:31430 virtual void didChangeFrameOwnerProperties(
431 blink::WebFrame* child_frame,
432 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25433 void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22434 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46435 const blink::WebVector<blink::WebString>& newly_matching_selectors,
avi5c77d212015-09-25 20:08:25436 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
437 override;
438 bool shouldReportDetailedMessageForSource(
439 const blink::WebString& source) override;
440 void didAddMessageToConsole(const blink::WebConsoleMessage& message,
441 const blink::WebString& source_name,
442 unsigned source_line,
443 const blink::WebString& stack_trace) override;
japhetb0bae9d82015-10-19 20:43:40444 void loadURLExternally(const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25445 blink::WebNavigationPolicy policy,
japhetb0bae9d82015-10-19 20:43:40446 const blink::WebString& suggested_name,
447 bool should_replace_current_entry) override;
avi5c77d212015-09-25 20:08:25448 blink::WebNavigationPolicy decidePolicyForNavigation(
449 const NavigationPolicyInfo& info) override;
450 blink::WebHistoryItem historyItemForNewChildFrame(
451 blink::WebFrame* frame) override;
452 void willSendSubmitEvent(blink::WebLocalFrame* frame,
453 const blink::WebFormElement& form) override;
454 void willSubmitForm(blink::WebLocalFrame* frame,
455 const blink::WebFormElement& form) override;
456 void didCreateDataSource(blink::WebLocalFrame* frame,
457 blink::WebDataSource* datasource) override;
458 void didStartProvisionalLoad(blink::WebLocalFrame* frame,
459 double triggering_event_time) override;
460 void didReceiveServerRedirectForProvisionalLoad(
461 blink::WebLocalFrame* frame) override;
462 void didFailProvisionalLoad(blink::WebLocalFrame* frame,
463 const blink::WebURLError& error,
464 blink::WebHistoryCommitType commit_type) override;
465 void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22466 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52467 const blink::WebHistoryItem& item,
avi5c77d212015-09-25 20:08:25468 blink::WebHistoryCommitType commit_type) override;
469 void didCreateNewDocument(blink::WebLocalFrame* frame) override;
470 void didClearWindowObject(blink::WebLocalFrame* frame) override;
471 void didCreateDocumentElement(blink::WebLocalFrame* frame) override;
472 void didReceiveTitle(blink::WebLocalFrame* frame,
473 const blink::WebString& title,
474 blink::WebTextDirection direction) override;
475 void didChangeIcon(blink::WebLocalFrame* frame,
476 blink::WebIconURL::Type icon_type) override;
477 void didFinishDocumentLoad(blink::WebLocalFrame* frame,
478 bool document_is_empty) override;
479 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override;
480 void didFailLoad(blink::WebLocalFrame* frame,
481 const blink::WebURLError& error,
482 blink::WebHistoryCommitType commit_type) override;
483 void didFinishLoad(blink::WebLocalFrame* frame) override;
484 void didNavigateWithinPage(blink::WebLocalFrame* frame,
485 const blink::WebHistoryItem& item,
486 blink::WebHistoryCommitType commit_type) override;
487 void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame) override;
488 void didChangeThemeColor() override;
489 void dispatchLoad() override;
490 void requestNotificationPermission(
[email protected]4459599e2014-07-29 22:40:09491 const blink::WebSecurityOrigin& origin,
avi5c77d212015-09-25 20:08:25492 blink::WebNotificationPermissionCallback* callback) override;
493 void didChangeSelection(bool is_empty_selection) override;
494 blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19495 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55496 const blink::WebColor& initial_color,
avi5c77d212015-09-25 20:08:25497 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override;
498 void runModalAlertDialog(const blink::WebString& message) override;
499 bool runModalConfirmDialog(const blink::WebString& message) override;
500 bool runModalPromptDialog(const blink::WebString& message,
501 const blink::WebString& default_value,
502 blink::WebString* actual_value) override;
503 bool runModalBeforeUnloadDialog(bool is_reload,
504 const blink::WebString& message) override;
505 void showContextMenu(const blink::WebContextMenuData& data) override;
506 void clearContextMenu() override;
507 void willSendRequest(blink::WebLocalFrame* frame,
508 unsigned identifier,
509 blink::WebURLRequest& request,
510 const blink::WebURLResponse& redirect_response) override;
511 void didReceiveResponse(blink::WebLocalFrame* frame,
512 unsigned identifier,
513 const blink::WebURLResponse& response) override;
514 void didLoadResourceFromMemoryCache(
[email protected]35b2a972014-04-04 15:50:22515 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46516 const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25517 const blink::WebURLResponse& response) override;
518 void didDisplayInsecureContent() override;
519 void didRunInsecureContent(const blink::WebSecurityOrigin& origin,
520 const blink::WebURL& target) override;
521 void didChangePerformanceTiming() override;
522 void didAbortLoading(blink::WebLocalFrame* frame) override;
523 void didCreateScriptContext(blink::WebLocalFrame* frame,
524 v8::Local<v8::Context> context,
525 int extension_group,
526 int world_id) override;
527 void willReleaseScriptContext(blink::WebLocalFrame* frame,
528 v8::Local<v8::Context> context,
529 int world_id) override;
530 void didChangeScrollOffset(blink::WebLocalFrame* frame) override;
531 void willInsertBody(blink::WebLocalFrame* frame) override;
532 void reportFindInPageMatchCount(int request_id,
533 int count,
534 bool final_update) override;
535 void reportFindInPageSelection(int request_id,
536 int active_match_ordinal,
537 const blink::WebRect& sel) override;
538 void requestStorageQuota(blink::WebLocalFrame* frame,
539 blink::WebStorageQuotaType type,
540 unsigned long long requested_size,
541 blink::WebStorageQuotaCallbacks callbacks) override;
542 void willOpenWebSocket(blink::WebSocketHandle* handle) override;
alogvinovf50445a2015-10-30 13:00:12543 blink::WebWakeLockClient* wakeLockClient() override;
avi5c77d212015-09-25 20:08:25544 blink::WebGeolocationClient* geolocationClient() override;
545 blink::WebPushClient* pushClient() override;
546 blink::WebPresentationClient* presentationClient() override;
547 void willStartUsingPeerConnectionHandler(
[email protected]35b2a972014-04-04 15:50:22548 blink::WebLocalFrame* frame,
avi5c77d212015-09-25 20:08:25549 blink::WebRTCPeerConnectionHandler* handler) override;
550 blink::WebUserMediaClient* userMediaClient() override;
551 blink::WebEncryptedMediaClient* encryptedMediaClient() override;
552 blink::WebMIDIClient* webMIDIClient() override;
553 bool willCheckAndDispatchMessageEvent(
[email protected]ce5064f2014-05-07 22:49:20554 blink::WebLocalFrame* source_frame,
555 blink::WebFrame* target_frame,
556 blink::WebSecurityOrigin target_origin,
avi5c77d212015-09-25 20:08:25557 blink::WebDOMMessageEvent event) override;
tzik34958ad62015-10-08 14:07:45558 blink::WebString userAgentOverride(blink::WebLocalFrame* frame) override;
avi5c77d212015-09-25 20:08:25559 blink::WebString doNotTrackValue(blink::WebLocalFrame* frame) override;
560 bool allowWebGL(blink::WebLocalFrame* frame, bool default_value) override;
561 void didLoseWebGLContext(blink::WebLocalFrame* frame,
562 int arb_robustness_status_code) override;
563 blink::WebScreenOrientationClient* webScreenOrientationClient() override;
564 bool isControlledByServiceWorker(blink::WebDataSource& data_source) override;
565 int64_t serviceWorkerID(blink::WebDataSource& data_source) override;
566 void postAccessibilityEvent(const blink::WebAXObject& obj,
567 blink::WebAXEvent event) override;
568 void handleAccessibilityFindInPageResult(
569 int identifier,
570 int match_index,
571 const blink::WebAXObject& start_object,
572 int start_offset,
573 const blink::WebAXObject& end_object,
574 int end_offset) override;
575 void didChangeManifest(blink::WebLocalFrame*) override;
576 bool enterFullscreen() override;
577 bool exitFullscreen() override;
578 blink::WebPermissionClient* permissionClient() override;
579 blink::WebAppBannerClient* appBannerClient() override;
580 void registerProtocolHandler(const blink::WebString& scheme,
581 const blink::WebURL& url,
582 const blink::WebString& title) override;
583 void unregisterProtocolHandler(const blink::WebString& scheme,
584 const blink::WebURL& url) override;
585 blink::WebBluetooth* bluetooth() override;
586 blink::WebUSBClient* usbClient() override;
[email protected]85d85fd2013-06-19 00:57:41587
bajones02443532015-06-22 21:17:40588#if defined(ENABLE_WEBVR)
589 blink::WebVRClient* webVRClient() override;
590#endif
591
lukasza2e296c32015-09-28 23:29:48592 // WebPageSerializerClient implementation:
593 void didSerializeDataForFrame(
lukasza2e296c32015-09-28 23:29:48594 const blink::WebCString& data,
595 blink::WebPageSerializerClient::PageSerializationStatus status) override;
596
nasko78f06bc2014-11-18 18:18:57597 // Make this frame show an empty, unscriptable page.
598 // TODO(nasko): Remove this method once swapped out state is no longer used.
599 void NavigateToSwappedOutURL();
600
rockot775ce0d2015-01-27 18:35:01601 // Binds this render frame's service registry.
[email protected]c52a1412014-06-25 06:09:25602 void BindServiceRegistry(
rockot775ce0d2015-01-27 18:35:01603 mojo::InterfaceRequest<mojo::ServiceProvider> services,
604 mojo::ServiceProviderPtr exposed_services);
[email protected]c52a1412014-06-25 06:09:25605
mlamouri4fff1992014-09-30 11:22:46606 ManifestManager* manifest_manager();
607
avi0392dbf52015-03-25 16:55:45608 // TODO(creis): Remove when the only caller, the HistoryController, is no
609 // more.
610 void SetPendingNavigationParams(
611 scoped_ptr<NavigationParams> navigation_params);
612
guoweisf4282b02015-09-24 23:05:22613 // Expose MediaPermission to the non-UI threads. Any calls to this will be
614 // redirected to |media_permission_dispatcher_| on UI thread and have the
615 // callback called on |caller_task_runner|.
616 scoped_ptr<media::MediaPermission> CreateMediaPermissionProxy(
617 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner);
618
[email protected]2f61bdd2013-07-02 18:38:47619 protected:
jochen664198b2015-06-25 14:13:00620 explicit RenderFrameImpl(const CreateParams& params);
[email protected]2f61bdd2013-07-02 18:38:47621
[email protected]227692c52013-05-31 22:43:04622 private:
kenrbf98a4d22015-04-01 21:59:35623 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26624 friend class RenderFrameObserver;
[email protected]95640212014-07-26 18:14:30625 friend class RendererAccessibilityTest;
clamy98a9dee02015-06-24 16:09:10626 friend class TestRenderFrame;
avi485e5fd62014-08-25 23:26:14627 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
628 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
629 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
630 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]66bbadaf2014-03-28 16:25:54631 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
632 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]2e2d9632013-12-03 00:55:26633
twellington376424ad2015-05-04 18:57:25634 // A wrapper class used as the callback for JavaScript executed
635 // in an isolated world.
636 class JavaScriptIsolatedWorldRequest
637 : public blink::WebScriptExecutionCallback {
638 public:
639 JavaScriptIsolatedWorldRequest(
640 int id,
641 bool notify_result,
642 int routing_id,
643 base::WeakPtr<RenderFrameImpl> render_frame_impl);
644 void completed(
645 const blink::WebVector<v8::Local<v8::Value>>& result) override;
646
647 private:
avi5c77d212015-09-25 20:08:25648 ~JavaScriptIsolatedWorldRequest() override;
twellington376424ad2015-05-04 18:57:25649
650 int id_;
651 bool notify_result_;
652 int routing_id_;
653 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
654
655 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
656 };
657
[email protected]37567b432014-02-12 01:12:22658 typedef std::map<GURL, double> HostZoomLevels;
659
dchengc5ef1a52015-08-26 20:58:30660 // Creates a new RenderFrame. |render_view| is the RenderView object that this
661 // frame belongs to.
662 // Callers *must* call |SetWebFrame| immediately after creation.
663 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
664
[email protected]2e2d9632013-12-03 00:55:26665 // Functions to add and remove observers for this object.
666 void AddObserver(RenderFrameObserver* observer);
667 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34668
dcheng3d886b732015-11-05 19:16:01669 bool IsLocalRoot() const;
670
[email protected]f0906a02014-08-07 07:18:55671 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35672 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
creis8b5cd4c2015-06-19 00:11:08673 blink::WebHistoryCommitType commit_type,
674 const blink::WebHistoryItem& item);
[email protected]37567b432014-02-12 01:12:22675
[email protected]b70da4c2014-01-06 19:57:09676 // IPC message handlers ------------------------------------------------------
677 //
678 // The documentation for these functions should be in
679 // content/common/*_messages.h for the message that the function is handling.
clamy98a9dee02015-06-24 16:09:10680 void OnNavigate(const CommonNavigationParams& common_params,
681 const StartNavigationParams& start_params,
682 const RequestNavigationParams& request_params);
[email protected]f76f32232014-03-11 17:36:17683 void OnBeforeUnload();
alexmosbc7eafa2014-12-06 01:38:09684 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56685 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09686 const FrameReplicationState& replicated_frame_state);
Nasko Oskov85f60222014-08-28 22:53:30687 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42688 void OnShowContextMenu(const gfx::Point& location);
689 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
690 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
691 unsigned action);
[email protected]4ee64622014-03-21 22:34:15692 void OnUndo();
693 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07694 void OnCut();
695 void OnCopy();
696 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15697 void OnPasteAndMatchStyle();
698 void OnDelete();
699 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14700 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
aurimasab0319022015-07-10 21:57:38701 void OnAdjustSelectionByCharacterOffset(int start_adjust, int end_adjust);
[email protected]4ee64622014-03-21 22:34:15702 void OnUnselect();
christiankaeed9862014-11-05 10:49:14703 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17704 void OnReplace(const base::string16& text);
705 void OnReplaceMisspelling(const base::string16& text);
[email protected]e31b8ebb2014-03-07 17:59:34706 void OnCSSInsertRequest(const std::string& css);
peter4eb242002015-06-02 12:45:13707 void OnAddMessageToConsole(ConsoleMessageLevel level,
708 const std::string& message);
[email protected]f13ab892014-03-12 06:48:52709 void OnJavaScriptExecuteRequest(const base::string16& javascript,
710 int id,
711 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28712 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
713 int id,
jochen2e7d95b2015-05-04 15:28:50714 bool notify_result,
715 bool has_user_gesture);
twellington376424ad2015-05-04 18:57:25716 void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
717 int id,
718 bool notify_result,
719 int world_id);
igsolla1cea67b72015-02-11 16:25:04720 void OnVisualStateRequest(uint64 key);
[email protected]4ee64622014-03-21 22:34:15721 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16722 void OnSetCompositionFromExistingText(
723 int start, int end,
724 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24725 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16726 void OnExtendSelectionAndDelete(int before, int after);
[email protected]4fed3702014-04-01 09:08:00727 void OnReload(bool ignore_cache);
[email protected]96bb6132014-06-16 17:22:19728 void OnTextSurroundingSelectionRequest(size_t max_length);
[email protected]95640212014-07-26 18:14:30729 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51730 void OnSnapshotAccessibilityTree(int callback_id);
alexmos95733002015-08-24 16:38:09731 void OnUpdateOpener(int opener_routing_id);
dcheng5f60abb2015-05-28 01:39:36732 void OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags);
lazyboy70605c32015-11-03 01:27:31733 void OnSetFrameOwnerProperties(
734 const blink::WebFrameOwnerProperties& frame_owner_properties);
dspelle736c9db2015-04-03 04:53:16735 void OnTextTrackSettingsChanged(
736 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16737 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
avi485e5fd62014-08-25 23:26:14738#if defined(OS_ANDROID)
739 void OnSelectPopupMenuItems(bool canceled,
740 const std::vector<int>& selected_indices);
741#elif defined(OS_MACOSX)
742 void OnSelectPopupMenuItem(int selected_index);
[email protected]4ee64622014-03-21 22:34:15743 void OnCopyToFindPboard();
744#endif
[email protected]9c9343b2014-03-08 02:56:07745
davidbena5496d62014-10-07 18:52:04746 void OnCommitNavigation(const ResourceResponseHead& response,
747 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42748 const CommonNavigationParams& common_params,
clamy57b4b8e2015-03-24 13:32:11749 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57750 void OnFailedNavigation(const CommonNavigationParams& common_params,
751 const RequestNavigationParams& request_params,
752 bool has_stale_copy_in_cache,
753 int error_code);
lukasza6af746b72015-09-18 23:37:22754 void OnGetSavableResourceLinks();
lukasza2e296c32015-09-28 23:29:48755 void OnGetSerializedHtmlWithLocalLinks(
756 std::vector<GURL> original_urls,
757 std::vector<base::FilePath> equivalent_local_paths,
758 base::FilePath local_directory_path);
clamy9bfeef42014-09-30 20:50:42759
japhetb0bae9d82015-10-19 20:43:40760 void OpenURL(const GURL& url,
[email protected]65920f332014-03-04 21:14:18761 const Referrer& referrer,
japhetb0bae9d82015-10-19 20:43:40762 blink::WebNavigationPolicy policy,
763 bool should_replace_current_entry);
[email protected]a09d53ce2014-01-31 00:46:42764
clamyd6983032015-04-29 14:48:12765 // Performs a navigation in the frame. This provides a unified function for
766 // the current code path and the browser-side navigation path (in
767 // development). Currently used by OnNavigate, with all *NavigationParams
768 // provided by the browser. |stream_params| should be null.
769 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
770 // |request_params| received by the browser. |stream_params| should be non
771 // null and created from the information provided by the browser.
772 // |start_params| is not used.
773 void NavigateInternal(const CommonNavigationParams& common_params,
774 const StartNavigationParams& start_params,
775 const RequestNavigationParams& request_params,
776 scoped_ptr<StreamOverrideParameters> stream_params);
777
[email protected]ef3adfc2014-05-11 00:04:54778 // Update current main frame's encoding and send it to browser window.
779 // Since we want to let users see the right encoding info from menu
780 // before finishing loading, we call the UpdateEncoding in
781 // a) function:DidCommitLoadForFrame. When this function is called,
782 // that means we have got first data. In here we try to get encoding
783 // of page if it has been specified in http header.
784 // b) function:DidReceiveTitle. When this function is called,
785 // that means we have got specified title. Because in most of webpages,
786 // title tags will follow meta tags. In here we try to get encoding of
787 // page if it has been specified in meta tag.
788 // c) function:DidFinishDocumentLoadForFrame. When this function is
789 // called, that means we have got whole html page. In here we should
790 // finally get right encoding of page.
791 void UpdateEncoding(blink::WebFrame* frame,
792 const std::string& encoding_name);
793
[email protected]4ee64622014-03-21 22:34:15794 // Dispatches the current state of selection on the webpage to the browser if
795 // it has changed.
796 // TODO(varunjain): delete this method once we figure out how to keep
797 // selection handles in sync with the webpage.
798 void SyncSelectionIfRequired();
799
[email protected]87de04b02014-04-08 22:14:49800 bool RunJavaScriptMessage(JavaScriptMessageType type,
801 const base::string16& message,
802 const base::string16& default_value,
803 const GURL& frame_url,
804 base::string16* result);
805
[email protected]457736d2014-04-30 15:54:27806 // Loads the appropriate error page for the specified failure into the frame.
807 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
808 const blink::WebURLError& error,
809 bool replace);
810
zeeshanq3454e9c2014-09-04 21:30:28811 void HandleJavascriptExecutionResult(const base::string16& javascript,
812 int id,
813 bool notify_result,
deepak.s750d68f2015-04-30 07:32:41814 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:28815
[email protected]977db4a42014-07-17 08:04:32816 // Initializes |web_user_media_client_|. If this fails, because it wasn't
817 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
818 // |web_user_media_client_| will remain NULL.
819 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19820
821 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
guidou9c3cc3e2015-10-27 13:38:15822 blink::WebMediaPlayerClient* client,
823 const blink::WebString& sink_id,
824 const blink::WebSecurityOrigin& security_origin);
[email protected]96307312014-05-04 01:00:19825
[email protected]ae2477e2014-05-27 23:47:08826 // Creates a factory object used for creating audio and video renderers.
jochen51265132015-05-28 07:33:45827 scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
[email protected]ae2477e2014-05-27 23:47:08828
avi5cad4912015-06-19 05:25:44829 // Does preparation for the navigation to |url|.
830 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:25831 const GURL& url,
clamy57b4b8e2015-03-24 13:32:11832 const RequestNavigationParams& request_params,
clamyda97e8322014-10-07 21:57:25833 bool* is_reload,
834 blink::WebURLRequest::CachePolicy* cache_policy);
835
clamyece38882014-11-19 15:00:20836 // PlzNavigate
837 // Sends a FrameHostMsg_BeginNavigation to the browser based on the contents
838 // of the WebURLRequest.
839 void BeginNavigation(blink::WebURLRequest* request);
840
clamy4cc9b8202015-03-02 13:51:36841 // Loads a data url.
842 void LoadDataURL(const CommonNavigationParams& params,
843 blink::WebFrame* frame);
844
creis8eb8ef22015-11-04 22:51:38845 // Sends the current frame's navigation state to the browser.
846 void SendUpdateState();
847
clamy62b271d2015-04-16 11:54:57848 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
849 // the failed request |request|.
850 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
851 const blink::WebURLError& error,
852 blink::WebLocalFrame* frame);
853
854 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
855 const GURL& unreachable_url);
856
[email protected]f3a95312014-06-12 16:46:58857 // Returns the URL being loaded by the |frame_|'s request.
858 GURL GetLoadingUrl() const;
859
avi0392dbf52015-03-25 16:55:45860 // If we initiated a navigation, this function will populate |document_state|
861 // with the navigation information saved in OnNavigate().
862 void PopulateDocumentStateFromPending(DocumentState* document_state);
863
864 // Returns a new NavigationState populated with the navigation information
865 // saved in OnNavigate().
866 NavigationState* CreateNavigationStateFromPending();
867
csharrison1ce0e852015-11-07 16:45:13868 // Sets the NavigationState on the DocumentState based on
869 // the value of |pending_navigation_params_|.
870 void UpdateNavigationState(DocumentState* document_state);
871
[email protected]96307312014-05-04 01:00:19872#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:00873 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
jrummell65b7d272014-09-24 20:49:27874 blink::WebMediaPlayerClient* client,
srirama.m26f864d02015-07-14 05:21:46875 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
dalecurtis49f363882015-08-25 21:05:38876 const media::WebMediaPlayerParams& params);
[email protected]a017938b2014-05-27 21:17:17877
[email protected]65f3d1aa2014-05-29 01:57:00878 RendererMediaPlayerManager* GetMediaPlayerManager();
[email protected]4b556cf2014-06-10 23:21:53879#endif
880
sandersd02d9aea2015-05-12 02:29:26881 bool AreSecureCodecsSupported();
xhwang33f939e2015-06-23 04:33:42882
xhwangd7180832015-04-03 05:38:15883 media::MediaPermission* GetMediaPermission();
xhwang33f939e2015-06-23 04:33:42884
xhwange70b7ee12015-06-25 09:17:17885#if defined(ENABLE_MOJO_MEDIA)
xhwangc0299ae32015-07-21 23:39:50886 media::interfaces::ServiceFactory* GetMediaServiceFactory();
xhwang33f939e2015-06-23 04:33:42887
xhwangc0299ae32015-07-21 23:39:50888 // Called when a connection error happened on |media_service_factory_|.
889 void OnMediaServiceFactoryConnectionError();
xhwang33f939e2015-06-23 04:33:42890#endif
891
xhwangd7180832015-04-03 05:38:15892 media::CdmFactory* GetCdmFactory();
[email protected]96307312014-05-04 01:00:19893
halton.huoca2eabd2015-07-06 08:17:40894 void RegisterMojoServices();
895
rockotd9260982015-08-21 22:26:30896 // Connects to a Mojo application and returns a proxy to its exposed
897 // ServiceProvider.
898 mojo::ServiceProviderPtr ConnectToApplication(const GURL& url);
899
dalecurtisa12e6062015-11-10 23:13:14900 // Returns the media delegate for WebMediaPlayer usage. If
901 // |media_player_delegate_| is NULL, one is created.
902 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate();
903
creiscfaa4462015-03-16 19:27:18904 // Stores the WebLocalFrame we are associated with. This is null from the
905 // constructor until SetWebFrame is called, and it is null after
906 // frameDetached is called until destruction (which is asynchronous in the
907 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:22908 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:09909
dglazkov2e140f52015-09-28 16:10:07910 // Boolean value indicating whether this RenderFrameImpl object is for the
911 // main frame or not. It remains accurate during destruction, even when
912 // |frame_| has been invalidated.
913 bool is_main_frame_;
nasko8b9d9bd2015-05-06 19:23:19914
[email protected]abc501e2014-01-27 19:27:26915 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:04916 int routing_id_;
[email protected]1c2052f2013-08-28 08:24:34917 bool is_swapped_out_;
nasko8b9d9bd2015-05-06 19:23:19918
[email protected]5a7100d2014-05-19 01:29:04919 // RenderFrameProxy exists only when is_swapped_out_ is true.
920 // TODO(nasko): This can be removed once we don't have a swapped out state on
921 // RenderFrame. See https://crbug.com/357747.
922 RenderFrameProxy* render_frame_proxy_;
[email protected]1c2052f2013-08-28 08:24:34923 bool is_detaching_;
[email protected]227692c52013-05-31 22:43:04924
japhete6adf142014-10-31 00:01:49925 // If this frame was created to replace a proxy, this will store the routing
926 // id of the proxy to replace at commit-time, at which time it will be
927 // cleared.
928 // TODO(creis): Remove this after switching to PlzNavigate.
929 int proxy_routing_id_;
930
dcheng3d886b732015-11-05 19:16:01931 // Non-null when the RenderFrame is a local root for compositing, input,
932 // layout, etc. A local frame is also a local root iff it does not have a
933 // parent that is a local frame.
kenrba7199832015-01-22 23:44:59934 scoped_refptr<RenderWidget> render_widget_;
935
avi0392dbf52015-03-25 16:55:45936 // Temporarily holds state pertaining to a navigation that has been initiated
937 // until the NavigationState corresponding to the new navigation is created in
938 // didCreateDataSource().
939 scoped_ptr<NavigationParams> pending_navigation_params_;
940
creis8eb8ef22015-11-04 22:51:38941 // Stores the current history item for this frame, so that updates to it can
942 // be reported to the browser process via SendUpdateState.
943 blink::WebHistoryItem current_history_item_;
944
[email protected]7a4e2532013-12-02 21:30:02945#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02946 // Current text input composition text. Empty if no composition is in
947 // progress.
[email protected]fcf75d42013-12-03 20:11:26948 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:09949
tommycli59bd86c2014-12-10 02:09:38950 PluginPowerSaverHelper* plugin_power_saver_helper_;
[email protected]7a4e2532013-12-02 21:30:02951#endif
952
[email protected]f3add922013-12-20 23:17:16953 RendererWebCookieJarImpl cookie_jar_;
954
[email protected]2e2d9632013-12-03 00:55:26955 // All the registered observers.
brettw236d3172015-06-03 16:31:43956 base::ObserverList<RenderFrameObserver> observers_;
[email protected]2e2d9632013-12-03 00:55:26957
[email protected]bffc8302014-01-23 20:52:16958 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
959
[email protected]4ecee352014-03-11 21:12:19960 // The node that the context menu was pressed over.
961 blink::WebNode context_menu_node_;
962
[email protected]a09d53ce2014-01-31 00:46:42963 // External context menu requests we're waiting for. "Internal"
964 // (WebKit-originated) context menu events will have an ID of 0 and will not
965 // be in this map.
966 //
967 // We don't want to add internal ones since some of the "special" page
968 // handlers in the browser process just ignore the context menu requests so
969 // avoid showing context menus, and so this will cause right clicks to leak
970 // entries in this map. Most users of the custom context menu (e.g. Pepper
971 // plugins) are normally only on "regular" pages and the regular pages will
972 // always respond properly to the request, so we don't have to worry so
973 // much about leaks.
974 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
975
[email protected]4ee64622014-03-21 22:34:15976 // The text selection the last time DidChangeSelection got called. May contain
977 // additional characters before and after the selected text, for IMEs. The
978 // portion of this string that is the actual selected text starts at index
979 // |selection_range_.GetMin() - selection_text_offset_| and has length
980 // |selection_range_.length()|.
981 base::string16 selection_text_;
982 // The offset corresponding to the start of |selection_text_| in the document.
983 size_t selection_text_offset_;
984 // Range over the document corresponding to the actual selected text (which
985 // could correspond to a substring of |selection_text_|; see above).
986 gfx::Range selection_range_;
987 // Used to inform didChangeSelection() when it is called in the context
988 // of handling a InputMsg_SelectRange IPC.
989 bool handling_select_range_;
990
[email protected]2626d142014-04-22 17:24:02991 // The next group of objects all implement RenderFrameObserver, so are deleted
992 // along with the RenderFrame automatically. This is why we just store weak
993 // references.
994
[email protected]4459599e2014-07-29 22:40:09995 // Dispatches permission requests for Web Notifications.
996 NotificationPermissionDispatcher* notification_permission_dispatcher_;
997
[email protected]977db4a42014-07-17 08:04:32998 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:33999 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:191000
jrummell109c3a602014-12-18 01:08:501001 // EncryptedMediaClient attached to this frame; lazily initialized.
xhwang430baee2015-01-22 05:46:201002 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:501003
xhwang36b1f3b2015-01-27 17:54:011004 // The media permission dispatcher attached to this frame, lazily initialized.
guoweisf4282b02015-09-24 23:05:221005 MediaPermissionDispatcherImpl* media_permission_dispatcher_;
xhwang36b1f3b2015-01-27 17:54:011006
xhwange70b7ee12015-06-25 09:17:171007#if defined(ENABLE_MOJO_MEDIA)
xhwangc0299ae32015-07-21 23:39:501008 // The media factory attached to this frame, lazily initialized.
1009 media::interfaces::ServiceFactoryPtr media_service_factory_;
xhwang065b54b2015-06-03 22:25:551010#endif
1011
[email protected]52d3e172014-06-16 16:57:021012 // MidiClient attached to this frame; lazily initialized.
1013 MidiDispatcher* midi_dispatcher_;
1014
[email protected]a017938b2014-05-27 21:17:171015#if defined(OS_ANDROID)
[email protected]4b556cf2014-06-10 23:21:531016 // Manages all media players in this render frame for communicating with the
1017 // real media player in the browser process. It's okay to use a raw pointer
1018 // since it's a RenderFrameObserver.
[email protected]a017938b2014-05-27 21:17:171019 RendererMediaPlayerManager* media_player_manager_;
[email protected]4b556cf2014-06-10 23:21:531020#endif
1021
1022#if defined(ENABLE_BROWSER_CDMS)
1023 // Manage all CDMs in this render frame for communicating with the real CDM in
1024 // the browser process. It's okay to use a raw pointer since it's a
1025 // RenderFrameObserver.
[email protected]65f3d1aa2014-05-29 01:57:001026 RendererCdmManager* cdm_manager_;
[email protected]a017938b2014-05-27 21:17:171027#endif
1028
xhwangd7180832015-04-03 05:38:151029 // The CDM factory attached to this frame, lazily initialized.
xhwangf2eb532f2015-06-25 01:51:191030 scoped_ptr<media::CdmFactory> cdm_factory_;
xhwangd7180832015-04-03 05:38:151031
[email protected]a6e21c372014-07-12 02:27:211032#if defined(VIDEO_HOLE)
1033 // Whether or not this RenderFrameImpl contains a media player. Used to
1034 // register as an observer for video-hole-specific events.
1035 bool contains_media_player_;
1036#endif
1037
dgozman358ba322015-03-26 15:05:301038 // The devtools agent for this frame; only created for main frame and
1039 // local roots.
1040 DevToolsAgent* devtools_agent_;
1041
alogvinovf50445a2015-10-30 13:00:121042 WakeLockDispatcher* wakelock_dispatcher_;
1043
[email protected]45920862014-07-02 12:53:021044 // The geolocation dispatcher attached to this frame, lazily initialized.
[email protected]8eae0802014-06-02 21:35:551045 GeolocationDispatcher* geolocation_dispatcher_;
1046
[email protected]45920862014-07-02 12:53:021047 // The push messaging dispatcher attached to this frame, lazily initialized.
1048 PushMessagingDispatcher* push_messaging_dispatcher_;
1049
avayvodbca35fad2015-01-29 20:20:571050 // The presentation dispatcher implementation attached to this frame, lazily
1051 // initialized.
1052 PresentationDispatcher* presentation_dispatcher_;
1053
[email protected]c52a1412014-06-25 06:09:251054 ServiceRegistryImpl service_registry_;
1055
rockotd9260982015-08-21 22:26:301056 // The shell proxy used to connect to Mojo applications.
1057 mojo::ShellPtr mojo_shell_;
1058
[email protected]45920862014-07-02 12:53:021059 // The screen orientation dispatcher attached to the frame, lazily
1060 // initialized.
[email protected]cf78eda2014-06-13 16:57:411061 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
1062
mlamouriefdca9d2014-09-16 16:55:401063 // The Manifest Manager handles the manifest requests from the browser
1064 // process.
1065 ManifestManager* manifest_manager_;
1066
[email protected]95640212014-07-26 18:14:301067 // The current accessibility mode.
1068 AccessibilityMode accessibility_mode_;
1069
1070 // Only valid if |accessibility_mode_| is anything other than
1071 // AccessibilityModeOff.
1072 RendererAccessibility* renderer_accessibility_;
1073
mlamouric6d31db2015-03-28 17:48:141074 scoped_ptr<PermissionDispatcher> permission_client_;
mlamouri670a86d2015-03-17 16:06:251075
benwells04ab5b962015-05-06 08:29:401076 scoped_ptr<blink::WebAppBannerClient> app_banner_client_;
1077
jyasskinf89a11b2015-07-21 00:27:481078 scoped_ptr<blink::WebBluetooth> bluetooth_;
1079
rockotd9260982015-08-21 22:26:301080 scoped_ptr<blink::WebUSBClient> usb_client_;
1081
dalecurtisa12e6062015-11-10 23:13:141082 // Manages play, pause notifications for WebMediaPlayer implementations; its
1083 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface.
1084 media::RendererWebMediaPlayerDelegate* media_player_delegate_;
1085
megjablond5ac7d52015-10-22 23:56:121086 // Whether or not this RenderFrame is using Lo-Fi mode.
1087 bool is_using_lofi_;
1088
bajones02443532015-06-22 21:17:401089#if defined(ENABLE_WEBVR)
1090 // The VR dispatcher attached to the frame, lazily initialized.
1091 scoped_ptr<VRDispatcher> vr_dispatcher_;
1092#endif
1093
avi485e5fd62014-08-25 23:26:141094#if defined(OS_MACOSX) || defined(OS_ANDROID)
1095 // The external popup for the currently showing select popup.
1096 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
1097#endif
1098
[email protected]96307312014-05-04 01:00:191099 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1100
[email protected]227692c52013-05-31 22:43:041101 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1102};
1103
1104} // namespace content
1105
[email protected]85d85fd2013-06-19 00:57:411106#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_