blob: 43cc21620f94dc98c3a39836808f1c0fe67699a1 [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"
rockotf62002a2016-09-15 00:08:5926#include "content/common/associated_interface_registry_impl.h"
ben76f52b242016-06-18 05:42:4827#include "content/common/frame.mojom.h"
clamyda97e8322014-10-07 21:57:2528#include "content/common/frame_message_enums.h"
peter4eb242002015-06-02 12:45:1329#include "content/public/common/console_message_level.h"
[email protected]87de04b02014-04-08 22:14:4930#include "content/public/common/javascript_message_type.h"
[email protected]65920f332014-03-04 21:14:1831#include "content/public/common/referrer.h"
paulmeyer5d0a5f02016-01-21 20:15:5232#include "content/public/common/stop_find_action.h"
[email protected]227692c52013-05-31 22:43:0433#include "content/public/renderer/render_frame.h"
skyostilb4cce1b2016-03-31 17:56:3434#include "content/renderer/frame_blame_context.h"
ben88716142016-07-30 00:03:0335#include "content/renderer/mojo/blink_interface_provider_impl.h"
[email protected]f3add922013-12-20 23:17:1636#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0437#include "ipc/ipc_message.h"
lukasza70b79c82015-12-14 20:24:1338#include "ipc/ipc_platform_file.h"
acolwell9e0840d2014-09-06 19:01:3239#include "media/blink/webmediaplayer_delegate.h"
dalecurtis49f363882015-08-25 21:05:3840#include "media/blink/webmediaplayer_params.h"
ben155ecf82016-06-21 22:43:2641#include "mojo/public/cpp/bindings/binding.h"
benf709a3092016-04-12 22:38:2242#include "services/shell/public/interfaces/connector.mojom.h"
43#include "services/shell/public/interfaces/interface_provider.mojom.h"
tbansal7b6cf8b2016-05-10 19:27:2344#include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
alexmos401f0aba2015-12-06 10:07:3945#include "third_party/WebKit/public/platform/WebFocusType.h"
csharrisonae811ab2016-04-11 11:32:2546#include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
sandersdf92f4e5c2016-01-22 20:57:2247#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
lfg717154072016-06-30 15:04:1648#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
benwells04ab5b962015-05-06 08:29:4049#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h"
[email protected]95640212014-07-26 18:14:3050#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4151#include "third_party/WebKit/public/web/WebDataSource.h"
52#include "third_party/WebKit/public/web/WebFrameClient.h"
boliu15890e42015-11-24 23:08:0553#include "third_party/WebKit/public/web/WebFrameLoadType.h"
lukasza902fcc52015-12-31 04:45:2954#include "third_party/WebKit/public/web/WebFrameSerializerClient.h"
[email protected]680575542014-04-03 17:12:5255#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
skyostilc3ed5652015-10-19 16:28:4656#include "third_party/WebKit/public/web/WebMeaningfulLayout.h"
twellington376424ad2015-05-04 18:57:2557#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
[email protected]4ee64622014-03-21 22:34:1558#include "ui/gfx/range/range.h"
lukaszaede9cc02015-12-30 23:48:3259#include "url/gurl.h"
[email protected]227692c52013-05-31 22:43:0460
tommyclid481c482014-12-03 01:50:4161#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3862#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4163#endif
64
[email protected]a017938b2014-05-27 21:17:1765#if defined(OS_ANDROID)
66#include "content/renderer/media/android/renderer_media_player_manager.h"
67#endif
68
xhwangc0299ae32015-07-21 23:39:5069#if defined(ENABLE_MOJO_MEDIA)
jbromanb73f2582016-01-11 16:35:0570#include "media/mojo/interfaces/service_factory.mojom.h" // nogncheck
xhwangc0299ae32015-07-21 23:39:5071#endif
72
[email protected]7a4e2532013-12-02 21:30:0273class TransportDIB;
kenrba7199832015-01-22 23:44:5974struct FrameMsg_NewFrame_WidgetParams;
alexmose7da5a12015-04-09 02:22:1675struct FrameMsg_PostMessage_Params;
lukaszaede9cc02015-12-30 23:48:3276struct FrameMsg_SerializeAsMHTML_Params;
dspelle736c9db2015-04-03 04:53:1677struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0278
avi7d30b552016-04-06 20:32:5579namespace IPC {
80class SyncMessage;
81}
82
[email protected]7a4e2532013-12-02 21:30:0283namespace blink {
[email protected]82ce5b92014-03-22 05:15:2684class WebContentDecryptionModule;
raymesbba82b32016-07-19 00:41:3885class WebMouseEvent;
avayvodbca35fad2015-01-29 20:20:5786class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0287class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2688class WebSecurityOrigin;
toyoshimf3f7f682016-04-08 07:47:4889enum class WebCachePolicy;
[email protected]7a4e2532013-12-02 21:30:0290struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4291struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0292struct WebCursorInfo;
paulmeyer5d0a5f02016-01-21 20:15:5293struct WebFindOptions;
thestig4c8f2a72016-08-13 01:39:1194} // namespace blink
[email protected]7a4e2532013-12-02 21:30:0295
96namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4297class Point;
[email protected]7a4e2532013-12-02 21:30:0298class Range;
99class Rect;
100}
101
jrummell109c3a602014-12-18 01:08:50102namespace media {
xhwangd7180832015-04-03 05:38:15103class CdmFactory;
xhwang409e53552016-02-23 00:52:44104class DecoderFactory;
xhwang60b430a2015-02-01 05:20:46105class MediaPermission;
hubbe5f0ad43b2015-12-14 20:57:26106class MediaServiceProvider;
dalecurtisa12e6062015-11-10 23:13:14107class RendererWebMediaPlayerDelegate;
watkdee516f2016-02-18 02:22:19108class SurfaceManager;
hubbe5f0ad43b2015-12-14 20:57:26109class UrlIndex;
jrummell109c3a602014-12-18 01:08:50110class WebEncryptedMediaClientImpl;
111}
112
ben155ecf82016-06-21 22:43:26113namespace shell {
114class InterfaceRegistry;
115class InterfaceProvider;
xhwang33f939e2015-06-23 04:33:42116}
117
tommycli58e3172c2015-09-15 18:18:26118namespace url {
119class Origin;
120}
121
[email protected]227692c52013-05-31 22:43:04122namespace content {
123
rockotf62002a2016-09-15 00:08:59124class AssociatedInterfaceProviderImpl;
[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;
yzshen0424e6952016-09-06 16:48:58130class HistoryEntry;
mlamouriefdca9d2014-09-16 16:55:40131class ManifestManager;
xhwanga5967e552016-02-26 00:54:08132class MediaInterfaceProvider;
[email protected]977db4a42014-07-17 08:04:32133class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:08134class MediaStreamRendererFactory;
xhwang5206d4e62016-02-05 02:09:55135class MediaPermissionDispatcher;
[email protected]52d3e172014-06-16 16:57:02136class MidiDispatcher;
avi0392dbf52015-03-25 16:55:45137class NavigationState;
clamyda97e8322014-10-07 21:57:25138class PageState;
[email protected]7a4e2532013-12-02 21:30:02139class PepperPluginInstanceImpl;
avayvodbca35fad2015-01-29 20:20:57140class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:02141class PushMessagingDispatcher;
dmazzoni8e6fe4d2016-06-27 06:35:37142class RenderAccessibilityImpl;
[email protected]4b556cf2014-06-10 23:21:53143class RendererCdmManager;
144class RendererMediaPlayerManager;
davve859f4f92015-11-27 10:16:19145class RendererMediaSessionManager;
[email protected]7a4e2532013-12-02 21:30:02146class RendererPpapiHost;
watkdee516f2016-02-18 02:22:19147class RendererSurfaceViewManager;
[email protected]2e2d9632013-12-03 00:55:26148class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04149class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02150class RenderWidget;
151class RenderWidgetFullscreenPepper;
lukaszade802372016-06-16 17:17:23152class ResourceRequestBodyImpl;
[email protected]cf78eda2014-06-13 16:57:41153class ScreenOrientationDispatcher;
perkj1a2d0432014-09-03 13:52:33154class UserMediaClientImpl;
alogvinovf50445a2015-10-30 13:00:12155class WakeLockDispatcher;
clamy9bfeef42014-09-30 20:50:42156struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42157struct CustomContextMenuContext;
naskoada75b22016-06-11 16:09:46158struct FileChooserFileInfo;
159struct FileChooserParams;
raymesbba82b32016-07-19 00:41:38160struct FrameOwnerProperties;
alexmosbc7eafa2014-12-06 01:38:09161struct FrameReplicationState;
avi0392dbf52015-03-25 16:55:45162struct NavigationParams;
clamy79b3da62014-10-14 08:50:37163struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04164struct ResourceResponseHead;
ccameron2f451532016-09-07 21:49:27165struct ScreenInfo;
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,
ccameron2f451532016-09-07 21:49:27181 const ScreenInfo& 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.
raymes31457802016-07-20 06:08:09197 static void CreateFrame(int routing_id,
198 int proxy_routing_id,
199 int opener_routing_id,
200 int parent_routing_id,
201 int previous_sibling_routing_id,
202 const FrameReplicationState& replicated_state,
203 CompositorDependencies* compositor_deps,
204 const FrameMsg_NewFrame_WidgetParams& params,
205 const FrameOwnerProperties& frame_owner_properties);
[email protected]82307f6b2014-08-07 03:30:12206
[email protected]5a7100d2014-05-19 01:29:04207 // Returns the RenderFrameImpl for the given routing ID.
208 static RenderFrameImpl* FromRoutingID(int routing_id);
209
[email protected]a5ac6dc2014-01-15 07:02:14210 // Just like RenderFrame::FromWebFrame but returns the implementation.
211 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09212
[email protected]2f61bdd2013-07-02 18:38:47213 // Used by content_layouttest_support to hook into the creation of
214 // RenderFrameImpls.
jochen664198b2015-06-25 14:13:00215 struct CreateParams {
avi1023d012015-12-25 02:39:14216 CreateParams(RenderViewImpl* render_view, int32_t routing_id)
jochen664198b2015-06-25 14:13:00217 : render_view(render_view), routing_id(routing_id) {}
218 ~CreateParams() {}
219
220 RenderViewImpl* render_view;
avi1023d012015-12-25 02:39:14221 int32_t routing_id;
jochen664198b2015-06-25 14:13:00222 };
223
224 using CreateRenderFrameImplFunction =
225 RenderFrameImpl* (*)(const CreateParams&);
[email protected]2f61bdd2013-07-02 18:38:47226 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50227 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47228
alexmos95733002015-08-24 16:38:09229 // Looks up and returns the WebFrame corresponding to a given opener frame
230 // routing ID. Also stores the opener's RenderView routing ID into
231 // |opener_view_routing_id|.
232 //
233 // TODO(alexmos): remove RenderViewImpl's dependency on
234 // opener_view_routing_id.
235 static blink::WebFrame* ResolveOpener(int opener_frame_routing_id,
236 int* opener_view_routing_id);
237
kdsilvae0135592016-08-09 17:08:11238 // Overwrites the given URL to use an HTML5 embed if possible.
239 blink::WebURL overrideFlashEmbedWithHTML(const blink::WebURL& url) override;
240
avi5c77d212015-09-25 20:08:25241 ~RenderFrameImpl() override;
[email protected]227692c52013-05-31 22:43:04242
dglazkovf0e1d6d2015-10-10 02:13:48243 // Called by RenderWidget when meaningful layout has happened.
244 // See RenderFrameObserver::DidMeaningfulLayout declaration for details.
245 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type);
246
[email protected]bffc8302014-01-23 20:52:16247 // Out-of-process child frames receive a signal from RenderWidgetCompositor
248 // when a compositor frame has committed.
249 void DidCommitCompositorFrame();
250
lfge0c2792ec2016-05-11 18:52:08251 // Draw commands have been issued by RenderWidgetCompositor.
252 void DidCommitAndDrawCompositorFrame();
253
[email protected]7a4e2532013-12-02 21:30:02254 // TODO(jam): this is a temporary getter until all the code is transitioned
255 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26256 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02257
creis225a7432016-06-03 22:56:27258 const blink::WebHistoryItem& current_history_item() {
259 return current_history_item_;
260 }
261
[email protected]f3add922013-12-20 23:17:16262 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
263
[email protected]7a4e2532013-12-02 21:30:02264 // Returns the RenderWidget associated with this frame.
265 RenderWidget* GetRenderWidget();
266
dgozmancf9039cd2015-04-06 12:01:31267 DevToolsAgent* devtools_agent() { return devtools_agent_; }
268
[email protected]0287e762014-04-11 13:07:58269 // This method must be called after the frame has been added to the frame
270 // tree. It creates all objects that depend on the frame being at its proper
271 // spot.
272 void Initialize();
273
[email protected]de3c5d82014-05-28 22:12:59274 // Notifications from RenderWidget.
275 void WasHidden();
276 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31277 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59278
[email protected]723971b2014-02-12 11:08:25279 // Start/Stop loading notifications.
280 // TODO(nasko): Those are page-level methods at this time and come from
281 // WebViewClient. We should move them to be WebFrameClient calls and put
282 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09283 // |to_different_document| will be true unless the load is a fragment
284 // navigation, or triggered by history.pushState/replaceState.
avi5c77d212015-09-25 20:08:25285 void didStartLoading(bool to_different_document) override;
286 void didStopLoading() override;
287 void didChangeLoadProgress(double load_progress) override;
[email protected]723971b2014-02-12 11:08:25288
[email protected]95640212014-07-26 18:14:30289 AccessibilityMode accessibility_mode() {
290 return accessibility_mode_;
291 }
292
dmazzoni8e6fe4d2016-06-27 06:35:37293 RenderAccessibilityImpl* render_accessibility() {
294 return render_accessibility_;
[email protected]95640212014-07-26 18:14:30295 }
296
297 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
298 blink::WebAXEvent event);
299
estade31c54342015-01-23 03:34:36300 // The focused node changed to |node|. If focus was lost from this frame,
301 // |node| will be null.
[email protected]95640212014-07-26 18:14:30302 void FocusedNodeChanged(const blink::WebNode& node);
303
estade31c54342015-01-23 03:34:36304 // TODO(dmazzoni): the only reason this is here is to plumb it through to
dmazzoni8e6fe4d2016-06-27 06:35:37305 // RenderAccessibilityImpl. It should use the RenderFrameObserver method, once
estade31c54342015-01-23 03:34:36306 // blink has a separate accessibility tree per frame.
307 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
308
lfge0c2792ec2016-05-11 18:52:08309 // Called when this frame's widget is focused.
310 void RenderWidgetSetFocus(bool enable);
311
312 // Called when the widget receives a mouse event.
313 void RenderWidgetWillHandleMouseEvent();
314
[email protected]7a4e2532013-12-02 21:30:02315#if defined(ENABLE_PLUGINS)
paulmeyer5d0a5f02016-01-21 20:15:52316 // Get/set the plugin which will be used to handle document find requests.
317 void set_plugin_find_handler(PepperPluginInstanceImpl* plugin) {
318 plugin_find_handler_ = plugin;
319 }
320 PepperPluginInstanceImpl* plugin_find_handler() {
321 return plugin_find_handler_;
322 }
323
[email protected]271ff5792013-12-04 22:29:31324 // Notification that a PPAPI plugin has been created.
325 void PepperPluginCreated(RendererPpapiHost* host);
326
[email protected]7a4e2532013-12-02 21:30:02327 // Notifies that |instance| has changed the cursor.
328 // This will update the cursor appearance if it is currently over the plugin
329 // instance.
330 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
331 const blink::WebCursorInfo& cursor);
332
333 // Notifies that |instance| has received a mouse event.
334 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
335
[email protected]7a4e2532013-12-02 21:30:02336 // Informs the render view that a PPAPI plugin has changed text input status.
337 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
338 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
339
340 // Cancels current composition.
341 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
342
343 // Informs the render view that a PPAPI plugin has changed selection.
344 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
345
346 // Creates a fullscreen container for a pepper plugin instance.
347 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
348 PepperPluginInstanceImpl* plugin);
349
[email protected]7a4e2532013-12-02 21:30:02350 bool IsPepperAcceptingCompositionEvents() const;
351
352 // Notification that the given plugin has crashed.
353 void PluginCrashed(const base::FilePath& plugin_path,
354 base::ProcessId plugin_pid);
355
[email protected]7a4e2532013-12-02 21:30:02356 // Simulates IME events for testing purpose.
357 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26358 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02359 const std::vector<blink::WebCompositionUnderline>& underlines,
360 int selection_start,
361 int selection_end);
aelias87b8f7c2016-09-14 03:19:29362 void SimulateImeCommitText(const base::string16& text,
363 const gfx::Range& replacement_range);
364 void SimulateImeFinishComposingText(bool keep_selection);
[email protected]7a4e2532013-12-02 21:30:02365
366 // TODO(jam): remove these once the IPC handler moves from RenderView to
367 // RenderFrame.
368 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42369 const base::string16& text,
370 const std::vector<blink::WebCompositionUnderline>& underlines,
371 int selection_start,
372 int selection_end);
aelias87b8f7c2016-09-14 03:19:29373 void OnImeCommitText(const base::string16& text,
374 const gfx::Range& replacement_range,
375 int relative_cursor_pos);
376 void OnImeFinishComposingText(bool keep_selection);
377
tommyclie6633ca72014-10-31 00:40:42378#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02379
[email protected]977db4a42014-07-17 08:04:32380 // May return NULL in some cases, especially if userMediaClient() returns
381 // NULL.
382 MediaStreamDispatcher* GetMediaStreamDispatcher();
383
haibinluc643d33c2016-06-03 02:22:34384#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:14385 void DidHideExternalPopupMenu();
386#endif
387
[email protected]227692c52013-05-31 22:43:04388 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52389 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04390
391 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52392 bool OnMessageReceived(const IPC::Message& msg) override;
rockotce2138c2016-09-16 00:09:18393 void OnAssociatedInterfaceRequest(
394 const std::string& interface_name,
395 mojo::ScopedInterfaceEndpointHandle handle) override;
[email protected]227692c52013-05-31 22:43:04396
[email protected]271ff5792013-12-04 22:29:31397 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52398 RenderView* GetRenderView() override;
dmazzoni8e6fe4d2016-06-27 06:35:37399 RenderAccessibility* GetRenderAccessibility() override;
dcheng6d18e402014-10-21 12:32:52400 int GetRoutingID() override;
401 blink::WebLocalFrame* GetWebFrame() override;
402 WebPreferences& GetWebkitPreferences() override;
403 int ShowContextMenu(ContextMenuClient* client,
404 const ContextMenuParams& params) override;
405 void CancelContextMenu(int request_id) override;
tommycli59bd86c2014-12-10 02:09:38406 blink::WebPlugin* CreatePlugin(
407 blink::WebFrame* frame,
408 const WebPluginInfo& info,
409 const blink::WebPluginParams& params,
dchengcedca5612016-04-09 01:40:15410 std::unique_ptr<PluginInstanceThrottler> throttler) override;
japhetb0bae9d82015-10-19 20:43:40411 void LoadURLExternally(const blink::WebURLRequest& request,
dcheng6d18e402014-10-21 12:32:52412 blink::WebNavigationPolicy policy) override;
413 void ExecuteJavaScript(const base::string16& javascript) override;
dglazkov2e140f52015-09-28 16:10:07414 bool IsMainFrame() override;
dcheng6d18e402014-10-21 12:32:52415 bool IsHidden() override;
ben155ecf82016-06-21 22:43:26416 shell::InterfaceRegistry* GetInterfaceRegistry() override;
417 shell::InterfaceProvider* GetRemoteInterfaces() override;
rockotf62002a2016-09-15 00:08:59418 AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry() override;
419 AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
tommyclid481c482014-12-03 01:50:41420#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38421 void RegisterPeripheralPlugin(
tommycli58e3172c2015-09-15 18:18:26422 const url::Origin& content_origin,
tommycli59bd86c2014-12-10 02:09:38423 const base::Closure& unthrottle_callback) override;
tommycli9c7cbd92015-12-18 23:34:34424 RenderFrame::PeripheralContentStatus GetPeripheralContentStatus(
425 const url::Origin& main_frame_origin,
426 const url::Origin& content_origin,
tommycli8a1ef84d2016-08-10 23:05:08427 const gfx::Size& unobscured_size,
428 RecordPeripheralDecision record_decision) const override;
tommyclibae63b92015-10-23 02:56:20429 void WhitelistContentOrigin(const url::Origin& content_origin) override;
thestig4c8f2a72016-08-13 01:39:11430 void DidStartLoading() override;
431 void DidStopLoading() override;
tommyclid481c482014-12-03 01:50:41432#endif
dcheng6d18e402014-10-21 12:32:52433 bool IsFTPDirectoryListing() override;
434 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52435 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52436 void SetSelectedText(const base::string16& selection_text,
437 size_t offset,
438 const gfx::Range& range) override;
439 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19440 v8::Local<v8::Context> context) override;
rdevlin.croninb2cec912015-06-24 20:36:01441 void AddMessageToConsole(ConsoleMessageLevel level,
442 const std::string& message) override;
megjablond5ac7d52015-10-22 23:56:12443 bool IsUsingLoFi() const override;
ellyjonesdb20fae12015-12-04 16:47:55444 bool IsPasting() const override;
lfg717154072016-06-30 15:04:16445 blink::WebPageVisibilityState GetVisibilityState() const override;
[email protected]271ff5792013-12-04 22:29:31446
ben76f52b242016-06-18 05:42:48447 // mojom::Frame implementation:
448 void GetInterfaceProvider(
449 shell::mojom::InterfaceProviderRequest request) override;
450
[email protected]96307312014-05-04 01:00:19451 // blink::WebFrameClient implementation:
avi5c77d212015-09-25 20:08:25452 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
453 const blink::WebPluginParams& params) override;
454 blink::WebMediaPlayer* createMediaPlayer(
guidou9bfe4e2f2016-04-09 08:31:19455 const blink::WebMediaPlayerSource& source,
srirama.m26f864d02015-07-14 05:21:46456 blink::WebMediaPlayerClient* client,
457 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
guidou9c3cc3e2015-10-27 13:38:15458 blink::WebContentDecryptionModule* initial_cdm,
zqzhangf85a8f82016-09-22 19:12:09459 const blink::WebString& sink_id) override;
davve50137b62015-10-23 12:15:21460 blink::WebMediaSession* createMediaSession() override;
avi5c77d212015-09-25 20:08:25461 blink::WebApplicationCacheHost* createApplicationCacheHost(
avi5c77d212015-09-25 20:08:25462 blink::WebApplicationCacheHostClient* client) override;
463 blink::WebWorkerContentSettingsClientProxy*
avi01681ef2016-02-16 17:53:57464 createWorkerContentSettingsClientProxy() override;
avi5c77d212015-09-25 20:08:25465 blink::WebExternalPopupMenu* createExternalPopupMenu(
[email protected]b20c3222014-08-22 00:50:22466 const blink::WebPopupMenuInfo& popup_menu_info,
avi5c77d212015-09-25 20:08:25467 blink::WebExternalPopupMenuClient* popup_menu_client) override;
avi5047cd572016-02-16 20:41:12468 blink::WebCookieJar* cookieJar() override;
skyostilb4cce1b2016-03-31 17:56:34469 blink::BlameContext* frameBlameContext() override;
avi01681ef2016-02-16 17:53:57470 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override;
avi5047cd572016-02-16 20:41:12471 void didAccessInitialDocument() override;
avi5c77d212015-09-25 20:08:25472 blink::WebFrame* createChildFrame(
alexmose48b1df932015-01-16 01:34:17473 blink::WebLocalFrame* parent,
dcheng860817a2015-05-22 03:16:56474 blink::WebTreeScopeType scope,
475 const blink::WebString& name,
lukasza464d8692016-02-22 19:26:32476 const blink::WebString& unique_name,
477 blink::WebSandboxFlags sandbox_flags,
478 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25479 void didChangeOpener(blink::WebFrame* frame) override;
lfgaf41ee002016-07-05 14:57:24480 void frameDetached(blink::WebLocalFrame* frame, DetachType type) override;
avi5c77d212015-09-25 20:08:25481 void frameFocused() override;
482 void willClose(blink::WebFrame* frame) override;
lukasza464d8692016-02-22 19:26:32483 void didChangeName(const blink::WebString& name,
484 const blink::WebString& unique_name) override;
mkwstf672e7ef2016-06-09 20:51:07485 void didEnforceInsecureRequestPolicy(
486 blink::WebInsecureRequestPolicy policy) override;
estarkbd8e26f2016-03-16 23:30:37487 void didUpdateToUniqueOrigin(
488 bool is_potentially_trustworthy_unique_origin) override;
avi5c77d212015-09-25 20:08:25489 void didChangeSandboxFlags(blink::WebFrame* child_frame,
490 blink::WebSandboxFlags flags) override;
lukasza8e1c02e42016-05-17 20:05:10491 void didAddContentSecurityPolicy(
492 const blink::WebString& header_value,
493 blink::WebContentSecurityPolicyType type,
494 blink::WebContentSecurityPolicySource source) override;
Avi Drissman09b359e52015-12-07 20:19:21495 void didChangeFrameOwnerProperties(
lazyboy70605c32015-11-03 01:27:31496 blink::WebFrame* child_frame,
497 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25498 void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22499 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46500 const blink::WebVector<blink::WebString>& newly_matching_selectors,
avi5c77d212015-09-25 20:08:25501 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
502 override;
503 bool shouldReportDetailedMessageForSource(
504 const blink::WebString& source) override;
505 void didAddMessageToConsole(const blink::WebConsoleMessage& message,
506 const blink::WebString& source_name,
507 unsigned source_line,
508 const blink::WebString& stack_trace) override;
japhetb0bae9d82015-10-19 20:43:40509 void loadURLExternally(const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25510 blink::WebNavigationPolicy policy,
japhetb0bae9d82015-10-19 20:43:40511 const blink::WebString& suggested_name,
512 bool should_replace_current_entry) override;
avi5c77d212015-09-25 20:08:25513 blink::WebNavigationPolicy decidePolicyForNavigation(
514 const NavigationPolicyInfo& info) override;
creise18ce072015-12-02 02:00:02515 blink::WebHistoryItem historyItemForNewChildFrame() override;
avi0fe3a6d2016-02-16 20:57:27516 void willSendSubmitEvent(const blink::WebFormElement& form) override;
517 void willSubmitForm(const blink::WebFormElement& form) override;
avi5c77d212015-09-25 20:08:25518 void didCreateDataSource(blink::WebLocalFrame* frame,
519 blink::WebDataSource* datasource) override;
520 void didStartProvisionalLoad(blink::WebLocalFrame* frame,
521 double triggering_event_time) override;
522 void didReceiveServerRedirectForProvisionalLoad(
523 blink::WebLocalFrame* frame) override;
524 void didFailProvisionalLoad(blink::WebLocalFrame* frame,
525 const blink::WebURLError& error,
526 blink::WebHistoryCommitType commit_type) override;
527 void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22528 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52529 const blink::WebHistoryItem& item,
avi5c77d212015-09-25 20:08:25530 blink::WebHistoryCommitType commit_type) override;
531 void didCreateNewDocument(blink::WebLocalFrame* frame) override;
532 void didClearWindowObject(blink::WebLocalFrame* frame) override;
533 void didCreateDocumentElement(blink::WebLocalFrame* frame) override;
rob43ea0642016-03-19 01:05:01534 void runScriptsAtDocumentElementAvailable(
535 blink::WebLocalFrame* frame) override;
avi5c77d212015-09-25 20:08:25536 void didReceiveTitle(blink::WebLocalFrame* frame,
537 const blink::WebString& title,
538 blink::WebTextDirection direction) override;
539 void didChangeIcon(blink::WebLocalFrame* frame,
540 blink::WebIconURL::Type icon_type) override;
rob2718dfc2016-03-25 20:58:27541 void didFinishDocumentLoad(blink::WebLocalFrame* frame) override;
542 void runScriptsAtDocumentReady(blink::WebLocalFrame* frame,
543 bool document_is_empty) override;
avi5c77d212015-09-25 20:08:25544 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override;
545 void didFailLoad(blink::WebLocalFrame* frame,
546 const blink::WebURLError& error,
547 blink::WebHistoryCommitType commit_type) override;
548 void didFinishLoad(blink::WebLocalFrame* frame) override;
549 void didNavigateWithinPage(blink::WebLocalFrame* frame,
550 const blink::WebHistoryItem& item,
avi68a109ab2016-05-15 01:46:32551 blink::WebHistoryCommitType commit_type,
552 bool content_initiated) override;
avi1008732f2016-02-17 17:28:49553 void didUpdateCurrentHistoryItem() override;
avi5c77d212015-09-25 20:08:25554 void didChangeThemeColor() override;
555 void dispatchLoad() override;
tbansal7b6cf8b2016-05-10 19:27:23556 blink::WebEffectiveConnectionType getEffectiveConnectionType() override;
avi5c77d212015-09-25 20:08:25557 void didChangeSelection(bool is_empty_selection) override;
alexmos56567492016-09-13 00:52:46558 bool handleCurrentKeyboardEvent() override;
avi5c77d212015-09-25 20:08:25559 blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19560 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55561 const blink::WebColor& initial_color,
avi5c77d212015-09-25 20:08:25562 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override;
563 void runModalAlertDialog(const blink::WebString& message) override;
564 bool runModalConfirmDialog(const blink::WebString& message) override;
565 bool runModalPromptDialog(const blink::WebString& message,
566 const blink::WebString& default_value,
567 blink::WebString* actual_value) override;
avi141dbc1322016-03-11 22:27:42568 bool runModalBeforeUnloadDialog(bool is_reload) override;
naskoada75b22016-06-11 16:09:46569 bool runFileChooser(
570 const blink::WebFileChooserParams& params,
571 blink::WebFileChooserCompletion* chooser_completion) override;
avi5c77d212015-09-25 20:08:25572 void showContextMenu(const blink::WebContextMenuData& data) override;
brettw8f508f42016-06-20 21:34:21573 void saveImageFromDataURL(const blink::WebString& data_url) override;
avi5c77d212015-09-25 20:08:25574 void willSendRequest(blink::WebLocalFrame* frame,
japhet8489f1b2016-08-24 00:27:59575 blink::WebURLRequest& request) override;
576 void didReceiveResponse(const blink::WebURLResponse& response) override;
avi5c77d212015-09-25 20:08:25577 void didLoadResourceFromMemoryCache(
[email protected]180ef242013-11-07 06:50:46578 const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25579 const blink::WebURLResponse& response) override;
580 void didDisplayInsecureContent() override;
581 void didRunInsecureContent(const blink::WebSecurityOrigin& origin,
582 const blink::WebURL& target) override;
estark910b4572015-12-09 20:55:41583 void didDisplayContentWithCertificateErrors(
jamc94a7532016-09-07 19:40:29584 const blink::WebURL& url) override;
585 void didRunContentWithCertificateErrors(const blink::WebURL& url) override;
avi5c77d212015-09-25 20:08:25586 void didChangePerformanceTiming() override;
csharrisonae811ab2016-04-11 11:32:25587 void didObserveLoadingBehavior(
588 blink::WebLoadingBehaviorFlag behavior) override;
avi5c77d212015-09-25 20:08:25589 void didCreateScriptContext(blink::WebLocalFrame* frame,
590 v8::Local<v8::Context> context,
591 int extension_group,
592 int world_id) override;
593 void willReleaseScriptContext(blink::WebLocalFrame* frame,
594 v8::Local<v8::Context> context,
595 int world_id) override;
596 void didChangeScrollOffset(blink::WebLocalFrame* frame) override;
597 void willInsertBody(blink::WebLocalFrame* frame) override;
598 void reportFindInPageMatchCount(int request_id,
599 int count,
600 bool final_update) override;
601 void reportFindInPageSelection(int request_id,
602 int active_match_ordinal,
603 const blink::WebRect& sel) override;
avif0d894852016-02-17 17:49:12604 void requestStorageQuota(blink::WebStorageQuotaType type,
avi5c77d212015-09-25 20:08:25605 unsigned long long requested_size,
606 blink::WebStorageQuotaCallbacks callbacks) override;
avi5c77d212015-09-25 20:08:25607 blink::WebPushClient* pushClient() override;
608 blink::WebPresentationClient* presentationClient() override;
avi5c77d212015-09-25 20:08:25609 void willStartUsingPeerConnectionHandler(
avi5c77d212015-09-25 20:08:25610 blink::WebRTCPeerConnectionHandler* handler) override;
611 blink::WebUserMediaClient* userMediaClient() override;
612 blink::WebEncryptedMediaClient* encryptedMediaClient() override;
avif0d894852016-02-17 17:49:12613 blink::WebString userAgentOverride() override;
614 blink::WebString doNotTrackValue() override;
615 bool allowWebGL(bool default_value) override;
avi5c77d212015-09-25 20:08:25616 blink::WebScreenOrientationClient* webScreenOrientationClient() override;
617 bool isControlledByServiceWorker(blink::WebDataSource& data_source) override;
618 int64_t serviceWorkerID(blink::WebDataSource& data_source) override;
619 void postAccessibilityEvent(const blink::WebAXObject& obj,
620 blink::WebAXEvent event) override;
621 void handleAccessibilityFindInPageResult(
622 int identifier,
623 int match_index,
624 const blink::WebAXObject& start_object,
625 int start_offset,
626 const blink::WebAXObject& end_object,
627 int end_offset) override;
avi1008732f2016-02-17 17:28:49628 void didChangeManifest() override;
foolip73101372016-07-13 08:19:22629 void enterFullscreen() override;
630 void exitFullscreen() override;
avi5c77d212015-09-25 20:08:25631 blink::WebAppBannerClient* appBannerClient() override;
632 void registerProtocolHandler(const blink::WebString& scheme,
633 const blink::WebURL& url,
634 const blink::WebString& title) override;
635 void unregisterProtocolHandler(const blink::WebString& scheme,
636 const blink::WebURL& url) override;
637 blink::WebBluetooth* bluetooth() override;
guidou3906a722015-11-12 22:14:42638 void checkIfAudioSinkExistsAndIsAuthorized(
639 const blink::WebString& sink_id,
640 const blink::WebSecurityOrigin& security_origin,
641 blink::WebSetSinkIdCallbacks* web_callbacks) override;
ben88716142016-07-30 00:03:03642 blink::InterfaceProvider* interfaceProvider() override;
lfg717154072016-06-30 15:04:16643 blink::WebPageVisibilityState visibilityState() const override;
[email protected]85d85fd2013-06-19 00:57:41644
lukasza902fcc52015-12-31 04:45:29645 // WebFrameSerializerClient implementation:
lukasza2e296c32015-09-28 23:29:48646 void didSerializeDataForFrame(
lukasza2e296c32015-09-28 23:29:48647 const blink::WebCString& data,
lukasza902fcc52015-12-31 04:45:29648 blink::WebFrameSerializerClient::FrameSerializationStatus status)
649 override;
lukasza2e296c32015-09-28 23:29:48650
ben76f52b242016-06-18 05:42:48651 // Binds to the FrameHost in the browser.
652 void Bind(mojom::FrameRequest frame, mojom::FrameHostPtr frame_host);
rockotf8fdd9b2015-12-16 22:22:35653
mlamouri4fff1992014-09-30 11:22:46654 ManifestManager* manifest_manager();
655
avi0392dbf52015-03-25 16:55:45656 // TODO(creis): Remove when the only caller, the HistoryController, is no
657 // more.
658 void SetPendingNavigationParams(
dchengcedca5612016-04-09 01:40:15659 std::unique_ptr<NavigationParams> navigation_params);
avi0392dbf52015-03-25 16:55:45660
xhwang5206d4e62016-02-05 02:09:55661 media::MediaPermission* GetMediaPermission();
guoweisf4282b02015-09-24 23:05:22662
creis69b184a472015-11-26 05:29:51663 // Sends the current frame's navigation state to the browser.
664 void SendUpdateState();
665
sammce2f99982016-03-14 22:38:12666 // Creates a MojoBindingsController if Mojo bindings have been enabled for
667 // this frame. For WebUI, this allows the page to communicate with the browser
668 // process; for layout tests, this allows the test to mock out services at
669 // the Mojo IPC layer.
670 void MaybeEnableMojoBindings();
nasko1fa0fb62015-12-09 01:49:57671
lfge0c2792ec2016-05-11 18:52:08672 // Plugin-related functions --------------------------------------------------
673
674#if defined(ENABLE_PLUGINS)
675 PepperPluginInstanceImpl* focused_pepper_plugin() {
676 return focused_pepper_plugin_;
677 }
678 PepperPluginInstanceImpl* pepper_last_mouse_event_target() {
679 return pepper_last_mouse_event_target_;
680 }
681 void set_pepper_last_mouse_event_target(PepperPluginInstanceImpl* plugin) {
682 pepper_last_mouse_event_target_ = plugin;
683 }
684
685 // Indicates that the given instance has been created.
686 void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
687
688 // Indicates that the given instance is being destroyed. This is called from
689 // the destructor, so it's important that the instance is not dereferenced
690 // from this call.
691 void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
692
693 // Notification that the given plugin is focused or unfocused.
694 void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
zqzhangc885f6b2016-06-23 19:44:46695
696 void PepperStartsPlayback(PepperPluginInstanceImpl* instance);
697 void PepperStopsPlayback(PepperPluginInstanceImpl* instance);
698 void OnSetPepperVolume(int32_t pp_instance, double volume);
lfge0c2792ec2016-05-11 18:52:08699#endif // ENABLE_PLUGINS
700
[email protected]2f61bdd2013-07-02 18:38:47701 protected:
jochen664198b2015-06-25 14:13:00702 explicit RenderFrameImpl(const CreateParams& params);
[email protected]2f61bdd2013-07-02 18:38:47703
[email protected]227692c52013-05-31 22:43:04704 private:
kenrbf98a4d22015-04-01 21:59:35705 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26706 friend class RenderFrameObserver;
dmazzoni8e6fe4d2016-06-27 06:35:37707 friend class RenderAccessibilityImplTest;
clamy98a9dee02015-06-24 16:09:10708 friend class TestRenderFrame;
avi485e5fd62014-08-25 23:26:14709 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
710 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
711 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
712 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
dmazzoni8e6fe4d2016-06-27 06:35:37713 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest,
[email protected]66bbadaf2014-03-28 16:25:54714 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]2e2d9632013-12-03 00:55:26715
twellington376424ad2015-05-04 18:57:25716 // A wrapper class used as the callback for JavaScript executed
717 // in an isolated world.
718 class JavaScriptIsolatedWorldRequest
719 : public blink::WebScriptExecutionCallback {
720 public:
721 JavaScriptIsolatedWorldRequest(
722 int id,
723 bool notify_result,
724 int routing_id,
725 base::WeakPtr<RenderFrameImpl> render_frame_impl);
726 void completed(
727 const blink::WebVector<v8::Local<v8::Value>>& result) override;
728
729 private:
avi5c77d212015-09-25 20:08:25730 ~JavaScriptIsolatedWorldRequest() override;
twellington376424ad2015-05-04 18:57:25731
732 int id_;
733 bool notify_result_;
734 int routing_id_;
735 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
736
737 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
738 };
739
[email protected]37567b432014-02-12 01:12:22740 typedef std::map<GURL, double> HostZoomLevels;
741
dchengc5ef1a52015-08-26 20:58:30742 // Creates a new RenderFrame. |render_view| is the RenderView object that this
743 // frame belongs to.
ddorwinf63505e2016-01-08 00:54:50744 // Callers *must* call |BindToWebFrame| immediately after creation.
avi1023d012015-12-25 02:39:14745 static RenderFrameImpl* Create(RenderViewImpl* render_view,
746 int32_t routing_id);
dchengc5ef1a52015-08-26 20:58:30747
ddorwinf63505e2016-01-08 00:54:50748 // This is called right after creation with the WebLocalFrame for this
749 // RenderFrame. It must be called before Initialize.
750 void BindToWebFrame(blink::WebLocalFrame* web_frame);
751
[email protected]2e2d9632013-12-03 00:55:26752 // Functions to add and remove observers for this object.
753 void AddObserver(RenderFrameObserver* observer);
754 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34755
dcheng3d886b732015-11-05 19:16:01756 bool IsLocalRoot() const;
757
[email protected]f0906a02014-08-07 07:18:55758 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35759 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
creis8b5cd4c2015-06-19 00:11:08760 blink::WebHistoryCommitType commit_type,
761 const blink::WebHistoryItem& item);
[email protected]37567b432014-02-12 01:12:22762
[email protected]b70da4c2014-01-06 19:57:09763 // IPC message handlers ------------------------------------------------------
764 //
765 // The documentation for these functions should be in
766 // content/common/*_messages.h for the message that the function is handling.
clamy98a9dee02015-06-24 16:09:10767 void OnNavigate(const CommonNavigationParams& common_params,
768 const StartNavigationParams& start_params,
769 const RequestNavigationParams& request_params);
clamybfd6a812016-05-30 16:25:17770 void OnBeforeUnload(bool is_reload);
alexmosbc7eafa2014-12-06 01:38:09771 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56772 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09773 const FrameReplicationState& replicated_frame_state);
naskoeab5c5582015-12-15 05:20:00774 void OnDeleteFrame();
Nasko Oskov85f60222014-08-28 22:53:30775 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42776 void OnShowContextMenu(const gfx::Point& location);
777 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
778 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
779 unsigned action);
[email protected]4ee64622014-03-21 22:34:15780 void OnUndo();
781 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07782 void OnCut();
783 void OnCopy();
784 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15785 void OnPasteAndMatchStyle();
786 void OnDelete();
787 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14788 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
aurimasab0319022015-07-10 21:57:38789 void OnAdjustSelectionByCharacterOffset(int start_adjust, int end_adjust);
[email protected]4ee64622014-03-21 22:34:15790 void OnUnselect();
christiankaeed9862014-11-05 10:49:14791 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17792 void OnReplace(const base::string16& text);
793 void OnReplaceMisspelling(const base::string16& text);
brettw8f508f42016-06-20 21:34:21794 void OnCopyImageAt(int x, int y);
795 void OnSaveImageAt(int x, int y);
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();
avallee0206f782016-07-28 18:55:33827 void OnClearFocusedFrame();
dspelle736c9db2015-04-03 04:53:16828 void OnTextTrackSettingsChanged(
829 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16830 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
davidbena5496d62014-10-07 18:52:04831 void OnCommitNavigation(const ResourceResponseHead& response,
832 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42833 const CommonNavigationParams& common_params,
lukaszad04640f2016-05-25 17:08:44834 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57835 void OnFailedNavigation(const CommonNavigationParams& common_params,
836 const RequestNavigationParams& request_params,
837 bool has_stale_copy_in_cache,
838 int error_code);
lukasza6af746b72015-09-18 23:37:22839 void OnGetSavableResourceLinks();
lukasza2e296c32015-09-28 23:29:48840 void OnGetSerializedHtmlWithLocalLinks(
lukasza777a7dd2016-01-25 23:55:47841 const std::map<GURL, base::FilePath>& url_to_local_path,
842 const std::map<int, base::FilePath>& frame_routing_id_to_local_path);
lukaszaede9cc02015-12-30 23:48:32843 void OnSerializeAsMHTML(const FrameMsg_SerializeAsMHTML_Params& params);
paulmeyer5d0a5f02016-01-21 20:15:52844 void OnFind(int request_id,
845 const base::string16& search_text,
846 const blink::WebFindOptions& options);
paulmeyerc8cb7cb2016-06-07 01:14:19847 void OnClearActiveFindMatch();
paulmeyer5d0a5f02016-01-21 20:15:52848 void OnStopFinding(StopFindAction action);
clamy91b7abf2016-03-24 15:17:45849 void OnEnableViewSourceMode();
avi6b8dbb32016-04-08 18:59:35850 void OnSuppressFurtherDialogs();
naskoada75b22016-06-11 16:09:46851 void OnFileChooserResponse(
852 const std::vector<content::FileChooserFileInfo>& files);
paulmeyer5d0a5f02016-01-21 20:15:52853#if defined(OS_ANDROID)
854 void OnActivateNearestFindResult(int request_id, float x, float y);
paulmeyerc8cb7cb2016-06-07 01:14:19855 void OnGetNearestFindResult(int request_id, float x, float y);
paulmeyer5d0a5f02016-01-21 20:15:52856 void OnFindMatchRects(int current_version);
haibinluc643d33c2016-06-03 02:22:34857#endif
858
859#if defined(USE_EXTERNAL_POPUP_MENU)
860#if defined(OS_MACOSX)
861 void OnSelectPopupMenuItem(int selected_index);
862#else
paulmeyer5d0a5f02016-01-21 20:15:52863 void OnSelectPopupMenuItems(bool canceled,
864 const std::vector<int>& selected_indices);
haibinluc643d33c2016-06-03 02:22:34865#endif
866#endif
867
868#if defined(OS_MACOSX)
paulmeyer5d0a5f02016-01-21 20:15:52869 void OnCopyToFindPboard();
870#endif
clamy9bfeef42014-09-30 20:50:42871
creise18ce072015-12-02 02:00:02872 // Requests that the browser process navigates to |url|. If
873 // |is_history_navigation_in_new_child| is true, the browser process should
874 // look for a matching FrameNavigationEntry in the last committed entry to use
875 // instead of |url|.
lukaszabb2101b82016-06-17 16:52:25876 void OpenURL(
877 const GURL& url,
878 bool uses_post,
879 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body,
880 const Referrer& referrer,
881 blink::WebNavigationPolicy policy,
882 bool should_replace_current_entry,
883 bool is_history_navigation_in_new_child);
[email protected]a09d53ce2014-01-31 00:46:42884
clamyd6983032015-04-29 14:48:12885 // Performs a navigation in the frame. This provides a unified function for
886 // the current code path and the browser-side navigation path (in
887 // development). Currently used by OnNavigate, with all *NavigationParams
888 // provided by the browser. |stream_params| should be null.
889 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
890 // |request_params| received by the browser. |stream_params| should be non
891 // null and created from the information provided by the browser.
892 // |start_params| is not used.
dchengcedca5612016-04-09 01:40:15893 void NavigateInternal(
894 const CommonNavigationParams& common_params,
895 const StartNavigationParams& start_params,
896 const RequestNavigationParams& request_params,
lukaszad04640f2016-05-25 17:08:44897 std::unique_ptr<StreamOverrideParameters> stream_params);
clamyd6983032015-04-29 14:48:12898
[email protected]ef3adfc2014-05-11 00:04:54899 // Update current main frame's encoding and send it to browser window.
900 // Since we want to let users see the right encoding info from menu
901 // before finishing loading, we call the UpdateEncoding in
902 // a) function:DidCommitLoadForFrame. When this function is called,
903 // that means we have got first data. In here we try to get encoding
904 // of page if it has been specified in http header.
905 // b) function:DidReceiveTitle. When this function is called,
906 // that means we have got specified title. Because in most of webpages,
907 // title tags will follow meta tags. In here we try to get encoding of
908 // page if it has been specified in meta tag.
909 // c) function:DidFinishDocumentLoadForFrame. When this function is
910 // called, that means we have got whole html page. In here we should
911 // finally get right encoding of page.
912 void UpdateEncoding(blink::WebFrame* frame,
913 const std::string& encoding_name);
914
[email protected]4ee64622014-03-21 22:34:15915 // Dispatches the current state of selection on the webpage to the browser if
916 // it has changed.
917 // TODO(varunjain): delete this method once we figure out how to keep
918 // selection handles in sync with the webpage.
919 void SyncSelectionIfRequired();
920
[email protected]87de04b02014-04-08 22:14:49921 bool RunJavaScriptMessage(JavaScriptMessageType type,
922 const base::string16& message,
923 const base::string16& default_value,
924 const GURL& frame_url,
925 base::string16* result);
926
naskoada75b22016-06-11 16:09:46927 // Adds the given file chooser request to the file_chooser_completion_ queue
928 // (see that var for more) and requests the chooser be displayed if there are
929 // no other waiting items in the queue.
930 //
931 // Returns true if the chooser was successfully scheduled. False means we
932 // didn't schedule anything.
933 bool ScheduleFileChooser(const FileChooserParams& params,
934 blink::WebFileChooserCompletion* completion);
935
[email protected]457736d2014-04-30 15:54:27936 // Loads the appropriate error page for the specified failure into the frame.
yzshen0424e6952016-09-06 16:48:58937 // |entry| is only used by PlzNavigate when navigating to a history item.
[email protected]457736d2014-04-30 15:54:27938 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
939 const blink::WebURLError& error,
yzshen0424e6952016-09-06 16:48:58940 bool replace,
941 HistoryEntry* entry);
[email protected]457736d2014-04-30 15:54:27942
zeeshanq3454e9c2014-09-04 21:30:28943 void HandleJavascriptExecutionResult(const base::string16& javascript,
944 int id,
945 bool notify_result,
deepak.s750d68f2015-04-30 07:32:41946 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:28947
[email protected]977db4a42014-07-17 08:04:32948 // Initializes |web_user_media_client_|. If this fails, because it wasn't
949 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
950 // |web_user_media_client_| will remain NULL.
951 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19952
953 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
guidou9c3cc3e2015-10-27 13:38:15954 blink::WebMediaPlayerClient* client,
955 const blink::WebString& sink_id,
956 const blink::WebSecurityOrigin& security_origin);
[email protected]96307312014-05-04 01:00:19957
[email protected]ae2477e2014-05-27 23:47:08958 // Creates a factory object used for creating audio and video renderers.
dchengcedca5612016-04-09 01:40:15959 std::unique_ptr<MediaStreamRendererFactory> CreateRendererFactory();
[email protected]ae2477e2014-05-27 23:47:08960
avi5cad4912015-06-19 05:25:44961 // Does preparation for the navigation to |url|.
962 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:25963 const GURL& url,
toyoshimf3f7f682016-04-08 07:47:48964 const RequestNavigationParams& request_params);
clamyda97e8322014-10-07 21:57:25965
clamyece38882014-11-19 15:00:20966 // PlzNavigate
arthursonzogni69824eb2016-07-13 16:22:03967 // Sends a FrameHostMsg_BeginNavigation to the browser
968 void BeginNavigation(const NavigationPolicyInfo& info);
clamyece38882014-11-19 15:00:20969
clamy4cc9b8202015-03-02 13:51:36970 // Loads a data url.
971 void LoadDataURL(const CommonNavigationParams& params,
mnaganovbf087422015-12-16 05:10:03972 const RequestNavigationParams& request_params,
clamy0f4ccc82016-02-24 12:43:53973 blink::WebLocalFrame* frame,
974 blink::WebFrameLoadType load_type,
975 blink::WebHistoryItem item_for_history_navigation,
976 blink::WebHistoryLoadType history_load_type,
977 bool is_client_redirect);
clamy4cc9b8202015-03-02 13:51:36978
clamy62b271d2015-04-16 11:54:57979 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
980 // the failed request |request|.
981 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
982 const blink::WebURLError& error,
983 blink::WebLocalFrame* frame);
984
985 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
986 const GURL& unreachable_url);
987
[email protected]f3a95312014-06-12 16:46:58988 // Returns the URL being loaded by the |frame_|'s request.
989 GURL GetLoadingUrl() const;
990
avi0392dbf52015-03-25 16:55:45991 // If we initiated a navigation, this function will populate |document_state|
992 // with the navigation information saved in OnNavigate().
993 void PopulateDocumentStateFromPending(DocumentState* document_state);
994
995 // Returns a new NavigationState populated with the navigation information
996 // saved in OnNavigate().
997 NavigationState* CreateNavigationStateFromPending();
998
csharrison1ce0e852015-11-07 16:45:13999 // Sets the NavigationState on the DocumentState based on
1000 // the value of |pending_navigation_params_|.
boliuac512fd2016-03-16 23:33:351001 void UpdateNavigationState(DocumentState* document_state,
avi68a109ab2016-05-15 01:46:321002 bool was_within_same_page,
1003 bool content_initiated);
csharrison1ce0e852015-11-07 16:45:131004
[email protected]96307312014-05-04 01:00:191005#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:001006 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
jrummell65b7d272014-09-24 20:49:271007 blink::WebMediaPlayerClient* client,
srirama.m26f864d02015-07-14 05:21:461008 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
dalecurtis49f363882015-08-25 21:05:381009 const media::WebMediaPlayerParams& params);
[email protected]a017938b2014-05-27 21:17:171010
[email protected]65f3d1aa2014-05-29 01:57:001011 RendererMediaPlayerManager* GetMediaPlayerManager();
davve859f4f92015-11-27 10:16:191012
1013 RendererMediaSessionManager* GetMediaSessionManager();
[email protected]4b556cf2014-06-10 23:21:531014#endif
1015
sandersd02d9aea2015-05-12 02:29:261016 bool AreSecureCodecsSupported();
xhwang33f939e2015-06-23 04:33:421017
xhwange70b7ee12015-06-25 09:17:171018#if defined(ENABLE_MOJO_MEDIA)
rockotb00e6462016-04-14 02:24:031019 shell::mojom::InterfaceProvider* GetMediaInterfaceProvider();
xhwang33f939e2015-06-23 04:33:421020#endif
1021
xhwangd7180832015-04-03 05:38:151022 media::CdmFactory* GetCdmFactory();
xhwang409e53552016-02-23 00:52:441023 media::DecoderFactory* GetDecoderFactory();
[email protected]96307312014-05-04 01:00:191024
ben155ecf82016-06-21 22:43:261025 void RegisterMojoInterfaces();
halton.huoca2eabd2015-07-06 08:17:401026
xhwang6bca21e2016-02-06 00:21:451027 // Connect to an interface provided by the service registry.
1028 template <typename Interface>
bene3bc9022016-02-10 17:38:241029 void GetInterface(mojo::InterfaceRequest<Interface> request);
xhwang6bca21e2016-02-06 00:21:451030
dalecurtisa12e6062015-11-10 23:13:141031 // Returns the media delegate for WebMediaPlayer usage. If
1032 // |media_player_delegate_| is NULL, one is created.
1033 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate();
1034
paulmeyer5d0a5f02016-01-21 20:15:521035 // Called to get the WebPlugin to handle find requests in the document.
1036 // Returns nullptr if there is no such WebPlugin.
1037 blink::WebPlugin* GetWebPluginForFind();
1038
1039 // Sends a reply to the current find operation handling if it was a
1040 // synchronous find request.
1041 void SendFindReply(int request_id,
1042 int match_count,
1043 int ordinal,
1044 const blink::WebRect& selection_rect,
1045 bool final_status_update);
1046
skyostilb4cce1b2016-03-31 17:56:341047 void InitializeBlameContext(RenderFrameImpl* parent_frame);
1048
creiscfaa4462015-03-16 19:27:181049 // Stores the WebLocalFrame we are associated with. This is null from the
ddorwinf63505e2016-01-08 00:54:501050 // constructor until BindToWebFrame is called, and it is null after
creiscfaa4462015-03-16 19:27:181051 // frameDetached is called until destruction (which is asynchronous in the
1052 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:221053 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:091054
dglazkov2e140f52015-09-28 16:10:071055 // Boolean value indicating whether this RenderFrameImpl object is for the
1056 // main frame or not. It remains accurate during destruction, even when
1057 // |frame_| has been invalidated.
1058 bool is_main_frame_;
nasko8b9d9bd2015-05-06 19:23:191059
naskoeab5c5582015-12-15 05:20:001060 // When a frame is detached in response to a message from the browser process,
1061 // this RenderFrame should not be sending notifications back to it. This
1062 // boolean is used to indicate this case.
1063 bool in_browser_initiated_detach_;
1064
1065 // Indicates whether the frame has been inserted into the frame tree yet or
1066 // not.
1067 //
1068 // When a frame is created by the browser process, it is for a pending
1069 // navigation. In this case, it is not immediately attached to the frame tree
1070 // if there is a RenderFrameProxy for the same frame. It is inserted into the
1071 // frame tree at the time the pending navigation commits.
1072 // Frames added by the parent document are created from the renderer process
1073 // and are immediately inserted in the frame tree.
1074 // TODO(dcheng): Remove this once we have FrameTreeHandle and can use the
1075 // Blink Web* layer to check for provisional frames.
1076 bool in_frame_tree_;
1077
[email protected]abc501e2014-01-27 19:27:261078 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:041079 int routing_id_;
nasko8b9d9bd2015-05-06 19:23:191080
japhete6adf142014-10-31 00:01:491081 // If this frame was created to replace a proxy, this will store the routing
1082 // id of the proxy to replace at commit-time, at which time it will be
1083 // cleared.
1084 // TODO(creis): Remove this after switching to PlzNavigate.
1085 int proxy_routing_id_;
1086
dcheng3d886b732015-11-05 19:16:011087 // Non-null when the RenderFrame is a local root for compositing, input,
1088 // layout, etc. A local frame is also a local root iff it does not have a
1089 // parent that is a local frame.
kenrba7199832015-01-22 23:44:591090 scoped_refptr<RenderWidget> render_widget_;
1091
avi0392dbf52015-03-25 16:55:451092 // Temporarily holds state pertaining to a navigation that has been initiated
1093 // until the NavigationState corresponding to the new navigation is created in
1094 // didCreateDataSource().
dchengcedca5612016-04-09 01:40:151095 std::unique_ptr<NavigationParams> pending_navigation_params_;
avi0392dbf52015-03-25 16:55:451096
creis8eb8ef22015-11-04 22:51:381097 // Stores the current history item for this frame, so that updates to it can
1098 // be reported to the browser process via SendUpdateState.
1099 blink::WebHistoryItem current_history_item_;
1100
[email protected]7a4e2532013-12-02 21:30:021101#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:021102 // Current text input composition text. Empty if no composition is in
1103 // progress.
[email protected]fcf75d42013-12-03 20:11:261104 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:091105
tommycli59bd86c2014-12-10 02:09:381106 PluginPowerSaverHelper* plugin_power_saver_helper_;
paulmeyer5d0a5f02016-01-21 20:15:521107
1108 PepperPluginInstanceImpl* plugin_find_handler_;
[email protected]7a4e2532013-12-02 21:30:021109#endif
1110
[email protected]f3add922013-12-20 23:17:161111 RendererWebCookieJarImpl cookie_jar_;
1112
[email protected]2e2d9632013-12-03 00:55:261113 // All the registered observers.
brettw236d3172015-06-03 16:31:431114 base::ObserverList<RenderFrameObserver> observers_;
[email protected]2e2d9632013-12-03 00:55:261115
[email protected]bffc8302014-01-23 20:52:161116 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
1117
[email protected]a09d53ce2014-01-31 00:46:421118 // External context menu requests we're waiting for. "Internal"
1119 // (WebKit-originated) context menu events will have an ID of 0 and will not
1120 // be in this map.
1121 //
1122 // We don't want to add internal ones since some of the "special" page
1123 // handlers in the browser process just ignore the context menu requests so
1124 // avoid showing context menus, and so this will cause right clicks to leak
1125 // entries in this map. Most users of the custom context menu (e.g. Pepper
1126 // plugins) are normally only on "regular" pages and the regular pages will
1127 // always respond properly to the request, so we don't have to worry so
1128 // much about leaks.
1129 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
1130
[email protected]4ee64622014-03-21 22:34:151131 // The text selection the last time DidChangeSelection got called. May contain
1132 // additional characters before and after the selected text, for IMEs. The
1133 // portion of this string that is the actual selected text starts at index
1134 // |selection_range_.GetMin() - selection_text_offset_| and has length
1135 // |selection_range_.length()|.
1136 base::string16 selection_text_;
1137 // The offset corresponding to the start of |selection_text_| in the document.
1138 size_t selection_text_offset_;
1139 // Range over the document corresponding to the actual selected text (which
1140 // could correspond to a substring of |selection_text_|; see above).
1141 gfx::Range selection_range_;
1142 // Used to inform didChangeSelection() when it is called in the context
1143 // of handling a InputMsg_SelectRange IPC.
1144 bool handling_select_range_;
1145
[email protected]2626d142014-04-22 17:24:021146 // The next group of objects all implement RenderFrameObserver, so are deleted
1147 // along with the RenderFrame automatically. This is why we just store weak
1148 // references.
1149
[email protected]977db4a42014-07-17 08:04:321150 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:331151 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:191152
jrummell109c3a602014-12-18 01:08:501153 // EncryptedMediaClient attached to this frame; lazily initialized.
dchengcedca5612016-04-09 01:40:151154 std::unique_ptr<media::WebEncryptedMediaClientImpl>
1155 web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:501156
xhwang6bca21e2016-02-06 00:21:451157 // The media permission dispatcher attached to this frame.
dchengcedca5612016-04-09 01:40:151158 std::unique_ptr<MediaPermissionDispatcher> media_permission_dispatcher_;
xhwang36b1f3b2015-01-27 17:54:011159
xhwange70b7ee12015-06-25 09:17:171160#if defined(ENABLE_MOJO_MEDIA)
xhwanga5967e552016-02-26 00:54:081161 // The media interface provider attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151162 std::unique_ptr<MediaInterfaceProvider> media_interface_provider_;
xhwang065b54b2015-06-03 22:25:551163#endif
1164
[email protected]a017938b2014-05-27 21:17:171165#if defined(OS_ANDROID)
davve859f4f92015-11-27 10:16:191166 // Manages all media players and sessions in this render frame for
1167 // communicating with the real media player and sessions in the
1168 // browser process. It's okay to use raw pointers since they're both
1169 // RenderFrameObservers.
[email protected]a017938b2014-05-27 21:17:171170 RendererMediaPlayerManager* media_player_manager_;
davve859f4f92015-11-27 10:16:191171 RendererMediaSessionManager* media_session_manager_;
[email protected]4b556cf2014-06-10 23:21:531172#endif
1173
watkdee516f2016-02-18 02:22:191174 media::SurfaceManager* media_surface_manager_;
1175
[email protected]4b556cf2014-06-10 23:21:531176#if defined(ENABLE_BROWSER_CDMS)
1177 // Manage all CDMs in this render frame for communicating with the real CDM in
1178 // the browser process. It's okay to use a raw pointer since it's a
1179 // RenderFrameObserver.
[email protected]65f3d1aa2014-05-29 01:57:001180 RendererCdmManager* cdm_manager_;
[email protected]a017938b2014-05-27 21:17:171181#endif
1182
xhwang409e53552016-02-23 00:52:441183 // The CDM and decoder factory attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151184 std::unique_ptr<media::CdmFactory> cdm_factory_;
1185 std::unique_ptr<media::DecoderFactory> decoder_factory_;
xhwangd7180832015-04-03 05:38:151186
hubbe5f0ad43b2015-12-14 20:57:261187 // Media resource cache, lazily initialized.
1188 linked_ptr<media::UrlIndex> url_index_;
1189
dgozman358ba322015-03-26 15:05:301190 // The devtools agent for this frame; only created for main frame and
1191 // local roots.
1192 DevToolsAgent* devtools_agent_;
1193
[email protected]45920862014-07-02 12:53:021194 // The push messaging dispatcher attached to this frame, lazily initialized.
1195 PushMessagingDispatcher* push_messaging_dispatcher_;
1196
avayvodbca35fad2015-01-29 20:20:571197 // The presentation dispatcher implementation attached to this frame, lazily
1198 // initialized.
1199 PresentationDispatcher* presentation_dispatcher_;
1200
ben155ecf82016-06-21 22:43:261201 std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
1202 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
ben88716142016-07-30 00:03:031203 std::unique_ptr<BlinkInterfaceProviderImpl> blink_interface_provider_;
ben155ecf82016-06-21 22:43:261204 shell::mojom::InterfaceProviderRequest
1205 pending_remote_interface_provider_request_;
[email protected]c52a1412014-06-25 06:09:251206
rockotd9260982015-08-21 22:26:301207 // The shell proxy used to connect to Mojo applications.
rockotb00e6462016-04-14 02:24:031208 shell::mojom::ConnectorPtr connector_;
rockotd9260982015-08-21 22:26:301209
[email protected]45920862014-07-02 12:53:021210 // The screen orientation dispatcher attached to the frame, lazily
1211 // initialized.
[email protected]cf78eda2014-06-13 16:57:411212 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
1213
mlamouriefdca9d2014-09-16 16:55:401214 // The Manifest Manager handles the manifest requests from the browser
1215 // process.
1216 ManifestManager* manifest_manager_;
1217
[email protected]95640212014-07-26 18:14:301218 // The current accessibility mode.
1219 AccessibilityMode accessibility_mode_;
1220
1221 // Only valid if |accessibility_mode_| is anything other than
1222 // AccessibilityModeOff.
dmazzoni8e6fe4d2016-06-27 06:35:371223 RenderAccessibilityImpl* render_accessibility_;
[email protected]95640212014-07-26 18:14:301224
dchengcedca5612016-04-09 01:40:151225 std::unique_ptr<blink::WebAppBannerClient> app_banner_client_;
benwells04ab5b962015-05-06 08:29:401226
dchengcedca5612016-04-09 01:40:151227 std::unique_ptr<blink::WebBluetooth> bluetooth_;
jyasskinf89a11b2015-07-21 00:27:481228
dalecurtisa12e6062015-11-10 23:13:141229 // Manages play, pause notifications for WebMediaPlayer implementations; its
1230 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface.
1231 media::RendererWebMediaPlayerDelegate* media_player_delegate_;
1232
megjablond5ac7d52015-10-22 23:56:121233 // Whether or not this RenderFrame is using Lo-Fi mode.
1234 bool is_using_lofi_;
1235
tbansal7b6cf8b2016-05-10 19:27:231236 // Effective connection type when the document of this frame was fetched.
1237 blink::WebEffectiveConnectionType effective_connection_type_;
1238
ellyjonesdb20fae12015-12-04 16:47:551239 // Whether or not this RenderFrame is currently pasting.
1240 bool is_pasting_;
1241
avi6b8dbb32016-04-08 18:59:351242 // Whether we must stop creating nested message loops for modal dialogs. This
1243 // is necessary because modal dialogs have a ScopedPageLoadDeferrer on the
1244 // stack that interferes with swapping out.
1245 bool suppress_further_dialogs_;
1246
naskoada75b22016-06-11 16:09:461247 // The current and pending file chooser completion objects. If the queue is
1248 // nonempty, the first item represents the currently running file chooser
1249 // callback, and the remaining elements are the other file chooser completion
1250 // still waiting to be run (in order).
1251 struct PendingFileChooser;
1252 std::deque<std::unique_ptr<PendingFileChooser>> file_chooser_completions_;
1253
haibinluc643d33c2016-06-03 02:22:341254#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:141255 // The external popup for the currently showing select popup.
dchengcedca5612016-04-09 01:40:151256 std::unique_ptr<ExternalPopupMenu> external_popup_menu_;
avi485e5fd62014-08-25 23:26:141257#endif
1258
xiaochengh01c3b102016-06-13 23:56:081259 std::unique_ptr<FrameBlameContext> blame_context_;
skyostilb4cce1b2016-03-31 17:56:341260
lfge0c2792ec2016-05-11 18:52:081261 // Plugins -------------------------------------------------------------------
1262#if defined(ENABLE_PLUGINS)
1263 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
1264 PepperPluginSet active_pepper_instances_;
1265
1266 // Whether or not the focus is on a PPAPI plugin
1267 PepperPluginInstanceImpl* focused_pepper_plugin_;
1268
1269 // The plugin instance that received the last mouse event. It is set to NULL
1270 // if the last mouse event went to elements other than Pepper plugins.
1271 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on
1272 // the RenderFrameImpl to NULL it out when it destructs.
1273 PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
lfge0c2792ec2016-05-11 18:52:081274#endif
1275
ben76f52b242016-06-18 05:42:481276 mojo::Binding<mojom::Frame> frame_binding_;
1277 mojom::FrameHostPtr frame_host_;
1278
ahesteacad602016-08-30 21:25:541279 // Indicates whether |didAccessInitialDocument| was called.
1280 bool has_accessed_initial_document_;
1281
rockotf62002a2016-09-15 00:08:591282 AssociatedInterfaceRegistryImpl associated_interfaces_;
1283 std::unique_ptr<AssociatedInterfaceProviderImpl>
1284 remote_associated_interfaces_;
1285
[email protected]96307312014-05-04 01:00:191286 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1287
[email protected]227692c52013-05-31 22:43:041288 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1289};
1290
1291} // namespace content
1292
[email protected]85d85fd2013-06-19 00:57:411293#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_