blob: 29567d8c5d659c603cc9934e805d30b1b2b365a5 [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
avi1023d012015-12-25 02:39:148#include <stddef.h>
9#include <stdint.h>
10
dchengcedca5612016-04-09 01:40:1511#include <memory>
guidou3906a722015-11-12 22:14:4212#include <string>
[email protected]7a4e2532013-12-02 21:30:0213#include <vector>
14
[email protected]7a4e2532013-12-02 21:30:0215#include "base/files/file_path.h"
[email protected]a09d53ce2014-01-31 00:46:4216#include "base/gtest_prod_util.h"
17#include "base/id_map.h"
avi1023d012015-12-25 02:39:1418#include "base/macros.h"
hubbe5f0ad43b2015-12-14 20:57:2619#include "base/memory/linked_ptr.h"
lukaszabb2101b82016-06-17 16:52:2520#include "base/memory/ref_counted.h"
[email protected]abc501e2014-01-27 19:27:2621#include "base/memory/weak_ptr.h"
[email protected]2e2d9632013-12-03 00:55:2622#include "base/observer_list.h"
[email protected]7a4e2532013-12-02 21:30:0223#include "base/process/process_handle.h"
avi1023d012015-12-25 02:39:1424#include "build/build_config.h"
[email protected]95640212014-07-26 18:14:3025#include "content/common/accessibility_mode_enums.h"
ben76f52b242016-06-18 05:42:4826#include "content/common/frame.mojom.h"
clamyda97e8322014-10-07 21:57:2527#include "content/common/frame_message_enums.h"
peter4eb242002015-06-02 12:45:1328#include "content/public/common/console_message_level.h"
[email protected]87de04b02014-04-08 22:14:4929#include "content/public/common/javascript_message_type.h"
[email protected]65920f332014-03-04 21:14:1830#include "content/public/common/referrer.h"
paulmeyer5d0a5f02016-01-21 20:15:5231#include "content/public/common/stop_find_action.h"
[email protected]227692c52013-05-31 22:43:0432#include "content/public/renderer/render_frame.h"
skyostilb4cce1b2016-03-31 17:56:3433#include "content/renderer/frame_blame_context.h"
sammcbebeb602016-04-06 06:42:5534#include "content/renderer/mojo/blink_service_registry_impl.h"
[email protected]f3add922013-12-20 23:17:1635#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0436#include "ipc/ipc_message.h"
lukasza70b79c82015-12-14 20:24:1337#include "ipc/ipc_platform_file.h"
acolwell9e0840d2014-09-06 19:01:3238#include "media/blink/webmediaplayer_delegate.h"
dalecurtis49f363882015-08-25 21:05:3839#include "media/blink/webmediaplayer_params.h"
ben155ecf82016-06-21 22:43:2640#include "mojo/public/cpp/bindings/binding.h"
benf709a3092016-04-12 22:38:2241#include "services/shell/public/interfaces/connector.mojom.h"
42#include "services/shell/public/interfaces/interface_provider.mojom.h"
tbansal7b6cf8b2016-05-10 19:27:2343#include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
alexmos401f0aba2015-12-06 10:07:3944#include "third_party/WebKit/public/platform/WebFocusType.h"
csharrisonae811ab2016-04-11 11:32:2545#include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
sandersdf92f4e5c2016-01-22 20:57:2246#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
lfg717154072016-06-30 15:04:1647#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
benwells04ab5b962015-05-06 08:29:4048#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h"
[email protected]95640212014-07-26 18:14:3049#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4150#include "third_party/WebKit/public/web/WebDataSource.h"
51#include "third_party/WebKit/public/web/WebFrameClient.h"
boliu15890e42015-11-24 23:08:0552#include "third_party/WebKit/public/web/WebFrameLoadType.h"
lukasza902fcc52015-12-31 04:45:2953#include "third_party/WebKit/public/web/WebFrameSerializerClient.h"
[email protected]680575542014-04-03 17:12:5254#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
skyostilc3ed5652015-10-19 16:28:4655#include "third_party/WebKit/public/web/WebMeaningfulLayout.h"
twellington376424ad2015-05-04 18:57:2556#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
[email protected]4ee64622014-03-21 22:34:1557#include "ui/gfx/range/range.h"
lukaszaede9cc02015-12-30 23:48:3258#include "url/gurl.h"
[email protected]227692c52013-05-31 22:43:0459
tommyclid481c482014-12-03 01:50:4160#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3861#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4162#endif
63
[email protected]a017938b2014-05-27 21:17:1764#if defined(OS_ANDROID)
65#include "content/renderer/media/android/renderer_media_player_manager.h"
66#endif
67
xhwangc0299ae32015-07-21 23:39:5068#if defined(ENABLE_MOJO_MEDIA)
jbromanb73f2582016-01-11 16:35:0569#include "media/mojo/interfaces/service_factory.mojom.h" // nogncheck
xhwangc0299ae32015-07-21 23:39:5070#endif
71
[email protected]7a4e2532013-12-02 21:30:0272class TransportDIB;
kenrba7199832015-01-22 23:44:5973struct FrameMsg_NewFrame_WidgetParams;
alexmose7da5a12015-04-09 02:22:1674struct FrameMsg_PostMessage_Params;
lukaszaede9cc02015-12-30 23:48:3275struct FrameMsg_SerializeAsMHTML_Params;
dspelle736c9db2015-04-03 04:53:1676struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0277
avi7d30b552016-04-06 20:32:5578namespace IPC {
79class SyncMessage;
80}
81
[email protected]7a4e2532013-12-02 21:30:0282namespace blink {
[email protected]82ce5b92014-03-22 05:15:2683class WebContentDecryptionModule;
raymesbba82b32016-07-19 00:41:3884class WebMouseEvent;
avayvodbca35fad2015-01-29 20:20:5785class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0286class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2687class WebSecurityOrigin;
toyoshimf3f7f682016-04-08 07:47:4888enum class WebCachePolicy;
[email protected]7a4e2532013-12-02 21:30:0289struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4290struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0291struct WebCursorInfo;
paulmeyer5d0a5f02016-01-21 20:15:5292struct WebFindOptions;
raymesbba82b32016-07-19 00:41:3893struct WebFrameOwnerProperties;
dcheng3ce04b62015-10-26 23:30:5594struct WebScreenInfo;
[email protected]7a4e2532013-12-02 21:30:0295}
96
97namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4298class Point;
[email protected]7a4e2532013-12-02 21:30:0299class Range;
100class Rect;
101}
102
jrummell109c3a602014-12-18 01:08:50103namespace media {
xhwangd7180832015-04-03 05:38:15104class CdmFactory;
xhwang409e53552016-02-23 00:52:44105class DecoderFactory;
xhwang60b430a2015-02-01 05:20:46106class MediaPermission;
hubbe5f0ad43b2015-12-14 20:57:26107class MediaServiceProvider;
dalecurtisa12e6062015-11-10 23:13:14108class RendererWebMediaPlayerDelegate;
watkdee516f2016-02-18 02:22:19109class SurfaceManager;
hubbe5f0ad43b2015-12-14 20:57:26110class UrlIndex;
jrummell109c3a602014-12-18 01:08:50111class WebEncryptedMediaClientImpl;
112}
113
ben155ecf82016-06-21 22:43:26114namespace shell {
115class InterfaceRegistry;
116class InterfaceProvider;
xhwang33f939e2015-06-23 04:33:42117}
118
tommycli58e3172c2015-09-15 18:18:26119namespace url {
120class Origin;
121}
122
[email protected]227692c52013-05-31 22:43:04123namespace content {
124
[email protected]bffc8302014-01-23 20:52:16125class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:59126class CompositorDependencies;
dgozman358ba322015-03-26 15:05:30127class DevToolsAgent;
avi0392dbf52015-03-25 16:55:45128class DocumentState;
avi485e5fd62014-08-25 23:26:14129class ExternalPopupMenu;
mlamouriefdca9d2014-09-16 16:55:40130class ManifestManager;
xhwanga5967e552016-02-26 00:54:08131class MediaInterfaceProvider;
[email protected]977db4a42014-07-17 08:04:32132class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:08133class MediaStreamRendererFactory;
xhwang5206d4e62016-02-05 02:09:55134class MediaPermissionDispatcher;
[email protected]52d3e172014-06-16 16:57:02135class MidiDispatcher;
avi0392dbf52015-03-25 16:55:45136class NavigationState;
[email protected]4459599e2014-07-29 22:40:09137class NotificationPermissionDispatcher;
clamyda97e8322014-10-07 21:57:25138class PageState;
[email protected]7a4e2532013-12-02 21:30:02139class PepperPluginInstanceImpl;
mlamouric6d31db2015-03-28 17:48:14140class PermissionDispatcher;
avayvodbca35fad2015-01-29 20:20:57141class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:02142class PushMessagingDispatcher;
dmazzoni8e6fe4d2016-06-27 06:35:37143class RenderAccessibilityImpl;
[email protected]4b556cf2014-06-10 23:21:53144class RendererCdmManager;
145class RendererMediaPlayerManager;
davve859f4f92015-11-27 10:16:19146class RendererMediaSessionManager;
[email protected]7a4e2532013-12-02 21:30:02147class RendererPpapiHost;
watkdee516f2016-02-18 02:22:19148class RendererSurfaceViewManager;
[email protected]2e2d9632013-12-03 00:55:26149class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04150class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02151class RenderWidget;
152class RenderWidgetFullscreenPepper;
lukaszade802372016-06-16 17:17:23153class ResourceRequestBodyImpl;
[email protected]cf78eda2014-06-13 16:57:41154class ScreenOrientationDispatcher;
perkj1a2d0432014-09-03 13:52:33155class UserMediaClientImpl;
alogvinovf50445a2015-10-30 13:00:12156class WakeLockDispatcher;
clamy9bfeef42014-09-30 20:50:42157struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42158struct CustomContextMenuContext;
naskoada75b22016-06-11 16:09:46159struct FileChooserFileInfo;
160struct FileChooserParams;
raymesbba82b32016-07-19 00:41:38161struct FrameOwnerProperties;
alexmosbc7eafa2014-12-06 01:38:09162struct FrameReplicationState;
avi0392dbf52015-03-25 16:55:45163struct NavigationParams;
clamy79b3da62014-10-14 08:50:37164struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04165struct ResourceResponseHead;
clamy34e12782015-03-12 11:26:13166struct StartNavigationParams;
clamyd6983032015-04-29 14:48:12167struct StreamOverrideParameters;
[email protected]227692c52013-05-31 22:43:04168
[email protected]85d85fd2013-06-19 00:57:41169class CONTENT_EXPORT RenderFrameImpl
170 : public RenderFrame,
ben76f52b242016-06-18 05:42:48171 NON_EXPORTED_BASE(mojom::Frame),
[email protected]96307312014-05-04 01:00:19172 NON_EXPORTED_BASE(public blink::WebFrameClient),
lukasza902fcc52015-12-31 04:45:29173 NON_EXPORTED_BASE(public blink::WebFrameSerializerClient) {
[email protected]227692c52013-05-31 22:43:04174 public:
dchengc5ef1a52015-08-26 20:58:30175 // Creates a new RenderFrame as the main frame of |render_view|.
dcheng3ce04b62015-10-26 23:30:55176 static RenderFrameImpl* CreateMainFrame(
177 RenderViewImpl* render_view,
178 int32_t routing_id,
179 int32_t widget_routing_id,
180 bool hidden,
181 const blink::WebScreenInfo& screen_info,
dcheng9e24bd352016-03-01 19:15:51182 CompositorDependencies* compositor_deps,
183 blink::WebFrame* opener);
[email protected]2f61bdd2013-07-02 18:38:47184
alexmosa181efc2015-09-03 00:39:04185 // Creates a new RenderFrame with |routing_id|. If |proxy_routing_id| is
186 // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into
187 // the frame tree after the frame identified by
188 // |previous_sibling_routing_id|, or as the first child if
alexmos9f8705a2015-05-06 19:58:59189 // |previous_sibling_routing_id| is MSG_ROUTING_NONE. Otherwise, the frame is
190 // semi-orphaned until it commits, at which point it replaces the proxy
alexmosa181efc2015-09-03 00:39:04191 // identified by |proxy_routing_id|. The frame's opener is set to the frame
192 // identified by |opener_routing_id|. The frame is created as a child of the
193 // RenderFrame identified by |parent_routing_id| or as the top-level frame if
194 // the latter is MSG_ROUTING_NONE. Note: This is called only when
alexmos9f8705a2015-05-06 19:58:59195 // RenderFrame is being created in response to IPC message from the browser
196 // process. All other frame creation is driven through Blink and Create.
lazyboy70605c32015-11-03 01:27:31197 static void CreateFrame(
198 int routing_id,
199 int proxy_routing_id,
200 int opener_routing_id,
201 int parent_routing_id,
202 int previous_sibling_routing_id,
203 const FrameReplicationState& replicated_state,
204 CompositorDependencies* compositor_deps,
205 const FrameMsg_NewFrame_WidgetParams& params,
206 const blink::WebFrameOwnerProperties& frameOwner_properties);
[email protected]82307f6b2014-08-07 03:30:12207
[email protected]5a7100d2014-05-19 01:29:04208 // Returns the RenderFrameImpl for the given routing ID.
209 static RenderFrameImpl* FromRoutingID(int routing_id);
210
[email protected]a5ac6dc2014-01-15 07:02:14211 // Just like RenderFrame::FromWebFrame but returns the implementation.
212 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09213
[email protected]2f61bdd2013-07-02 18:38:47214 // Used by content_layouttest_support to hook into the creation of
215 // RenderFrameImpls.
jochen664198b2015-06-25 14:13:00216 struct CreateParams {
avi1023d012015-12-25 02:39:14217 CreateParams(RenderViewImpl* render_view, int32_t routing_id)
jochen664198b2015-06-25 14:13:00218 : render_view(render_view), routing_id(routing_id) {}
219 ~CreateParams() {}
220
221 RenderViewImpl* render_view;
avi1023d012015-12-25 02:39:14222 int32_t routing_id;
jochen664198b2015-06-25 14:13:00223 };
224
225 using CreateRenderFrameImplFunction =
226 RenderFrameImpl* (*)(const CreateParams&);
[email protected]2f61bdd2013-07-02 18:38:47227 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50228 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47229
alexmos95733002015-08-24 16:38:09230 // Looks up and returns the WebFrame corresponding to a given opener frame
231 // routing ID. Also stores the opener's RenderView routing ID into
232 // |opener_view_routing_id|.
233 //
234 // TODO(alexmos): remove RenderViewImpl's dependency on
235 // opener_view_routing_id.
236 static blink::WebFrame* ResolveOpener(int opener_frame_routing_id,
237 int* opener_view_routing_id);
238
avi5c77d212015-09-25 20:08:25239 ~RenderFrameImpl() override;
[email protected]227692c52013-05-31 22:43:04240
dglazkovf0e1d6d2015-10-10 02:13:48241 // Called by RenderWidget when meaningful layout has happened.
242 // See RenderFrameObserver::DidMeaningfulLayout declaration for details.
243 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type);
244
[email protected]bffc8302014-01-23 20:52:16245 // Out-of-process child frames receive a signal from RenderWidgetCompositor
246 // when a compositor frame has committed.
247 void DidCommitCompositorFrame();
248
lfge0c2792ec2016-05-11 18:52:08249 // Draw commands have been issued by RenderWidgetCompositor.
250 void DidCommitAndDrawCompositorFrame();
251
[email protected]7a4e2532013-12-02 21:30:02252 // TODO(jam): this is a temporary getter until all the code is transitioned
253 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26254 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02255
creis225a7432016-06-03 22:56:27256 const blink::WebHistoryItem& current_history_item() {
257 return current_history_item_;
258 }
259
[email protected]f3add922013-12-20 23:17:16260 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
261
[email protected]7a4e2532013-12-02 21:30:02262 // Returns the RenderWidget associated with this frame.
263 RenderWidget* GetRenderWidget();
264
dgozmancf9039cd2015-04-06 12:01:31265 DevToolsAgent* devtools_agent() { return devtools_agent_; }
266
[email protected]0287e762014-04-11 13:07:58267 // This method must be called after the frame has been added to the frame
268 // tree. It creates all objects that depend on the frame being at its proper
269 // spot.
270 void Initialize();
271
[email protected]de3c5d82014-05-28 22:12:59272 // Notifications from RenderWidget.
273 void WasHidden();
274 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31275 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59276
[email protected]723971b2014-02-12 11:08:25277 // Start/Stop loading notifications.
278 // TODO(nasko): Those are page-level methods at this time and come from
279 // WebViewClient. We should move them to be WebFrameClient calls and put
280 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09281 // |to_different_document| will be true unless the load is a fragment
282 // navigation, or triggered by history.pushState/replaceState.
avi5c77d212015-09-25 20:08:25283 void didStartLoading(bool to_different_document) override;
284 void didStopLoading() override;
285 void didChangeLoadProgress(double load_progress) override;
[email protected]723971b2014-02-12 11:08:25286
[email protected]95640212014-07-26 18:14:30287 AccessibilityMode accessibility_mode() {
288 return accessibility_mode_;
289 }
290
dmazzoni8e6fe4d2016-06-27 06:35:37291 RenderAccessibilityImpl* render_accessibility() {
292 return render_accessibility_;
[email protected]95640212014-07-26 18:14:30293 }
294
295 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
296 blink::WebAXEvent event);
297
estade31c54342015-01-23 03:34:36298 // The focused node changed to |node|. If focus was lost from this frame,
299 // |node| will be null.
[email protected]95640212014-07-26 18:14:30300 void FocusedNodeChanged(const blink::WebNode& node);
301
estade31c54342015-01-23 03:34:36302 // TODO(dmazzoni): the only reason this is here is to plumb it through to
dmazzoni8e6fe4d2016-06-27 06:35:37303 // RenderAccessibilityImpl. It should use the RenderFrameObserver method, once
estade31c54342015-01-23 03:34:36304 // blink has a separate accessibility tree per frame.
305 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
306
lfge0c2792ec2016-05-11 18:52:08307 // Called when this frame's widget is focused.
308 void RenderWidgetSetFocus(bool enable);
309
310 // Called when the widget receives a mouse event.
311 void RenderWidgetWillHandleMouseEvent();
312
[email protected]7a4e2532013-12-02 21:30:02313#if defined(ENABLE_PLUGINS)
paulmeyer5d0a5f02016-01-21 20:15:52314 // Get/set the plugin which will be used to handle document find requests.
315 void set_plugin_find_handler(PepperPluginInstanceImpl* plugin) {
316 plugin_find_handler_ = plugin;
317 }
318 PepperPluginInstanceImpl* plugin_find_handler() {
319 return plugin_find_handler_;
320 }
321
[email protected]271ff5792013-12-04 22:29:31322 // Notification that a PPAPI plugin has been created.
323 void PepperPluginCreated(RendererPpapiHost* host);
324
[email protected]7a4e2532013-12-02 21:30:02325 // Notifies that |instance| has changed the cursor.
326 // This will update the cursor appearance if it is currently over the plugin
327 // instance.
328 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
329 const blink::WebCursorInfo& cursor);
330
331 // Notifies that |instance| has received a mouse event.
332 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
333
[email protected]7a4e2532013-12-02 21:30:02334 // Informs the render view that a PPAPI plugin has changed text input status.
335 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
336 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
337
338 // Cancels current composition.
339 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
340
341 // Informs the render view that a PPAPI plugin has changed selection.
342 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
343
344 // Creates a fullscreen container for a pepper plugin instance.
345 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
346 PepperPluginInstanceImpl* plugin);
347
[email protected]7a4e2532013-12-02 21:30:02348 bool IsPepperAcceptingCompositionEvents() const;
349
350 // Notification that the given plugin has crashed.
351 void PluginCrashed(const base::FilePath& plugin_path,
352 base::ProcessId plugin_pid);
353
[email protected]7a4e2532013-12-02 21:30:02354 // Simulates IME events for testing purpose.
355 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26356 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02357 const std::vector<blink::WebCompositionUnderline>& underlines,
358 int selection_start,
359 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26360 void SimulateImeConfirmComposition(const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02361 const gfx::Range& replacement_range);
362
363 // TODO(jam): remove these once the IPC handler moves from RenderView to
364 // RenderFrame.
365 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42366 const base::string16& text,
367 const std::vector<blink::WebCompositionUnderline>& underlines,
368 int selection_start,
369 int selection_end);
370 void OnImeConfirmComposition(const base::string16& text,
371 const gfx::Range& replacement_range,
372 bool keep_selection);
373#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02374
[email protected]977db4a42014-07-17 08:04:32375 // May return NULL in some cases, especially if userMediaClient() returns
376 // NULL.
377 MediaStreamDispatcher* GetMediaStreamDispatcher();
378
haibinluc643d33c2016-06-03 02:22:34379#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:14380 void DidHideExternalPopupMenu();
381#endif
382
[email protected]227692c52013-05-31 22:43:04383 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52384 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04385
386 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52387 bool OnMessageReceived(const IPC::Message& msg) override;
[email protected]227692c52013-05-31 22:43:04388
[email protected]271ff5792013-12-04 22:29:31389 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52390 RenderView* GetRenderView() override;
dmazzoni8e6fe4d2016-06-27 06:35:37391 RenderAccessibility* GetRenderAccessibility() override;
dcheng6d18e402014-10-21 12:32:52392 int GetRoutingID() override;
393 blink::WebLocalFrame* GetWebFrame() override;
394 WebPreferences& GetWebkitPreferences() override;
395 int ShowContextMenu(ContextMenuClient* client,
396 const ContextMenuParams& params) override;
397 void CancelContextMenu(int request_id) override;
tommycli59bd86c2014-12-10 02:09:38398 blink::WebPlugin* CreatePlugin(
399 blink::WebFrame* frame,
400 const WebPluginInfo& info,
401 const blink::WebPluginParams& params,
dchengcedca5612016-04-09 01:40:15402 std::unique_ptr<PluginInstanceThrottler> throttler) override;
japhetb0bae9d82015-10-19 20:43:40403 void LoadURLExternally(const blink::WebURLRequest& request,
dcheng6d18e402014-10-21 12:32:52404 blink::WebNavigationPolicy policy) override;
405 void ExecuteJavaScript(const base::string16& javascript) override;
dglazkov2e140f52015-09-28 16:10:07406 bool IsMainFrame() override;
dcheng6d18e402014-10-21 12:32:52407 bool IsHidden() override;
ben155ecf82016-06-21 22:43:26408 shell::InterfaceRegistry* GetInterfaceRegistry() override;
409 shell::InterfaceProvider* GetRemoteInterfaces() override;
tommyclid481c482014-12-03 01:50:41410#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38411 void RegisterPeripheralPlugin(
tommycli58e3172c2015-09-15 18:18:26412 const url::Origin& content_origin,
tommycli59bd86c2014-12-10 02:09:38413 const base::Closure& unthrottle_callback) override;
tommycli9c7cbd92015-12-18 23:34:34414 RenderFrame::PeripheralContentStatus GetPeripheralContentStatus(
415 const url::Origin& main_frame_origin,
416 const url::Origin& content_origin,
417 const gfx::Size& unobscured_size) const override;
tommyclibae63b92015-10-23 02:56:20418 void WhitelistContentOrigin(const url::Origin& content_origin) override;
tommyclid481c482014-12-03 01:50:41419#endif
dcheng6d18e402014-10-21 12:32:52420 bool IsFTPDirectoryListing() override;
421 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52422 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52423 void SetSelectedText(const base::string16& selection_text,
424 size_t offset,
425 const gfx::Range& range) override;
426 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19427 v8::Local<v8::Context> context) override;
rdevlin.croninb2cec912015-06-24 20:36:01428 void AddMessageToConsole(ConsoleMessageLevel level,
429 const std::string& message) override;
megjablond5ac7d52015-10-22 23:56:12430 bool IsUsingLoFi() const override;
ellyjonesdb20fae12015-12-04 16:47:55431 bool IsPasting() const override;
lfg717154072016-06-30 15:04:16432 blink::WebPageVisibilityState GetVisibilityState() const override;
[email protected]271ff5792013-12-04 22:29:31433
ben76f52b242016-06-18 05:42:48434 // mojom::Frame implementation:
435 void GetInterfaceProvider(
436 shell::mojom::InterfaceProviderRequest request) override;
437
[email protected]96307312014-05-04 01:00:19438 // blink::WebFrameClient implementation:
avi5c77d212015-09-25 20:08:25439 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
440 const blink::WebPluginParams& params) override;
441 blink::WebMediaPlayer* createMediaPlayer(
guidou9bfe4e2f2016-04-09 08:31:19442 const blink::WebMediaPlayerSource& source,
srirama.m26f864d02015-07-14 05:21:46443 blink::WebMediaPlayerClient* client,
444 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
guidou9c3cc3e2015-10-27 13:38:15445 blink::WebContentDecryptionModule* initial_cdm,
davveadd785e72016-01-26 17:40:36446 const blink::WebString& sink_id,
447 blink::WebMediaSession* media_session) override;
davve50137b62015-10-23 12:15:21448 blink::WebMediaSession* createMediaSession() override;
avi5c77d212015-09-25 20:08:25449 blink::WebApplicationCacheHost* createApplicationCacheHost(
avi5c77d212015-09-25 20:08:25450 blink::WebApplicationCacheHostClient* client) override;
451 blink::WebWorkerContentSettingsClientProxy*
avi01681ef2016-02-16 17:53:57452 createWorkerContentSettingsClientProxy() override;
avi5c77d212015-09-25 20:08:25453 blink::WebExternalPopupMenu* createExternalPopupMenu(
[email protected]b20c3222014-08-22 00:50:22454 const blink::WebPopupMenuInfo& popup_menu_info,
avi5c77d212015-09-25 20:08:25455 blink::WebExternalPopupMenuClient* popup_menu_client) override;
avi5047cd572016-02-16 20:41:12456 blink::WebCookieJar* cookieJar() override;
skyostilb4cce1b2016-03-31 17:56:34457 blink::BlameContext* frameBlameContext() override;
avi01681ef2016-02-16 17:53:57458 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override;
avi5047cd572016-02-16 20:41:12459 void didAccessInitialDocument() override;
avi5c77d212015-09-25 20:08:25460 blink::WebFrame* createChildFrame(
alexmose48b1df932015-01-16 01:34:17461 blink::WebLocalFrame* parent,
dcheng860817a2015-05-22 03:16:56462 blink::WebTreeScopeType scope,
463 const blink::WebString& name,
lukasza464d8692016-02-22 19:26:32464 const blink::WebString& unique_name,
465 blink::WebSandboxFlags sandbox_flags,
466 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25467 void didChangeOpener(blink::WebFrame* frame) override;
lfgaf41ee002016-07-05 14:57:24468 void frameDetached(blink::WebLocalFrame* frame, DetachType type) override;
avi5c77d212015-09-25 20:08:25469 void frameFocused() override;
470 void willClose(blink::WebFrame* frame) override;
lukasza464d8692016-02-22 19:26:32471 void didChangeName(const blink::WebString& name,
472 const blink::WebString& unique_name) override;
mkwstf672e7ef2016-06-09 20:51:07473 void didEnforceInsecureRequestPolicy(
474 blink::WebInsecureRequestPolicy policy) override;
estarkbd8e26f2016-03-16 23:30:37475 void didUpdateToUniqueOrigin(
476 bool is_potentially_trustworthy_unique_origin) override;
avi5c77d212015-09-25 20:08:25477 void didChangeSandboxFlags(blink::WebFrame* child_frame,
478 blink::WebSandboxFlags flags) override;
lukasza8e1c02e42016-05-17 20:05:10479 void didAddContentSecurityPolicy(
480 const blink::WebString& header_value,
481 blink::WebContentSecurityPolicyType type,
482 blink::WebContentSecurityPolicySource source) override;
Avi Drissman09b359e52015-12-07 20:19:21483 void didChangeFrameOwnerProperties(
lazyboy70605c32015-11-03 01:27:31484 blink::WebFrame* child_frame,
485 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25486 void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22487 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46488 const blink::WebVector<blink::WebString>& newly_matching_selectors,
avi5c77d212015-09-25 20:08:25489 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
490 override;
491 bool shouldReportDetailedMessageForSource(
492 const blink::WebString& source) override;
493 void didAddMessageToConsole(const blink::WebConsoleMessage& message,
494 const blink::WebString& source_name,
495 unsigned source_line,
496 const blink::WebString& stack_trace) override;
japhetb0bae9d82015-10-19 20:43:40497 void loadURLExternally(const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25498 blink::WebNavigationPolicy policy,
japhetb0bae9d82015-10-19 20:43:40499 const blink::WebString& suggested_name,
500 bool should_replace_current_entry) override;
avi5c77d212015-09-25 20:08:25501 blink::WebNavigationPolicy decidePolicyForNavigation(
502 const NavigationPolicyInfo& info) override;
creise18ce072015-12-02 02:00:02503 blink::WebHistoryItem historyItemForNewChildFrame() override;
avi0fe3a6d2016-02-16 20:57:27504 void willSendSubmitEvent(const blink::WebFormElement& form) override;
505 void willSubmitForm(const blink::WebFormElement& form) override;
avi5c77d212015-09-25 20:08:25506 void didCreateDataSource(blink::WebLocalFrame* frame,
507 blink::WebDataSource* datasource) override;
508 void didStartProvisionalLoad(blink::WebLocalFrame* frame,
509 double triggering_event_time) override;
510 void didReceiveServerRedirectForProvisionalLoad(
511 blink::WebLocalFrame* frame) override;
512 void didFailProvisionalLoad(blink::WebLocalFrame* frame,
513 const blink::WebURLError& error,
514 blink::WebHistoryCommitType commit_type) override;
515 void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22516 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52517 const blink::WebHistoryItem& item,
avi5c77d212015-09-25 20:08:25518 blink::WebHistoryCommitType commit_type) override;
519 void didCreateNewDocument(blink::WebLocalFrame* frame) override;
520 void didClearWindowObject(blink::WebLocalFrame* frame) override;
521 void didCreateDocumentElement(blink::WebLocalFrame* frame) override;
rob43ea0642016-03-19 01:05:01522 void runScriptsAtDocumentElementAvailable(
523 blink::WebLocalFrame* frame) override;
avi5c77d212015-09-25 20:08:25524 void didReceiveTitle(blink::WebLocalFrame* frame,
525 const blink::WebString& title,
526 blink::WebTextDirection direction) override;
527 void didChangeIcon(blink::WebLocalFrame* frame,
528 blink::WebIconURL::Type icon_type) override;
rob2718dfc2016-03-25 20:58:27529 void didFinishDocumentLoad(blink::WebLocalFrame* frame) override;
530 void runScriptsAtDocumentReady(blink::WebLocalFrame* frame,
531 bool document_is_empty) override;
avi5c77d212015-09-25 20:08:25532 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override;
533 void didFailLoad(blink::WebLocalFrame* frame,
534 const blink::WebURLError& error,
535 blink::WebHistoryCommitType commit_type) override;
536 void didFinishLoad(blink::WebLocalFrame* frame) override;
537 void didNavigateWithinPage(blink::WebLocalFrame* frame,
538 const blink::WebHistoryItem& item,
avi68a109ab2016-05-15 01:46:32539 blink::WebHistoryCommitType commit_type,
540 bool content_initiated) override;
avi1008732f2016-02-17 17:28:49541 void didUpdateCurrentHistoryItem() override;
avi5c77d212015-09-25 20:08:25542 void didChangeThemeColor() override;
543 void dispatchLoad() override;
tbansal7b6cf8b2016-05-10 19:27:23544 blink::WebEffectiveConnectionType getEffectiveConnectionType() override;
avi5c77d212015-09-25 20:08:25545 void requestNotificationPermission(
[email protected]4459599e2014-07-29 22:40:09546 const blink::WebSecurityOrigin& origin,
avi5c77d212015-09-25 20:08:25547 blink::WebNotificationPermissionCallback* callback) override;
548 void didChangeSelection(bool is_empty_selection) override;
549 blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19550 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55551 const blink::WebColor& initial_color,
avi5c77d212015-09-25 20:08:25552 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override;
553 void runModalAlertDialog(const blink::WebString& message) override;
554 bool runModalConfirmDialog(const blink::WebString& message) override;
555 bool runModalPromptDialog(const blink::WebString& message,
556 const blink::WebString& default_value,
557 blink::WebString* actual_value) override;
avi141dbc1322016-03-11 22:27:42558 bool runModalBeforeUnloadDialog(bool is_reload) override;
naskoada75b22016-06-11 16:09:46559 bool runFileChooser(
560 const blink::WebFileChooserParams& params,
561 blink::WebFileChooserCompletion* chooser_completion) override;
avi5c77d212015-09-25 20:08:25562 void showContextMenu(const blink::WebContextMenuData& data) override;
brettw8f508f42016-06-20 21:34:21563 void saveImageFromDataURL(const blink::WebString& data_url) override;
avi5c77d212015-09-25 20:08:25564 void willSendRequest(blink::WebLocalFrame* frame,
565 unsigned identifier,
566 blink::WebURLRequest& request,
567 const blink::WebURLResponse& redirect_response) override;
avi1008732f2016-02-17 17:28:49568 void didReceiveResponse(unsigned identifier,
avi5c77d212015-09-25 20:08:25569 const blink::WebURLResponse& response) override;
570 void didLoadResourceFromMemoryCache(
[email protected]180ef242013-11-07 06:50:46571 const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25572 const blink::WebURLResponse& response) override;
573 void didDisplayInsecureContent() override;
574 void didRunInsecureContent(const blink::WebSecurityOrigin& origin,
575 const blink::WebURL& target) override;
estark910b4572015-12-09 20:55:41576 void didDisplayContentWithCertificateErrors(
577 const blink::WebURL& url,
estarkaeda1422016-05-10 02:31:12578 const blink::WebCString& security_info) override;
estark910b4572015-12-09 20:55:41579 void didRunContentWithCertificateErrors(
580 const blink::WebURL& url,
estarkaeda1422016-05-10 02:31:12581 const blink::WebCString& security_info) override;
avi5c77d212015-09-25 20:08:25582 void didChangePerformanceTiming() override;
csharrisonae811ab2016-04-11 11:32:25583 void didObserveLoadingBehavior(
584 blink::WebLoadingBehaviorFlag behavior) override;
avi5c77d212015-09-25 20:08:25585 void didCreateScriptContext(blink::WebLocalFrame* frame,
586 v8::Local<v8::Context> context,
587 int extension_group,
588 int world_id) override;
589 void willReleaseScriptContext(blink::WebLocalFrame* frame,
590 v8::Local<v8::Context> context,
591 int world_id) override;
592 void didChangeScrollOffset(blink::WebLocalFrame* frame) override;
593 void willInsertBody(blink::WebLocalFrame* frame) override;
594 void reportFindInPageMatchCount(int request_id,
595 int count,
596 bool final_update) override;
597 void reportFindInPageSelection(int request_id,
598 int active_match_ordinal,
599 const blink::WebRect& sel) override;
avif0d894852016-02-17 17:49:12600 void requestStorageQuota(blink::WebStorageQuotaType type,
avi5c77d212015-09-25 20:08:25601 unsigned long long requested_size,
602 blink::WebStorageQuotaCallbacks callbacks) override;
603 void willOpenWebSocket(blink::WebSocketHandle* handle) override;
avi5c77d212015-09-25 20:08:25604 blink::WebPushClient* pushClient() override;
605 blink::WebPresentationClient* presentationClient() override;
606 void willStartUsingPeerConnectionHandler(
avi5c77d212015-09-25 20:08:25607 blink::WebRTCPeerConnectionHandler* handler) override;
608 blink::WebUserMediaClient* userMediaClient() override;
609 blink::WebEncryptedMediaClient* encryptedMediaClient() override;
hush2e664672016-07-07 18:06:24610 blink::WebMIDIClient* webMIDIClient() override;
avif0d894852016-02-17 17:49:12611 blink::WebString userAgentOverride() override;
612 blink::WebString doNotTrackValue() override;
613 bool allowWebGL(bool default_value) override;
avi5c77d212015-09-25 20:08:25614 blink::WebScreenOrientationClient* webScreenOrientationClient() override;
615 bool isControlledByServiceWorker(blink::WebDataSource& data_source) override;
616 int64_t serviceWorkerID(blink::WebDataSource& data_source) override;
617 void postAccessibilityEvent(const blink::WebAXObject& obj,
618 blink::WebAXEvent event) override;
619 void handleAccessibilityFindInPageResult(
620 int identifier,
621 int match_index,
622 const blink::WebAXObject& start_object,
623 int start_offset,
624 const blink::WebAXObject& end_object,
625 int end_offset) override;
avi1008732f2016-02-17 17:28:49626 void didChangeManifest() override;
foolip73101372016-07-13 08:19:22627 void enterFullscreen() override;
628 void exitFullscreen() override;
avi5c77d212015-09-25 20:08:25629 blink::WebPermissionClient* permissionClient() override;
630 blink::WebAppBannerClient* appBannerClient() override;
631 void registerProtocolHandler(const blink::WebString& scheme,
632 const blink::WebURL& url,
633 const blink::WebString& title) override;
634 void unregisterProtocolHandler(const blink::WebString& scheme,
635 const blink::WebURL& url) override;
636 blink::WebBluetooth* bluetooth() override;
guidou3906a722015-11-12 22:14:42637 void checkIfAudioSinkExistsAndIsAuthorized(
638 const blink::WebString& sink_id,
639 const blink::WebSecurityOrigin& security_origin,
640 blink::WebSetSinkIdCallbacks* web_callbacks) override;
sammcbebeb602016-04-06 06:42:55641 blink::ServiceRegistry* serviceRegistry() override;
lfg717154072016-06-30 15:04:16642 blink::WebPageVisibilityState visibilityState() const override;
[email protected]85d85fd2013-06-19 00:57:41643
lukasza902fcc52015-12-31 04:45:29644 // WebFrameSerializerClient implementation:
lukasza2e296c32015-09-28 23:29:48645 void didSerializeDataForFrame(
lukasza2e296c32015-09-28 23:29:48646 const blink::WebCString& data,
lukasza902fcc52015-12-31 04:45:29647 blink::WebFrameSerializerClient::FrameSerializationStatus status)
648 override;
lukasza2e296c32015-09-28 23:29:48649
ben76f52b242016-06-18 05:42:48650 // Binds to the FrameHost in the browser.
651 void Bind(mojom::FrameRequest frame, mojom::FrameHostPtr frame_host);
rockotf8fdd9b2015-12-16 22:22:35652
mlamouri4fff1992014-09-30 11:22:46653 ManifestManager* manifest_manager();
654
avi0392dbf52015-03-25 16:55:45655 // TODO(creis): Remove when the only caller, the HistoryController, is no
656 // more.
657 void SetPendingNavigationParams(
dchengcedca5612016-04-09 01:40:15658 std::unique_ptr<NavigationParams> navigation_params);
avi0392dbf52015-03-25 16:55:45659
xhwang5206d4e62016-02-05 02:09:55660 media::MediaPermission* GetMediaPermission();
guoweisf4282b02015-09-24 23:05:22661
creis69b184a472015-11-26 05:29:51662 // Sends the current frame's navigation state to the browser.
663 void SendUpdateState();
664
sammce2f99982016-03-14 22:38:12665 // Creates a MojoBindingsController if Mojo bindings have been enabled for
666 // this frame. For WebUI, this allows the page to communicate with the browser
667 // process; for layout tests, this allows the test to mock out services at
668 // the Mojo IPC layer.
669 void MaybeEnableMojoBindings();
nasko1fa0fb62015-12-09 01:49:57670
lfge0c2792ec2016-05-11 18:52:08671 // Plugin-related functions --------------------------------------------------
672
673#if defined(ENABLE_PLUGINS)
674 PepperPluginInstanceImpl* focused_pepper_plugin() {
675 return focused_pepper_plugin_;
676 }
677 PepperPluginInstanceImpl* pepper_last_mouse_event_target() {
678 return pepper_last_mouse_event_target_;
679 }
680 void set_pepper_last_mouse_event_target(PepperPluginInstanceImpl* plugin) {
681 pepper_last_mouse_event_target_ = plugin;
682 }
683
684 // Indicates that the given instance has been created.
685 void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
686
687 // Indicates that the given instance is being destroyed. This is called from
688 // the destructor, so it's important that the instance is not dereferenced
689 // from this call.
690 void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
691
692 // Notification that the given plugin is focused or unfocused.
693 void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
zqzhangc885f6b2016-06-23 19:44:46694
695 void PepperStartsPlayback(PepperPluginInstanceImpl* instance);
696 void PepperStopsPlayback(PepperPluginInstanceImpl* instance);
697 void OnSetPepperVolume(int32_t pp_instance, double volume);
lfge0c2792ec2016-05-11 18:52:08698#endif // ENABLE_PLUGINS
699
[email protected]2f61bdd2013-07-02 18:38:47700 protected:
jochen664198b2015-06-25 14:13:00701 explicit RenderFrameImpl(const CreateParams& params);
[email protected]2f61bdd2013-07-02 18:38:47702
[email protected]227692c52013-05-31 22:43:04703 private:
kenrbf98a4d22015-04-01 21:59:35704 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26705 friend class RenderFrameObserver;
dmazzoni8e6fe4d2016-06-27 06:35:37706 friend class RenderAccessibilityImplTest;
clamy98a9dee02015-06-24 16:09:10707 friend class TestRenderFrame;
avi485e5fd62014-08-25 23:26:14708 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
709 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
710 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
711 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
dmazzoni8e6fe4d2016-06-27 06:35:37712 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest,
[email protected]66bbadaf2014-03-28 16:25:54713 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]2e2d9632013-12-03 00:55:26714
twellington376424ad2015-05-04 18:57:25715 // A wrapper class used as the callback for JavaScript executed
716 // in an isolated world.
717 class JavaScriptIsolatedWorldRequest
718 : public blink::WebScriptExecutionCallback {
719 public:
720 JavaScriptIsolatedWorldRequest(
721 int id,
722 bool notify_result,
723 int routing_id,
724 base::WeakPtr<RenderFrameImpl> render_frame_impl);
725 void completed(
726 const blink::WebVector<v8::Local<v8::Value>>& result) override;
727
728 private:
avi5c77d212015-09-25 20:08:25729 ~JavaScriptIsolatedWorldRequest() override;
twellington376424ad2015-05-04 18:57:25730
731 int id_;
732 bool notify_result_;
733 int routing_id_;
734 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
735
736 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
737 };
738
[email protected]37567b432014-02-12 01:12:22739 typedef std::map<GURL, double> HostZoomLevels;
740
dchengc5ef1a52015-08-26 20:58:30741 // Creates a new RenderFrame. |render_view| is the RenderView object that this
742 // frame belongs to.
ddorwinf63505e2016-01-08 00:54:50743 // Callers *must* call |BindToWebFrame| immediately after creation.
avi1023d012015-12-25 02:39:14744 static RenderFrameImpl* Create(RenderViewImpl* render_view,
745 int32_t routing_id);
dchengc5ef1a52015-08-26 20:58:30746
ddorwinf63505e2016-01-08 00:54:50747 // This is called right after creation with the WebLocalFrame for this
748 // RenderFrame. It must be called before Initialize.
749 void BindToWebFrame(blink::WebLocalFrame* web_frame);
750
[email protected]2e2d9632013-12-03 00:55:26751 // Functions to add and remove observers for this object.
752 void AddObserver(RenderFrameObserver* observer);
753 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34754
dcheng3d886b732015-11-05 19:16:01755 bool IsLocalRoot() const;
756
[email protected]f0906a02014-08-07 07:18:55757 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35758 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
creis8b5cd4c2015-06-19 00:11:08759 blink::WebHistoryCommitType commit_type,
760 const blink::WebHistoryItem& item);
[email protected]37567b432014-02-12 01:12:22761
[email protected]b70da4c2014-01-06 19:57:09762 // IPC message handlers ------------------------------------------------------
763 //
764 // The documentation for these functions should be in
765 // content/common/*_messages.h for the message that the function is handling.
clamy98a9dee02015-06-24 16:09:10766 void OnNavigate(const CommonNavigationParams& common_params,
767 const StartNavigationParams& start_params,
768 const RequestNavigationParams& request_params);
clamybfd6a812016-05-30 16:25:17769 void OnBeforeUnload(bool is_reload);
alexmosbc7eafa2014-12-06 01:38:09770 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56771 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09772 const FrameReplicationState& replicated_frame_state);
naskoeab5c5582015-12-15 05:20:00773 void OnDeleteFrame();
Nasko Oskov85f60222014-08-28 22:53:30774 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42775 void OnShowContextMenu(const gfx::Point& location);
776 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
777 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
778 unsigned action);
[email protected]4ee64622014-03-21 22:34:15779 void OnUndo();
780 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07781 void OnCut();
782 void OnCopy();
783 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15784 void OnPasteAndMatchStyle();
785 void OnDelete();
786 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14787 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
aurimasab0319022015-07-10 21:57:38788 void OnAdjustSelectionByCharacterOffset(int start_adjust, int end_adjust);
[email protected]4ee64622014-03-21 22:34:15789 void OnUnselect();
christiankaeed9862014-11-05 10:49:14790 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17791 void OnReplace(const base::string16& text);
792 void OnReplaceMisspelling(const base::string16& text);
brettw8f508f42016-06-20 21:34:21793 void OnCopyImageAt(int x, int y);
794 void OnSaveImageAt(int x, int y);
[email protected]e31b8ebb2014-03-07 17:59:34795 void OnCSSInsertRequest(const std::string& css);
peter4eb242002015-06-02 12:45:13796 void OnAddMessageToConsole(ConsoleMessageLevel level,
797 const std::string& message);
[email protected]f13ab892014-03-12 06:48:52798 void OnJavaScriptExecuteRequest(const base::string16& javascript,
799 int id,
800 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28801 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
802 int id,
jochen2e7d95b2015-05-04 15:28:50803 bool notify_result,
804 bool has_user_gesture);
twellington376424ad2015-05-04 18:57:25805 void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
806 int id,
807 bool notify_result,
808 int world_id);
avi1023d012015-12-25 02:39:14809 void OnVisualStateRequest(uint64_t key);
[email protected]4ee64622014-03-21 22:34:15810 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16811 void OnSetCompositionFromExistingText(
812 int start, int end,
813 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24814 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16815 void OnExtendSelectionAndDelete(int before, int after);
toyoshim24a4c7ab2016-04-05 09:24:14816 void OnReload(bool bypass_cache);
megjablon3f5941072016-02-04 23:27:52817 void OnReloadLoFiImages();
jam973236102016-02-09 00:47:05818 void OnTextSurroundingSelectionRequest(uint32_t max_length);
[email protected]95640212014-07-26 18:14:30819 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51820 void OnSnapshotAccessibilityTree(int callback_id);
alexmos95733002015-08-24 16:38:09821 void OnUpdateOpener(int opener_routing_id);
dcheng5f60abb2015-05-28 01:39:36822 void OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags);
lazyboy70605c32015-11-03 01:27:31823 void OnSetFrameOwnerProperties(
raymesbba82b32016-07-19 00:41:38824 const FrameOwnerProperties& frame_owner_properties);
alexmos401f0aba2015-12-06 10:07:39825 void OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id);
alexmos5357efb2015-12-16 21:44:00826 void OnSetFocusedFrame();
dspelle736c9db2015-04-03 04:53:16827 void OnTextTrackSettingsChanged(
828 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16829 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
davidbena5496d62014-10-07 18:52:04830 void OnCommitNavigation(const ResourceResponseHead& response,
831 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42832 const CommonNavigationParams& common_params,
lukaszad04640f2016-05-25 17:08:44833 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57834 void OnFailedNavigation(const CommonNavigationParams& common_params,
835 const RequestNavigationParams& request_params,
836 bool has_stale_copy_in_cache,
837 int error_code);
lukasza6af746b72015-09-18 23:37:22838 void OnGetSavableResourceLinks();
lukasza2e296c32015-09-28 23:29:48839 void OnGetSerializedHtmlWithLocalLinks(
lukasza777a7dd2016-01-25 23:55:47840 const std::map<GURL, base::FilePath>& url_to_local_path,
841 const std::map<int, base::FilePath>& frame_routing_id_to_local_path);
lukaszaede9cc02015-12-30 23:48:32842 void OnSerializeAsMHTML(const FrameMsg_SerializeAsMHTML_Params& params);
paulmeyer5d0a5f02016-01-21 20:15:52843 void OnFind(int request_id,
844 const base::string16& search_text,
845 const blink::WebFindOptions& options);
paulmeyerc8cb7cb2016-06-07 01:14:19846 void OnClearActiveFindMatch();
paulmeyer5d0a5f02016-01-21 20:15:52847 void OnStopFinding(StopFindAction action);
clamy91b7abf2016-03-24 15:17:45848 void OnEnableViewSourceMode();
avi6b8dbb32016-04-08 18:59:35849 void OnSuppressFurtherDialogs();
naskoada75b22016-06-11 16:09:46850 void OnFileChooserResponse(
851 const std::vector<content::FileChooserFileInfo>& files);
paulmeyer5d0a5f02016-01-21 20:15:52852#if defined(OS_ANDROID)
853 void OnActivateNearestFindResult(int request_id, float x, float y);
paulmeyerc8cb7cb2016-06-07 01:14:19854 void OnGetNearestFindResult(int request_id, float x, float y);
paulmeyer5d0a5f02016-01-21 20:15:52855 void OnFindMatchRects(int current_version);
haibinluc643d33c2016-06-03 02:22:34856#endif
857
858#if defined(USE_EXTERNAL_POPUP_MENU)
859#if defined(OS_MACOSX)
860 void OnSelectPopupMenuItem(int selected_index);
861#else
paulmeyer5d0a5f02016-01-21 20:15:52862 void OnSelectPopupMenuItems(bool canceled,
863 const std::vector<int>& selected_indices);
haibinluc643d33c2016-06-03 02:22:34864#endif
865#endif
866
867#if defined(OS_MACOSX)
paulmeyer5d0a5f02016-01-21 20:15:52868 void OnCopyToFindPboard();
869#endif
clamy9bfeef42014-09-30 20:50:42870
creise18ce072015-12-02 02:00:02871 // Requests that the browser process navigates to |url|. If
872 // |is_history_navigation_in_new_child| is true, the browser process should
873 // look for a matching FrameNavigationEntry in the last committed entry to use
874 // instead of |url|.
lukaszabb2101b82016-06-17 16:52:25875 void OpenURL(
876 const GURL& url,
877 bool uses_post,
878 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body,
879 const Referrer& referrer,
880 blink::WebNavigationPolicy policy,
881 bool should_replace_current_entry,
882 bool is_history_navigation_in_new_child);
[email protected]a09d53ce2014-01-31 00:46:42883
clamyd6983032015-04-29 14:48:12884 // Performs a navigation in the frame. This provides a unified function for
885 // the current code path and the browser-side navigation path (in
886 // development). Currently used by OnNavigate, with all *NavigationParams
887 // provided by the browser. |stream_params| should be null.
888 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
889 // |request_params| received by the browser. |stream_params| should be non
890 // null and created from the information provided by the browser.
891 // |start_params| is not used.
dchengcedca5612016-04-09 01:40:15892 void NavigateInternal(
893 const CommonNavigationParams& common_params,
894 const StartNavigationParams& start_params,
895 const RequestNavigationParams& request_params,
lukaszad04640f2016-05-25 17:08:44896 std::unique_ptr<StreamOverrideParameters> stream_params);
clamyd6983032015-04-29 14:48:12897
[email protected]ef3adfc2014-05-11 00:04:54898 // Update current main frame's encoding and send it to browser window.
899 // Since we want to let users see the right encoding info from menu
900 // before finishing loading, we call the UpdateEncoding in
901 // a) function:DidCommitLoadForFrame. When this function is called,
902 // that means we have got first data. In here we try to get encoding
903 // of page if it has been specified in http header.
904 // b) function:DidReceiveTitle. When this function is called,
905 // that means we have got specified title. Because in most of webpages,
906 // title tags will follow meta tags. In here we try to get encoding of
907 // page if it has been specified in meta tag.
908 // c) function:DidFinishDocumentLoadForFrame. When this function is
909 // called, that means we have got whole html page. In here we should
910 // finally get right encoding of page.
911 void UpdateEncoding(blink::WebFrame* frame,
912 const std::string& encoding_name);
913
[email protected]4ee64622014-03-21 22:34:15914 // Dispatches the current state of selection on the webpage to the browser if
915 // it has changed.
916 // TODO(varunjain): delete this method once we figure out how to keep
917 // selection handles in sync with the webpage.
918 void SyncSelectionIfRequired();
919
[email protected]87de04b02014-04-08 22:14:49920 bool RunJavaScriptMessage(JavaScriptMessageType type,
921 const base::string16& message,
922 const base::string16& default_value,
923 const GURL& frame_url,
924 base::string16* result);
925
naskoada75b22016-06-11 16:09:46926 // Adds the given file chooser request to the file_chooser_completion_ queue
927 // (see that var for more) and requests the chooser be displayed if there are
928 // no other waiting items in the queue.
929 //
930 // Returns true if the chooser was successfully scheduled. False means we
931 // didn't schedule anything.
932 bool ScheduleFileChooser(const FileChooserParams& params,
933 blink::WebFileChooserCompletion* completion);
934
[email protected]457736d2014-04-30 15:54:27935 // Loads the appropriate error page for the specified failure into the frame.
936 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
937 const blink::WebURLError& error,
938 bool replace);
939
zeeshanq3454e9c2014-09-04 21:30:28940 void HandleJavascriptExecutionResult(const base::string16& javascript,
941 int id,
942 bool notify_result,
deepak.s750d68f2015-04-30 07:32:41943 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:28944
[email protected]977db4a42014-07-17 08:04:32945 // Initializes |web_user_media_client_|. If this fails, because it wasn't
946 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
947 // |web_user_media_client_| will remain NULL.
948 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19949
950 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
guidou9c3cc3e2015-10-27 13:38:15951 blink::WebMediaPlayerClient* client,
952 const blink::WebString& sink_id,
953 const blink::WebSecurityOrigin& security_origin);
[email protected]96307312014-05-04 01:00:19954
[email protected]ae2477e2014-05-27 23:47:08955 // Creates a factory object used for creating audio and video renderers.
dchengcedca5612016-04-09 01:40:15956 std::unique_ptr<MediaStreamRendererFactory> CreateRendererFactory();
[email protected]ae2477e2014-05-27 23:47:08957
avi5cad4912015-06-19 05:25:44958 // Does preparation for the navigation to |url|.
959 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:25960 const GURL& url,
toyoshimf3f7f682016-04-08 07:47:48961 const RequestNavigationParams& request_params);
clamyda97e8322014-10-07 21:57:25962
clamyece38882014-11-19 15:00:20963 // PlzNavigate
arthursonzogni69824eb2016-07-13 16:22:03964 // Sends a FrameHostMsg_BeginNavigation to the browser
965 void BeginNavigation(const NavigationPolicyInfo& info);
clamyece38882014-11-19 15:00:20966
clamy4cc9b8202015-03-02 13:51:36967 // Loads a data url.
968 void LoadDataURL(const CommonNavigationParams& params,
mnaganovbf087422015-12-16 05:10:03969 const RequestNavigationParams& request_params,
clamy0f4ccc82016-02-24 12:43:53970 blink::WebLocalFrame* frame,
971 blink::WebFrameLoadType load_type,
972 blink::WebHistoryItem item_for_history_navigation,
973 blink::WebHistoryLoadType history_load_type,
974 bool is_client_redirect);
clamy4cc9b8202015-03-02 13:51:36975
clamy62b271d2015-04-16 11:54:57976 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
977 // the failed request |request|.
978 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
979 const blink::WebURLError& error,
980 blink::WebLocalFrame* frame);
981
982 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
983 const GURL& unreachable_url);
984
[email protected]f3a95312014-06-12 16:46:58985 // Returns the URL being loaded by the |frame_|'s request.
986 GURL GetLoadingUrl() const;
987
avi0392dbf52015-03-25 16:55:45988 // If we initiated a navigation, this function will populate |document_state|
989 // with the navigation information saved in OnNavigate().
990 void PopulateDocumentStateFromPending(DocumentState* document_state);
991
992 // Returns a new NavigationState populated with the navigation information
993 // saved in OnNavigate().
994 NavigationState* CreateNavigationStateFromPending();
995
csharrison1ce0e852015-11-07 16:45:13996 // Sets the NavigationState on the DocumentState based on
997 // the value of |pending_navigation_params_|.
boliuac512fd2016-03-16 23:33:35998 void UpdateNavigationState(DocumentState* document_state,
avi68a109ab2016-05-15 01:46:32999 bool was_within_same_page,
1000 bool content_initiated);
csharrison1ce0e852015-11-07 16:45:131001
[email protected]96307312014-05-04 01:00:191002#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:001003 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
jrummell65b7d272014-09-24 20:49:271004 blink::WebMediaPlayerClient* client,
srirama.m26f864d02015-07-14 05:21:461005 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
dalecurtis49f363882015-08-25 21:05:381006 const media::WebMediaPlayerParams& params);
[email protected]a017938b2014-05-27 21:17:171007
[email protected]65f3d1aa2014-05-29 01:57:001008 RendererMediaPlayerManager* GetMediaPlayerManager();
davve859f4f92015-11-27 10:16:191009
1010 RendererMediaSessionManager* GetMediaSessionManager();
[email protected]4b556cf2014-06-10 23:21:531011#endif
1012
sandersd02d9aea2015-05-12 02:29:261013 bool AreSecureCodecsSupported();
xhwang33f939e2015-06-23 04:33:421014
xhwange70b7ee12015-06-25 09:17:171015#if defined(ENABLE_MOJO_MEDIA)
rockotb00e6462016-04-14 02:24:031016 shell::mojom::InterfaceProvider* GetMediaInterfaceProvider();
xhwang33f939e2015-06-23 04:33:421017#endif
1018
xhwangd7180832015-04-03 05:38:151019 media::CdmFactory* GetCdmFactory();
xhwang409e53552016-02-23 00:52:441020 media::DecoderFactory* GetDecoderFactory();
[email protected]96307312014-05-04 01:00:191021
ben155ecf82016-06-21 22:43:261022 void RegisterMojoInterfaces();
halton.huoca2eabd2015-07-06 08:17:401023
xhwang6bca21e2016-02-06 00:21:451024 // Connect to an interface provided by the service registry.
1025 template <typename Interface>
bene3bc9022016-02-10 17:38:241026 void GetInterface(mojo::InterfaceRequest<Interface> request);
xhwang6bca21e2016-02-06 00:21:451027
rockotd9260982015-08-21 22:26:301028 // Connects to a Mojo application and returns a proxy to its exposed
1029 // ServiceProvider.
rockotb00e6462016-04-14 02:24:031030 shell::mojom::InterfaceProviderPtr ConnectToApplication(const GURL& url);
rockotd9260982015-08-21 22:26:301031
dalecurtisa12e6062015-11-10 23:13:141032 // Returns the media delegate for WebMediaPlayer usage. If
1033 // |media_player_delegate_| is NULL, one is created.
1034 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate();
1035
paulmeyer5d0a5f02016-01-21 20:15:521036 // Called to get the WebPlugin to handle find requests in the document.
1037 // Returns nullptr if there is no such WebPlugin.
1038 blink::WebPlugin* GetWebPluginForFind();
1039
1040 // Sends a reply to the current find operation handling if it was a
1041 // synchronous find request.
1042 void SendFindReply(int request_id,
1043 int match_count,
1044 int ordinal,
1045 const blink::WebRect& selection_rect,
1046 bool final_status_update);
1047
skyostilb4cce1b2016-03-31 17:56:341048 void InitializeBlameContext(RenderFrameImpl* parent_frame);
1049
creiscfaa4462015-03-16 19:27:181050 // Stores the WebLocalFrame we are associated with. This is null from the
ddorwinf63505e2016-01-08 00:54:501051 // constructor until BindToWebFrame is called, and it is null after
creiscfaa4462015-03-16 19:27:181052 // frameDetached is called until destruction (which is asynchronous in the
1053 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:221054 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:091055
dglazkov2e140f52015-09-28 16:10:071056 // Boolean value indicating whether this RenderFrameImpl object is for the
1057 // main frame or not. It remains accurate during destruction, even when
1058 // |frame_| has been invalidated.
1059 bool is_main_frame_;
nasko8b9d9bd2015-05-06 19:23:191060
naskoeab5c5582015-12-15 05:20:001061 // When a frame is detached in response to a message from the browser process,
1062 // this RenderFrame should not be sending notifications back to it. This
1063 // boolean is used to indicate this case.
1064 bool in_browser_initiated_detach_;
1065
1066 // Indicates whether the frame has been inserted into the frame tree yet or
1067 // not.
1068 //
1069 // When a frame is created by the browser process, it is for a pending
1070 // navigation. In this case, it is not immediately attached to the frame tree
1071 // if there is a RenderFrameProxy for the same frame. It is inserted into the
1072 // frame tree at the time the pending navigation commits.
1073 // Frames added by the parent document are created from the renderer process
1074 // and are immediately inserted in the frame tree.
1075 // TODO(dcheng): Remove this once we have FrameTreeHandle and can use the
1076 // Blink Web* layer to check for provisional frames.
1077 bool in_frame_tree_;
1078
[email protected]abc501e2014-01-27 19:27:261079 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:041080 int routing_id_;
nasko8b9d9bd2015-05-06 19:23:191081
japhete6adf142014-10-31 00:01:491082 // If this frame was created to replace a proxy, this will store the routing
1083 // id of the proxy to replace at commit-time, at which time it will be
1084 // cleared.
1085 // TODO(creis): Remove this after switching to PlzNavigate.
1086 int proxy_routing_id_;
1087
dcheng3d886b732015-11-05 19:16:011088 // Non-null when the RenderFrame is a local root for compositing, input,
1089 // layout, etc. A local frame is also a local root iff it does not have a
1090 // parent that is a local frame.
kenrba7199832015-01-22 23:44:591091 scoped_refptr<RenderWidget> render_widget_;
1092
avi0392dbf52015-03-25 16:55:451093 // Temporarily holds state pertaining to a navigation that has been initiated
1094 // until the NavigationState corresponding to the new navigation is created in
1095 // didCreateDataSource().
dchengcedca5612016-04-09 01:40:151096 std::unique_ptr<NavigationParams> pending_navigation_params_;
avi0392dbf52015-03-25 16:55:451097
creis8eb8ef22015-11-04 22:51:381098 // Stores the current history item for this frame, so that updates to it can
1099 // be reported to the browser process via SendUpdateState.
1100 blink::WebHistoryItem current_history_item_;
1101
[email protected]7a4e2532013-12-02 21:30:021102#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:021103 // Current text input composition text. Empty if no composition is in
1104 // progress.
[email protected]fcf75d42013-12-03 20:11:261105 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:091106
tommycli59bd86c2014-12-10 02:09:381107 PluginPowerSaverHelper* plugin_power_saver_helper_;
paulmeyer5d0a5f02016-01-21 20:15:521108
1109 PepperPluginInstanceImpl* plugin_find_handler_;
[email protected]7a4e2532013-12-02 21:30:021110#endif
1111
[email protected]f3add922013-12-20 23:17:161112 RendererWebCookieJarImpl cookie_jar_;
1113
[email protected]2e2d9632013-12-03 00:55:261114 // All the registered observers.
brettw236d3172015-06-03 16:31:431115 base::ObserverList<RenderFrameObserver> observers_;
[email protected]2e2d9632013-12-03 00:55:261116
[email protected]bffc8302014-01-23 20:52:161117 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
1118
[email protected]a09d53ce2014-01-31 00:46:421119 // External context menu requests we're waiting for. "Internal"
1120 // (WebKit-originated) context menu events will have an ID of 0 and will not
1121 // be in this map.
1122 //
1123 // We don't want to add internal ones since some of the "special" page
1124 // handlers in the browser process just ignore the context menu requests so
1125 // avoid showing context menus, and so this will cause right clicks to leak
1126 // entries in this map. Most users of the custom context menu (e.g. Pepper
1127 // plugins) are normally only on "regular" pages and the regular pages will
1128 // always respond properly to the request, so we don't have to worry so
1129 // much about leaks.
1130 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
1131
[email protected]4ee64622014-03-21 22:34:151132 // The text selection the last time DidChangeSelection got called. May contain
1133 // additional characters before and after the selected text, for IMEs. The
1134 // portion of this string that is the actual selected text starts at index
1135 // |selection_range_.GetMin() - selection_text_offset_| and has length
1136 // |selection_range_.length()|.
1137 base::string16 selection_text_;
1138 // The offset corresponding to the start of |selection_text_| in the document.
1139 size_t selection_text_offset_;
1140 // Range over the document corresponding to the actual selected text (which
1141 // could correspond to a substring of |selection_text_|; see above).
1142 gfx::Range selection_range_;
1143 // Used to inform didChangeSelection() when it is called in the context
1144 // of handling a InputMsg_SelectRange IPC.
1145 bool handling_select_range_;
1146
[email protected]2626d142014-04-22 17:24:021147 // The next group of objects all implement RenderFrameObserver, so are deleted
1148 // along with the RenderFrame automatically. This is why we just store weak
1149 // references.
1150
[email protected]4459599e2014-07-29 22:40:091151 // Dispatches permission requests for Web Notifications.
1152 NotificationPermissionDispatcher* notification_permission_dispatcher_;
1153
[email protected]977db4a42014-07-17 08:04:321154 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:331155 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:191156
jrummell109c3a602014-12-18 01:08:501157 // EncryptedMediaClient attached to this frame; lazily initialized.
dchengcedca5612016-04-09 01:40:151158 std::unique_ptr<media::WebEncryptedMediaClientImpl>
1159 web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:501160
xhwang6bca21e2016-02-06 00:21:451161 // The media permission dispatcher attached to this frame.
dchengcedca5612016-04-09 01:40:151162 std::unique_ptr<MediaPermissionDispatcher> media_permission_dispatcher_;
xhwang36b1f3b2015-01-27 17:54:011163
xhwange70b7ee12015-06-25 09:17:171164#if defined(ENABLE_MOJO_MEDIA)
xhwanga5967e552016-02-26 00:54:081165 // The media interface provider attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151166 std::unique_ptr<MediaInterfaceProvider> media_interface_provider_;
xhwang065b54b2015-06-03 22:25:551167#endif
1168
hush2e664672016-07-07 18:06:241169 // MidiClient attached to this frame; lazily initialized.
1170 MidiDispatcher* midi_dispatcher_;
1171
[email protected]a017938b2014-05-27 21:17:171172#if defined(OS_ANDROID)
davve859f4f92015-11-27 10:16:191173 // Manages all media players and sessions in this render frame for
1174 // communicating with the real media player and sessions in the
1175 // browser process. It's okay to use raw pointers since they're both
1176 // RenderFrameObservers.
[email protected]a017938b2014-05-27 21:17:171177 RendererMediaPlayerManager* media_player_manager_;
davve859f4f92015-11-27 10:16:191178 RendererMediaSessionManager* media_session_manager_;
[email protected]4b556cf2014-06-10 23:21:531179#endif
1180
watkdee516f2016-02-18 02:22:191181 media::SurfaceManager* media_surface_manager_;
1182
[email protected]4b556cf2014-06-10 23:21:531183#if defined(ENABLE_BROWSER_CDMS)
1184 // Manage all CDMs in this render frame for communicating with the real CDM in
1185 // the browser process. It's okay to use a raw pointer since it's a
1186 // RenderFrameObserver.
[email protected]65f3d1aa2014-05-29 01:57:001187 RendererCdmManager* cdm_manager_;
[email protected]a017938b2014-05-27 21:17:171188#endif
1189
xhwang409e53552016-02-23 00:52:441190 // The CDM and decoder factory attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151191 std::unique_ptr<media::CdmFactory> cdm_factory_;
1192 std::unique_ptr<media::DecoderFactory> decoder_factory_;
xhwangd7180832015-04-03 05:38:151193
hubbe5f0ad43b2015-12-14 20:57:261194 // Media resource cache, lazily initialized.
1195 linked_ptr<media::UrlIndex> url_index_;
1196
[email protected]a6e21c372014-07-12 02:27:211197#if defined(VIDEO_HOLE)
1198 // Whether or not this RenderFrameImpl contains a media player. Used to
1199 // register as an observer for video-hole-specific events.
1200 bool contains_media_player_;
1201#endif
1202
dgozman358ba322015-03-26 15:05:301203 // The devtools agent for this frame; only created for main frame and
1204 // local roots.
1205 DevToolsAgent* devtools_agent_;
1206
[email protected]45920862014-07-02 12:53:021207 // The push messaging dispatcher attached to this frame, lazily initialized.
1208 PushMessagingDispatcher* push_messaging_dispatcher_;
1209
avayvodbca35fad2015-01-29 20:20:571210 // The presentation dispatcher implementation attached to this frame, lazily
1211 // initialized.
1212 PresentationDispatcher* presentation_dispatcher_;
1213
ben155ecf82016-06-21 22:43:261214 std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
1215 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
1216 std::unique_ptr<BlinkServiceRegistryImpl> blink_service_registry_;
1217 shell::mojom::InterfaceProviderRequest
1218 pending_remote_interface_provider_request_;
[email protected]c52a1412014-06-25 06:09:251219
rockotd9260982015-08-21 22:26:301220 // The shell proxy used to connect to Mojo applications.
rockotb00e6462016-04-14 02:24:031221 shell::mojom::ConnectorPtr connector_;
rockotd9260982015-08-21 22:26:301222
[email protected]45920862014-07-02 12:53:021223 // The screen orientation dispatcher attached to the frame, lazily
1224 // initialized.
[email protected]cf78eda2014-06-13 16:57:411225 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
1226
mlamouriefdca9d2014-09-16 16:55:401227 // The Manifest Manager handles the manifest requests from the browser
1228 // process.
1229 ManifestManager* manifest_manager_;
1230
[email protected]95640212014-07-26 18:14:301231 // The current accessibility mode.
1232 AccessibilityMode accessibility_mode_;
1233
1234 // Only valid if |accessibility_mode_| is anything other than
1235 // AccessibilityModeOff.
dmazzoni8e6fe4d2016-06-27 06:35:371236 RenderAccessibilityImpl* render_accessibility_;
[email protected]95640212014-07-26 18:14:301237
dchengcedca5612016-04-09 01:40:151238 std::unique_ptr<PermissionDispatcher> permission_client_;
mlamouri670a86d2015-03-17 16:06:251239
dchengcedca5612016-04-09 01:40:151240 std::unique_ptr<blink::WebAppBannerClient> app_banner_client_;
benwells04ab5b962015-05-06 08:29:401241
dchengcedca5612016-04-09 01:40:151242 std::unique_ptr<blink::WebBluetooth> bluetooth_;
jyasskinf89a11b2015-07-21 00:27:481243
dalecurtisa12e6062015-11-10 23:13:141244 // Manages play, pause notifications for WebMediaPlayer implementations; its
1245 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface.
1246 media::RendererWebMediaPlayerDelegate* media_player_delegate_;
1247
megjablond5ac7d52015-10-22 23:56:121248 // Whether or not this RenderFrame is using Lo-Fi mode.
1249 bool is_using_lofi_;
1250
tbansal7b6cf8b2016-05-10 19:27:231251 // Effective connection type when the document of this frame was fetched.
1252 blink::WebEffectiveConnectionType effective_connection_type_;
1253
ellyjonesdb20fae12015-12-04 16:47:551254 // Whether or not this RenderFrame is currently pasting.
1255 bool is_pasting_;
1256
avi6b8dbb32016-04-08 18:59:351257 // Whether we must stop creating nested message loops for modal dialogs. This
1258 // is necessary because modal dialogs have a ScopedPageLoadDeferrer on the
1259 // stack that interferes with swapping out.
1260 bool suppress_further_dialogs_;
1261
naskoada75b22016-06-11 16:09:461262 // The current and pending file chooser completion objects. If the queue is
1263 // nonempty, the first item represents the currently running file chooser
1264 // callback, and the remaining elements are the other file chooser completion
1265 // still waiting to be run (in order).
1266 struct PendingFileChooser;
1267 std::deque<std::unique_ptr<PendingFileChooser>> file_chooser_completions_;
1268
haibinluc643d33c2016-06-03 02:22:341269#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:141270 // The external popup for the currently showing select popup.
dchengcedca5612016-04-09 01:40:151271 std::unique_ptr<ExternalPopupMenu> external_popup_menu_;
avi485e5fd62014-08-25 23:26:141272#endif
1273
xiaochengh01c3b102016-06-13 23:56:081274 std::unique_ptr<FrameBlameContext> blame_context_;
skyostilb4cce1b2016-03-31 17:56:341275
lfge0c2792ec2016-05-11 18:52:081276 // Plugins -------------------------------------------------------------------
1277#if defined(ENABLE_PLUGINS)
1278 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
1279 PepperPluginSet active_pepper_instances_;
1280
1281 // Whether or not the focus is on a PPAPI plugin
1282 PepperPluginInstanceImpl* focused_pepper_plugin_;
1283
1284 // The plugin instance that received the last mouse event. It is set to NULL
1285 // if the last mouse event went to elements other than Pepper plugins.
1286 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on
1287 // the RenderFrameImpl to NULL it out when it destructs.
1288 PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
1289#endif
1290
ben76f52b242016-06-18 05:42:481291 mojo::Binding<mojom::Frame> frame_binding_;
1292 mojom::FrameHostPtr frame_host_;
1293
[email protected]96307312014-05-04 01:00:191294 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1295
[email protected]227692c52013-05-31 22:43:041296 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1297};
1298
1299} // namespace content
1300
[email protected]85d85fd2013-06-19 00:57:411301#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_