blob: 2fb7787a75959bbfa30a640ac5b96a2f23265811 [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"
miu1ddf18c62016-09-24 01:39:4141#include "media/mojo/interfaces/remoting.mojom.h"
ben155ecf82016-06-21 22:43:2642#include "mojo/public/cpp/bindings/binding.h"
benf709a3092016-04-12 22:38:2243#include "services/shell/public/interfaces/connector.mojom.h"
44#include "services/shell/public/interfaces/interface_provider.mojom.h"
tbansal7b6cf8b2016-05-10 19:27:2345#include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
alexmos401f0aba2015-12-06 10:07:3946#include "third_party/WebKit/public/platform/WebFocusType.h"
csharrisonae811ab2016-04-11 11:32:2547#include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
sandersdf92f4e5c2016-01-22 20:57:2248#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
lfg717154072016-06-30 15:04:1649#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
benwells04ab5b962015-05-06 08:29:4050#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h"
[email protected]95640212014-07-26 18:14:3051#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4152#include "third_party/WebKit/public/web/WebDataSource.h"
53#include "third_party/WebKit/public/web/WebFrameClient.h"
boliu15890e42015-11-24 23:08:0554#include "third_party/WebKit/public/web/WebFrameLoadType.h"
lukasza902fcc52015-12-31 04:45:2955#include "third_party/WebKit/public/web/WebFrameSerializerClient.h"
[email protected]680575542014-04-03 17:12:5256#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
skyostilc3ed5652015-10-19 16:28:4657#include "third_party/WebKit/public/web/WebMeaningfulLayout.h"
twellington376424ad2015-05-04 18:57:2558#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
[email protected]4ee64622014-03-21 22:34:1559#include "ui/gfx/range/range.h"
lukaszaede9cc02015-12-30 23:48:3260#include "url/gurl.h"
[email protected]227692c52013-05-31 22:43:0461
tommyclid481c482014-12-03 01:50:4162#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3863#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4164#endif
65
[email protected]a017938b2014-05-27 21:17:1766#if defined(OS_ANDROID)
67#include "content/renderer/media/android/renderer_media_player_manager.h"
68#endif
69
xhwangc0299ae32015-07-21 23:39:5070#if defined(ENABLE_MOJO_MEDIA)
jbromanb73f2582016-01-11 16:35:0571#include "media/mojo/interfaces/service_factory.mojom.h" // nogncheck
xhwangc0299ae32015-07-21 23:39:5072#endif
73
[email protected]7a4e2532013-12-02 21:30:0274class TransportDIB;
kenrba7199832015-01-22 23:44:5975struct FrameMsg_NewFrame_WidgetParams;
alexmose7da5a12015-04-09 02:22:1676struct FrameMsg_PostMessage_Params;
lukaszaede9cc02015-12-30 23:48:3277struct FrameMsg_SerializeAsMHTML_Params;
dspelle736c9db2015-04-03 04:53:1678struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0279
avi7d30b552016-04-06 20:32:5580namespace IPC {
81class SyncMessage;
82}
83
[email protected]7a4e2532013-12-02 21:30:0284namespace blink {
[email protected]82ce5b92014-03-22 05:15:2685class WebContentDecryptionModule;
raymesbba82b32016-07-19 00:41:3886class WebMouseEvent;
avayvodbca35fad2015-01-29 20:20:5787class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0288class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2689class WebSecurityOrigin;
toyoshimf3f7f682016-04-08 07:47:4890enum class WebCachePolicy;
[email protected]7a4e2532013-12-02 21:30:0291struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4292struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0293struct WebCursorInfo;
paulmeyer5d0a5f02016-01-21 20:15:5294struct WebFindOptions;
thestig4c8f2a72016-08-13 01:39:1195} // namespace blink
[email protected]7a4e2532013-12-02 21:30:0296
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
rockotf62002a2016-09-15 00:08:59125class AssociatedInterfaceProviderImpl;
[email protected]bffc8302014-01-23 20:52:16126class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:59127class CompositorDependencies;
dgozman358ba322015-03-26 15:05:30128class DevToolsAgent;
avi0392dbf52015-03-25 16:55:45129class DocumentState;
avi485e5fd62014-08-25 23:26:14130class ExternalPopupMenu;
yzshen0424e6952016-09-06 16:48:58131class HistoryEntry;
mlamouriefdca9d2014-09-16 16:55:40132class ManifestManager;
xhwanga5967e552016-02-26 00:54:08133class MediaInterfaceProvider;
[email protected]977db4a42014-07-17 08:04:32134class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:08135class MediaStreamRendererFactory;
xhwang5206d4e62016-02-05 02:09:55136class MediaPermissionDispatcher;
[email protected]52d3e172014-06-16 16:57:02137class MidiDispatcher;
avi0392dbf52015-03-25 16:55:45138class NavigationState;
clamyda97e8322014-10-07 21:57:25139class PageState;
[email protected]7a4e2532013-12-02 21:30:02140class PepperPluginInstanceImpl;
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;
ccameron2f451532016-09-07 21:49:27166struct ScreenInfo;
clamy34e12782015-03-12 11:26:13167struct StartNavigationParams;
clamyd6983032015-04-29 14:48:12168struct StreamOverrideParameters;
[email protected]227692c52013-05-31 22:43:04169
[email protected]85d85fd2013-06-19 00:57:41170class CONTENT_EXPORT RenderFrameImpl
171 : public RenderFrame,
ben76f52b242016-06-18 05:42:48172 NON_EXPORTED_BASE(mojom::Frame),
[email protected]96307312014-05-04 01:00:19173 NON_EXPORTED_BASE(public blink::WebFrameClient),
lukasza902fcc52015-12-31 04:45:29174 NON_EXPORTED_BASE(public blink::WebFrameSerializerClient) {
[email protected]227692c52013-05-31 22:43:04175 public:
dchengc5ef1a52015-08-26 20:58:30176 // Creates a new RenderFrame as the main frame of |render_view|.
dcheng3ce04b62015-10-26 23:30:55177 static RenderFrameImpl* CreateMainFrame(
178 RenderViewImpl* render_view,
179 int32_t routing_id,
180 int32_t widget_routing_id,
181 bool hidden,
ccameron2f451532016-09-07 21:49:27182 const ScreenInfo& screen_info,
dcheng9e24bd352016-03-01 19:15:51183 CompositorDependencies* compositor_deps,
184 blink::WebFrame* opener);
[email protected]2f61bdd2013-07-02 18:38:47185
alexmosa181efc2015-09-03 00:39:04186 // Creates a new RenderFrame with |routing_id|. If |proxy_routing_id| is
187 // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into
188 // the frame tree after the frame identified by
189 // |previous_sibling_routing_id|, or as the first child if
alexmos9f8705a2015-05-06 19:58:59190 // |previous_sibling_routing_id| is MSG_ROUTING_NONE. Otherwise, the frame is
191 // semi-orphaned until it commits, at which point it replaces the proxy
alexmosa181efc2015-09-03 00:39:04192 // identified by |proxy_routing_id|. The frame's opener is set to the frame
193 // identified by |opener_routing_id|. The frame is created as a child of the
194 // RenderFrame identified by |parent_routing_id| or as the top-level frame if
195 // the latter is MSG_ROUTING_NONE. Note: This is called only when
alexmos9f8705a2015-05-06 19:58:59196 // RenderFrame is being created in response to IPC message from the browser
197 // process. All other frame creation is driven through Blink and Create.
raymes31457802016-07-20 06:08:09198 static void CreateFrame(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 FrameOwnerProperties& frame_owner_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
kdsilvae0135592016-08-09 17:08:11239 // Overwrites the given URL to use an HTML5 embed if possible.
240 blink::WebURL overrideFlashEmbedWithHTML(const blink::WebURL& url) override;
241
avi5c77d212015-09-25 20:08:25242 ~RenderFrameImpl() override;
[email protected]227692c52013-05-31 22:43:04243
dglazkovf0e1d6d2015-10-10 02:13:48244 // Called by RenderWidget when meaningful layout has happened.
245 // See RenderFrameObserver::DidMeaningfulLayout declaration for details.
246 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type);
247
[email protected]bffc8302014-01-23 20:52:16248 // Out-of-process child frames receive a signal from RenderWidgetCompositor
249 // when a compositor frame has committed.
250 void DidCommitCompositorFrame();
251
lfge0c2792ec2016-05-11 18:52:08252 // Draw commands have been issued by RenderWidgetCompositor.
253 void DidCommitAndDrawCompositorFrame();
254
[email protected]7a4e2532013-12-02 21:30:02255 // TODO(jam): this is a temporary getter until all the code is transitioned
256 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26257 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02258
creis225a7432016-06-03 22:56:27259 const blink::WebHistoryItem& current_history_item() {
260 return current_history_item_;
261 }
262
[email protected]f3add922013-12-20 23:17:16263 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
264
[email protected]7a4e2532013-12-02 21:30:02265 // Returns the RenderWidget associated with this frame.
266 RenderWidget* GetRenderWidget();
267
dgozmancf9039cd2015-04-06 12:01:31268 DevToolsAgent* devtools_agent() { return devtools_agent_; }
269
[email protected]0287e762014-04-11 13:07:58270 // This method must be called after the frame has been added to the frame
271 // tree. It creates all objects that depend on the frame being at its proper
272 // spot.
273 void Initialize();
274
[email protected]de3c5d82014-05-28 22:12:59275 // Notifications from RenderWidget.
276 void WasHidden();
277 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31278 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59279
[email protected]723971b2014-02-12 11:08:25280 // Start/Stop loading notifications.
281 // TODO(nasko): Those are page-level methods at this time and come from
282 // WebViewClient. We should move them to be WebFrameClient calls and put
283 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09284 // |to_different_document| will be true unless the load is a fragment
285 // navigation, or triggered by history.pushState/replaceState.
avi5c77d212015-09-25 20:08:25286 void didStartLoading(bool to_different_document) override;
287 void didStopLoading() override;
288 void didChangeLoadProgress(double load_progress) override;
[email protected]723971b2014-02-12 11:08:25289
[email protected]95640212014-07-26 18:14:30290 AccessibilityMode accessibility_mode() {
291 return accessibility_mode_;
292 }
293
dmazzoni8e6fe4d2016-06-27 06:35:37294 RenderAccessibilityImpl* render_accessibility() {
295 return render_accessibility_;
[email protected]95640212014-07-26 18:14:30296 }
297
298 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
299 blink::WebAXEvent event);
300
estade31c54342015-01-23 03:34:36301 // The focused node changed to |node|. If focus was lost from this frame,
302 // |node| will be null.
[email protected]95640212014-07-26 18:14:30303 void FocusedNodeChanged(const blink::WebNode& node);
304
estade31c54342015-01-23 03:34:36305 // TODO(dmazzoni): the only reason this is here is to plumb it through to
dmazzoni8e6fe4d2016-06-27 06:35:37306 // RenderAccessibilityImpl. It should use the RenderFrameObserver method, once
estade31c54342015-01-23 03:34:36307 // blink has a separate accessibility tree per frame.
308 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
309
lfge0c2792ec2016-05-11 18:52:08310 // Called when this frame's widget is focused.
311 void RenderWidgetSetFocus(bool enable);
312
313 // Called when the widget receives a mouse event.
314 void RenderWidgetWillHandleMouseEvent();
315
[email protected]7a4e2532013-12-02 21:30:02316#if defined(ENABLE_PLUGINS)
paulmeyer5d0a5f02016-01-21 20:15:52317 // Get/set the plugin which will be used to handle document find requests.
318 void set_plugin_find_handler(PepperPluginInstanceImpl* plugin) {
319 plugin_find_handler_ = plugin;
320 }
321 PepperPluginInstanceImpl* plugin_find_handler() {
322 return plugin_find_handler_;
323 }
324
[email protected]271ff5792013-12-04 22:29:31325 // Notification that a PPAPI plugin has been created.
326 void PepperPluginCreated(RendererPpapiHost* host);
327
[email protected]7a4e2532013-12-02 21:30:02328 // Notifies that |instance| has changed the cursor.
329 // This will update the cursor appearance if it is currently over the plugin
330 // instance.
331 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
332 const blink::WebCursorInfo& cursor);
333
334 // Notifies that |instance| has received a mouse event.
335 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
336
[email protected]7a4e2532013-12-02 21:30:02337 // Informs the render view that a PPAPI plugin has changed text input status.
338 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
339 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
340
341 // Cancels current composition.
342 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
343
344 // Informs the render view that a PPAPI plugin has changed selection.
345 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
346
347 // Creates a fullscreen container for a pepper plugin instance.
348 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
349 PepperPluginInstanceImpl* plugin);
350
[email protected]7a4e2532013-12-02 21:30:02351 bool IsPepperAcceptingCompositionEvents() const;
352
353 // Notification that the given plugin has crashed.
354 void PluginCrashed(const base::FilePath& plugin_path,
355 base::ProcessId plugin_pid);
356
[email protected]7a4e2532013-12-02 21:30:02357 // Simulates IME events for testing purpose.
358 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26359 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02360 const std::vector<blink::WebCompositionUnderline>& underlines,
361 int selection_start,
362 int selection_end);
aelias87b8f7c2016-09-14 03:19:29363 void SimulateImeCommitText(const base::string16& text,
364 const gfx::Range& replacement_range);
365 void SimulateImeFinishComposingText(bool keep_selection);
[email protected]7a4e2532013-12-02 21:30:02366
367 // TODO(jam): remove these once the IPC handler moves from RenderView to
368 // RenderFrame.
369 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42370 const base::string16& text,
371 const std::vector<blink::WebCompositionUnderline>& underlines,
372 int selection_start,
373 int selection_end);
aelias87b8f7c2016-09-14 03:19:29374 void OnImeCommitText(const base::string16& text,
375 const gfx::Range& replacement_range,
376 int relative_cursor_pos);
377 void OnImeFinishComposingText(bool keep_selection);
378
tommyclie6633ca72014-10-31 00:40:42379#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02380
[email protected]977db4a42014-07-17 08:04:32381 // May return NULL in some cases, especially if userMediaClient() returns
382 // NULL.
383 MediaStreamDispatcher* GetMediaStreamDispatcher();
384
haibinluc643d33c2016-06-03 02:22:34385#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:14386 void DidHideExternalPopupMenu();
387#endif
388
[email protected]227692c52013-05-31 22:43:04389 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52390 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04391
392 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52393 bool OnMessageReceived(const IPC::Message& msg) override;
rockotce2138c2016-09-16 00:09:18394 void OnAssociatedInterfaceRequest(
395 const std::string& interface_name,
396 mojo::ScopedInterfaceEndpointHandle handle) override;
[email protected]227692c52013-05-31 22:43:04397
[email protected]271ff5792013-12-04 22:29:31398 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52399 RenderView* GetRenderView() override;
dmazzoni8e6fe4d2016-06-27 06:35:37400 RenderAccessibility* GetRenderAccessibility() override;
dcheng6d18e402014-10-21 12:32:52401 int GetRoutingID() override;
402 blink::WebLocalFrame* GetWebFrame() override;
403 WebPreferences& GetWebkitPreferences() override;
404 int ShowContextMenu(ContextMenuClient* client,
405 const ContextMenuParams& params) override;
406 void CancelContextMenu(int request_id) override;
tommycli59bd86c2014-12-10 02:09:38407 blink::WebPlugin* CreatePlugin(
408 blink::WebFrame* frame,
409 const WebPluginInfo& info,
410 const blink::WebPluginParams& params,
dchengcedca5612016-04-09 01:40:15411 std::unique_ptr<PluginInstanceThrottler> throttler) override;
japhetb0bae9d82015-10-19 20:43:40412 void LoadURLExternally(const blink::WebURLRequest& request,
dcheng6d18e402014-10-21 12:32:52413 blink::WebNavigationPolicy policy) override;
414 void ExecuteJavaScript(const base::string16& javascript) override;
dglazkov2e140f52015-09-28 16:10:07415 bool IsMainFrame() override;
dcheng6d18e402014-10-21 12:32:52416 bool IsHidden() override;
ben155ecf82016-06-21 22:43:26417 shell::InterfaceRegistry* GetInterfaceRegistry() override;
418 shell::InterfaceProvider* GetRemoteInterfaces() override;
rockotf62002a2016-09-15 00:08:59419 AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry() override;
420 AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
tommyclid481c482014-12-03 01:50:41421#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38422 void RegisterPeripheralPlugin(
tommycli58e3172c2015-09-15 18:18:26423 const url::Origin& content_origin,
tommycli59bd86c2014-12-10 02:09:38424 const base::Closure& unthrottle_callback) override;
tommycli9c7cbd92015-12-18 23:34:34425 RenderFrame::PeripheralContentStatus GetPeripheralContentStatus(
426 const url::Origin& main_frame_origin,
427 const url::Origin& content_origin,
tommycli8a1ef84d2016-08-10 23:05:08428 const gfx::Size& unobscured_size,
429 RecordPeripheralDecision record_decision) const override;
tommyclibae63b92015-10-23 02:56:20430 void WhitelistContentOrigin(const url::Origin& content_origin) override;
thestig4c8f2a72016-08-13 01:39:11431 void DidStartLoading() override;
432 void DidStopLoading() override;
tommyclid481c482014-12-03 01:50:41433#endif
dcheng6d18e402014-10-21 12:32:52434 bool IsFTPDirectoryListing() override;
435 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52436 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52437 void SetSelectedText(const base::string16& selection_text,
438 size_t offset,
439 const gfx::Range& range) override;
440 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19441 v8::Local<v8::Context> context) override;
rdevlin.croninb2cec912015-06-24 20:36:01442 void AddMessageToConsole(ConsoleMessageLevel level,
443 const std::string& message) override;
megjablond5ac7d52015-10-22 23:56:12444 bool IsUsingLoFi() const override;
ellyjonesdb20fae12015-12-04 16:47:55445 bool IsPasting() const override;
lfg717154072016-06-30 15:04:16446 blink::WebPageVisibilityState GetVisibilityState() const override;
[email protected]271ff5792013-12-04 22:29:31447
ben76f52b242016-06-18 05:42:48448 // mojom::Frame implementation:
449 void GetInterfaceProvider(
450 shell::mojom::InterfaceProviderRequest request) override;
451
[email protected]96307312014-05-04 01:00:19452 // blink::WebFrameClient implementation:
avi5c77d212015-09-25 20:08:25453 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
454 const blink::WebPluginParams& params) override;
455 blink::WebMediaPlayer* createMediaPlayer(
guidou9bfe4e2f2016-04-09 08:31:19456 const blink::WebMediaPlayerSource& source,
srirama.m26f864d02015-07-14 05:21:46457 blink::WebMediaPlayerClient* client,
458 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
guidou9c3cc3e2015-10-27 13:38:15459 blink::WebContentDecryptionModule* initial_cdm,
zqzhangf85a8f82016-09-22 19:12:09460 const blink::WebString& sink_id) override;
davve50137b62015-10-23 12:15:21461 blink::WebMediaSession* createMediaSession() override;
avi5c77d212015-09-25 20:08:25462 blink::WebApplicationCacheHost* createApplicationCacheHost(
avi5c77d212015-09-25 20:08:25463 blink::WebApplicationCacheHostClient* client) override;
464 blink::WebWorkerContentSettingsClientProxy*
avi01681ef2016-02-16 17:53:57465 createWorkerContentSettingsClientProxy() override;
avi5c77d212015-09-25 20:08:25466 blink::WebExternalPopupMenu* createExternalPopupMenu(
[email protected]b20c3222014-08-22 00:50:22467 const blink::WebPopupMenuInfo& popup_menu_info,
avi5c77d212015-09-25 20:08:25468 blink::WebExternalPopupMenuClient* popup_menu_client) override;
avi5047cd572016-02-16 20:41:12469 blink::WebCookieJar* cookieJar() override;
skyostilb4cce1b2016-03-31 17:56:34470 blink::BlameContext* frameBlameContext() override;
avi01681ef2016-02-16 17:53:57471 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override;
avi5047cd572016-02-16 20:41:12472 void didAccessInitialDocument() override;
dcheng9f8e2f62016-09-29 15:54:50473 blink::WebLocalFrame* createChildFrame(
alexmose48b1df932015-01-16 01:34:17474 blink::WebLocalFrame* parent,
dcheng860817a2015-05-22 03:16:56475 blink::WebTreeScopeType scope,
476 const blink::WebString& name,
lukasza464d8692016-02-22 19:26:32477 const blink::WebString& unique_name,
478 blink::WebSandboxFlags sandbox_flags,
479 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25480 void didChangeOpener(blink::WebFrame* frame) override;
lfgaf41ee002016-07-05 14:57:24481 void frameDetached(blink::WebLocalFrame* frame, DetachType type) override;
avi5c77d212015-09-25 20:08:25482 void frameFocused() override;
dcheng9f8e2f62016-09-29 15:54:50483 void willCommitProvisionalLoad(blink::WebLocalFrame* frame) override;
lukasza464d8692016-02-22 19:26:32484 void didChangeName(const blink::WebString& name,
485 const blink::WebString& unique_name) override;
mkwstf672e7ef2016-06-09 20:51:07486 void didEnforceInsecureRequestPolicy(
487 blink::WebInsecureRequestPolicy policy) override;
estarkbd8e26f2016-03-16 23:30:37488 void didUpdateToUniqueOrigin(
489 bool is_potentially_trustworthy_unique_origin) override;
avi5c77d212015-09-25 20:08:25490 void didChangeSandboxFlags(blink::WebFrame* child_frame,
491 blink::WebSandboxFlags flags) override;
lukasza8e1c02e42016-05-17 20:05:10492 void didAddContentSecurityPolicy(
493 const blink::WebString& header_value,
494 blink::WebContentSecurityPolicyType type,
495 blink::WebContentSecurityPolicySource source) override;
Avi Drissman09b359e52015-12-07 20:19:21496 void didChangeFrameOwnerProperties(
lazyboy70605c32015-11-03 01:27:31497 blink::WebFrame* child_frame,
498 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25499 void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22500 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46501 const blink::WebVector<blink::WebString>& newly_matching_selectors,
avi5c77d212015-09-25 20:08:25502 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
503 override;
504 bool shouldReportDetailedMessageForSource(
505 const blink::WebString& source) override;
506 void didAddMessageToConsole(const blink::WebConsoleMessage& message,
507 const blink::WebString& source_name,
508 unsigned source_line,
509 const blink::WebString& stack_trace) override;
japhetb0bae9d82015-10-19 20:43:40510 void loadURLExternally(const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25511 blink::WebNavigationPolicy policy,
japhetb0bae9d82015-10-19 20:43:40512 const blink::WebString& suggested_name,
513 bool should_replace_current_entry) override;
avi5c77d212015-09-25 20:08:25514 blink::WebNavigationPolicy decidePolicyForNavigation(
515 const NavigationPolicyInfo& info) override;
creise18ce072015-12-02 02:00:02516 blink::WebHistoryItem historyItemForNewChildFrame() override;
avi0fe3a6d2016-02-16 20:57:27517 void willSendSubmitEvent(const blink::WebFormElement& form) override;
518 void willSubmitForm(const blink::WebFormElement& form) override;
avi5c77d212015-09-25 20:08:25519 void didCreateDataSource(blink::WebLocalFrame* frame,
520 blink::WebDataSource* datasource) override;
521 void didStartProvisionalLoad(blink::WebLocalFrame* frame,
522 double triggering_event_time) override;
523 void didReceiveServerRedirectForProvisionalLoad(
524 blink::WebLocalFrame* frame) override;
525 void didFailProvisionalLoad(blink::WebLocalFrame* frame,
526 const blink::WebURLError& error,
527 blink::WebHistoryCommitType commit_type) override;
528 void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22529 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52530 const blink::WebHistoryItem& item,
avi5c77d212015-09-25 20:08:25531 blink::WebHistoryCommitType commit_type) override;
532 void didCreateNewDocument(blink::WebLocalFrame* frame) override;
533 void didClearWindowObject(blink::WebLocalFrame* frame) override;
534 void didCreateDocumentElement(blink::WebLocalFrame* frame) override;
rob43ea0642016-03-19 01:05:01535 void runScriptsAtDocumentElementAvailable(
536 blink::WebLocalFrame* frame) override;
avi5c77d212015-09-25 20:08:25537 void didReceiveTitle(blink::WebLocalFrame* frame,
538 const blink::WebString& title,
539 blink::WebTextDirection direction) override;
540 void didChangeIcon(blink::WebLocalFrame* frame,
541 blink::WebIconURL::Type icon_type) override;
rob2718dfc2016-03-25 20:58:27542 void didFinishDocumentLoad(blink::WebLocalFrame* frame) override;
543 void runScriptsAtDocumentReady(blink::WebLocalFrame* frame,
544 bool document_is_empty) override;
avi5c77d212015-09-25 20:08:25545 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override;
546 void didFailLoad(blink::WebLocalFrame* frame,
547 const blink::WebURLError& error,
548 blink::WebHistoryCommitType commit_type) override;
549 void didFinishLoad(blink::WebLocalFrame* frame) override;
550 void didNavigateWithinPage(blink::WebLocalFrame* frame,
551 const blink::WebHistoryItem& item,
avi68a109ab2016-05-15 01:46:32552 blink::WebHistoryCommitType commit_type,
553 bool content_initiated) override;
avi1008732f2016-02-17 17:28:49554 void didUpdateCurrentHistoryItem() override;
avi5c77d212015-09-25 20:08:25555 void didChangeThemeColor() override;
556 void dispatchLoad() override;
tbansal7b6cf8b2016-05-10 19:27:23557 blink::WebEffectiveConnectionType getEffectiveConnectionType() override;
avi5c77d212015-09-25 20:08:25558 void didChangeSelection(bool is_empty_selection) override;
alexmos56567492016-09-13 00:52:46559 bool handleCurrentKeyboardEvent() override;
avi5c77d212015-09-25 20:08:25560 blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19561 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55562 const blink::WebColor& initial_color,
avi5c77d212015-09-25 20:08:25563 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override;
564 void runModalAlertDialog(const blink::WebString& message) override;
565 bool runModalConfirmDialog(const blink::WebString& message) override;
566 bool runModalPromptDialog(const blink::WebString& message,
567 const blink::WebString& default_value,
568 blink::WebString* actual_value) override;
avi141dbc1322016-03-11 22:27:42569 bool runModalBeforeUnloadDialog(bool is_reload) override;
naskoada75b22016-06-11 16:09:46570 bool runFileChooser(
571 const blink::WebFileChooserParams& params,
572 blink::WebFileChooserCompletion* chooser_completion) override;
avi5c77d212015-09-25 20:08:25573 void showContextMenu(const blink::WebContextMenuData& data) override;
brettw8f508f42016-06-20 21:34:21574 void saveImageFromDataURL(const blink::WebString& data_url) override;
avi5c77d212015-09-25 20:08:25575 void willSendRequest(blink::WebLocalFrame* frame,
japhet8489f1b2016-08-24 00:27:59576 blink::WebURLRequest& request) override;
577 void didReceiveResponse(const blink::WebURLResponse& response) override;
avi5c77d212015-09-25 20:08:25578 void didLoadResourceFromMemoryCache(
[email protected]180ef242013-11-07 06:50:46579 const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25580 const blink::WebURLResponse& response) override;
581 void didDisplayInsecureContent() override;
582 void didRunInsecureContent(const blink::WebSecurityOrigin& origin,
583 const blink::WebURL& target) override;
estark910b4572015-12-09 20:55:41584 void didDisplayContentWithCertificateErrors(
jamc94a7532016-09-07 19:40:29585 const blink::WebURL& url) override;
586 void didRunContentWithCertificateErrors(const blink::WebURL& url) override;
avi5c77d212015-09-25 20:08:25587 void didChangePerformanceTiming() override;
csharrisonae811ab2016-04-11 11:32:25588 void didObserveLoadingBehavior(
589 blink::WebLoadingBehaviorFlag behavior) override;
avi5c77d212015-09-25 20:08:25590 void didCreateScriptContext(blink::WebLocalFrame* frame,
591 v8::Local<v8::Context> context,
592 int extension_group,
593 int world_id) override;
594 void willReleaseScriptContext(blink::WebLocalFrame* frame,
595 v8::Local<v8::Context> context,
596 int world_id) override;
597 void didChangeScrollOffset(blink::WebLocalFrame* frame) override;
598 void willInsertBody(blink::WebLocalFrame* frame) override;
599 void reportFindInPageMatchCount(int request_id,
600 int count,
601 bool final_update) override;
602 void reportFindInPageSelection(int request_id,
603 int active_match_ordinal,
604 const blink::WebRect& sel) override;
avif0d894852016-02-17 17:49:12605 void requestStorageQuota(blink::WebStorageQuotaType type,
avi5c77d212015-09-25 20:08:25606 unsigned long long requested_size,
607 blink::WebStorageQuotaCallbacks callbacks) override;
avi5c77d212015-09-25 20:08:25608 blink::WebPushClient* pushClient() override;
609 blink::WebPresentationClient* presentationClient() override;
610 void willStartUsingPeerConnectionHandler(
avi5c77d212015-09-25 20:08:25611 blink::WebRTCPeerConnectionHandler* handler) override;
612 blink::WebUserMediaClient* userMediaClient() override;
613 blink::WebEncryptedMediaClient* encryptedMediaClient() override;
avif0d894852016-02-17 17:49:12614 blink::WebString userAgentOverride() override;
615 blink::WebString doNotTrackValue() override;
616 bool allowWebGL(bool default_value) override;
avi5c77d212015-09-25 20:08:25617 blink::WebScreenOrientationClient* webScreenOrientationClient() override;
618 bool isControlledByServiceWorker(blink::WebDataSource& data_source) override;
619 int64_t serviceWorkerID(blink::WebDataSource& data_source) override;
620 void postAccessibilityEvent(const blink::WebAXObject& obj,
621 blink::WebAXEvent event) override;
622 void handleAccessibilityFindInPageResult(
623 int identifier,
624 int match_index,
625 const blink::WebAXObject& start_object,
626 int start_offset,
627 const blink::WebAXObject& end_object,
628 int end_offset) override;
avi1008732f2016-02-17 17:28:49629 void didChangeManifest() override;
foolip73101372016-07-13 08:19:22630 void enterFullscreen() override;
631 void exitFullscreen() override;
avi5c77d212015-09-25 20:08:25632 blink::WebAppBannerClient* appBannerClient() override;
633 void registerProtocolHandler(const blink::WebString& scheme,
634 const blink::WebURL& url,
635 const blink::WebString& title) override;
636 void unregisterProtocolHandler(const blink::WebString& scheme,
637 const blink::WebURL& url) override;
638 blink::WebBluetooth* bluetooth() override;
guidou3906a722015-11-12 22:14:42639 void checkIfAudioSinkExistsAndIsAuthorized(
640 const blink::WebString& sink_id,
641 const blink::WebSecurityOrigin& security_origin,
642 blink::WebSetSinkIdCallbacks* web_callbacks) override;
ben88716142016-07-30 00:03:03643 blink::InterfaceProvider* interfaceProvider() override;
lfg717154072016-06-30 15:04:16644 blink::WebPageVisibilityState visibilityState() const override;
[email protected]85d85fd2013-06-19 00:57:41645
lukasza902fcc52015-12-31 04:45:29646 // WebFrameSerializerClient implementation:
lukasza2e296c32015-09-28 23:29:48647 void didSerializeDataForFrame(
lukasza2e296c32015-09-28 23:29:48648 const blink::WebCString& data,
lukasza902fcc52015-12-31 04:45:29649 blink::WebFrameSerializerClient::FrameSerializationStatus status)
650 override;
lukasza2e296c32015-09-28 23:29:48651
ben76f52b242016-06-18 05:42:48652 // Binds to the FrameHost in the browser.
653 void Bind(mojom::FrameRequest frame, mojom::FrameHostPtr frame_host);
rockotf8fdd9b2015-12-16 22:22:35654
mlamouri4fff1992014-09-30 11:22:46655 ManifestManager* manifest_manager();
656
avi0392dbf52015-03-25 16:55:45657 // TODO(creis): Remove when the only caller, the HistoryController, is no
658 // more.
659 void SetPendingNavigationParams(
dchengcedca5612016-04-09 01:40:15660 std::unique_ptr<NavigationParams> navigation_params);
avi0392dbf52015-03-25 16:55:45661
xhwang5206d4e62016-02-05 02:09:55662 media::MediaPermission* GetMediaPermission();
guoweisf4282b02015-09-24 23:05:22663
creis69b184a472015-11-26 05:29:51664 // Sends the current frame's navigation state to the browser.
665 void SendUpdateState();
666
sammce2f99982016-03-14 22:38:12667 // Creates a MojoBindingsController if Mojo bindings have been enabled for
668 // this frame. For WebUI, this allows the page to communicate with the browser
669 // process; for layout tests, this allows the test to mock out services at
670 // the Mojo IPC layer.
671 void MaybeEnableMojoBindings();
nasko1fa0fb62015-12-09 01:49:57672
lfge0c2792ec2016-05-11 18:52:08673 // Plugin-related functions --------------------------------------------------
674
675#if defined(ENABLE_PLUGINS)
676 PepperPluginInstanceImpl* focused_pepper_plugin() {
677 return focused_pepper_plugin_;
678 }
679 PepperPluginInstanceImpl* pepper_last_mouse_event_target() {
680 return pepper_last_mouse_event_target_;
681 }
682 void set_pepper_last_mouse_event_target(PepperPluginInstanceImpl* plugin) {
683 pepper_last_mouse_event_target_ = plugin;
684 }
685
686 // Indicates that the given instance has been created.
687 void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
688
689 // Indicates that the given instance is being destroyed. This is called from
690 // the destructor, so it's important that the instance is not dereferenced
691 // from this call.
692 void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
693
694 // Notification that the given plugin is focused or unfocused.
695 void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
zqzhangc885f6b2016-06-23 19:44:46696
697 void PepperStartsPlayback(PepperPluginInstanceImpl* instance);
698 void PepperStopsPlayback(PepperPluginInstanceImpl* instance);
699 void OnSetPepperVolume(int32_t pp_instance, double volume);
lfge0c2792ec2016-05-11 18:52:08700#endif // ENABLE_PLUGINS
701
[email protected]2f61bdd2013-07-02 18:38:47702 protected:
jochen664198b2015-06-25 14:13:00703 explicit RenderFrameImpl(const CreateParams& params);
[email protected]2f61bdd2013-07-02 18:38:47704
[email protected]227692c52013-05-31 22:43:04705 private:
kenrbf98a4d22015-04-01 21:59:35706 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26707 friend class RenderFrameObserver;
dmazzoni8e6fe4d2016-06-27 06:35:37708 friend class RenderAccessibilityImplTest;
clamy98a9dee02015-06-24 16:09:10709 friend class TestRenderFrame;
avi485e5fd62014-08-25 23:26:14710 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
711 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
712 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
713 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
dmazzoni8e6fe4d2016-06-27 06:35:37714 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest,
[email protected]66bbadaf2014-03-28 16:25:54715 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]2e2d9632013-12-03 00:55:26716
twellington376424ad2015-05-04 18:57:25717 // A wrapper class used as the callback for JavaScript executed
718 // in an isolated world.
719 class JavaScriptIsolatedWorldRequest
720 : public blink::WebScriptExecutionCallback {
721 public:
722 JavaScriptIsolatedWorldRequest(
723 int id,
724 bool notify_result,
725 int routing_id,
726 base::WeakPtr<RenderFrameImpl> render_frame_impl);
727 void completed(
728 const blink::WebVector<v8::Local<v8::Value>>& result) override;
729
730 private:
avi5c77d212015-09-25 20:08:25731 ~JavaScriptIsolatedWorldRequest() override;
twellington376424ad2015-05-04 18:57:25732
733 int id_;
734 bool notify_result_;
735 int routing_id_;
736 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
737
738 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
739 };
740
[email protected]37567b432014-02-12 01:12:22741 typedef std::map<GURL, double> HostZoomLevels;
742
dchengc5ef1a52015-08-26 20:58:30743 // Creates a new RenderFrame. |render_view| is the RenderView object that this
744 // frame belongs to.
ddorwinf63505e2016-01-08 00:54:50745 // Callers *must* call |BindToWebFrame| immediately after creation.
avi1023d012015-12-25 02:39:14746 static RenderFrameImpl* Create(RenderViewImpl* render_view,
747 int32_t routing_id);
dchengc5ef1a52015-08-26 20:58:30748
ddorwinf63505e2016-01-08 00:54:50749 // This is called right after creation with the WebLocalFrame for this
750 // RenderFrame. It must be called before Initialize.
751 void BindToWebFrame(blink::WebLocalFrame* web_frame);
752
[email protected]2e2d9632013-12-03 00:55:26753 // Functions to add and remove observers for this object.
754 void AddObserver(RenderFrameObserver* observer);
755 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34756
dcheng3d886b732015-11-05 19:16:01757 bool IsLocalRoot() const;
758
[email protected]f0906a02014-08-07 07:18:55759 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35760 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
creis8b5cd4c2015-06-19 00:11:08761 blink::WebHistoryCommitType commit_type,
762 const blink::WebHistoryItem& item);
[email protected]37567b432014-02-12 01:12:22763
[email protected]b70da4c2014-01-06 19:57:09764 // IPC message handlers ------------------------------------------------------
765 //
766 // The documentation for these functions should be in
767 // content/common/*_messages.h for the message that the function is handling.
clamy98a9dee02015-06-24 16:09:10768 void OnNavigate(const CommonNavigationParams& common_params,
769 const StartNavigationParams& start_params,
770 const RequestNavigationParams& request_params);
clamybfd6a812016-05-30 16:25:17771 void OnBeforeUnload(bool is_reload);
alexmosbc7eafa2014-12-06 01:38:09772 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56773 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09774 const FrameReplicationState& replicated_frame_state);
naskoeab5c5582015-12-15 05:20:00775 void OnDeleteFrame();
Nasko Oskov85f60222014-08-28 22:53:30776 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42777 void OnShowContextMenu(const gfx::Point& location);
778 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
779 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
780 unsigned action);
[email protected]4ee64622014-03-21 22:34:15781 void OnUndo();
782 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07783 void OnCut();
784 void OnCopy();
785 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15786 void OnPasteAndMatchStyle();
787 void OnDelete();
788 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14789 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
aurimasab0319022015-07-10 21:57:38790 void OnAdjustSelectionByCharacterOffset(int start_adjust, int end_adjust);
[email protected]4ee64622014-03-21 22:34:15791 void OnUnselect();
christiankaeed9862014-11-05 10:49:14792 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17793 void OnReplace(const base::string16& text);
794 void OnReplaceMisspelling(const base::string16& text);
brettw8f508f42016-06-20 21:34:21795 void OnCopyImageAt(int x, int y);
796 void OnSaveImageAt(int x, int y);
peter4eb242002015-06-02 12:45:13797 void OnAddMessageToConsole(ConsoleMessageLevel level,
798 const std::string& message);
[email protected]f13ab892014-03-12 06:48:52799 void OnJavaScriptExecuteRequest(const base::string16& javascript,
800 int id,
801 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28802 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
803 int id,
jochen2e7d95b2015-05-04 15:28:50804 bool notify_result,
805 bool has_user_gesture);
twellington376424ad2015-05-04 18:57:25806 void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
807 int id,
808 bool notify_result,
809 int world_id);
avi1023d012015-12-25 02:39:14810 void OnVisualStateRequest(uint64_t key);
[email protected]4ee64622014-03-21 22:34:15811 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16812 void OnSetCompositionFromExistingText(
813 int start, int end,
814 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24815 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16816 void OnExtendSelectionAndDelete(int before, int after);
toyoshim24a4c7ab2016-04-05 09:24:14817 void OnReload(bool bypass_cache);
megjablon3f5941072016-02-04 23:27:52818 void OnReloadLoFiImages();
jam973236102016-02-09 00:47:05819 void OnTextSurroundingSelectionRequest(uint32_t max_length);
[email protected]95640212014-07-26 18:14:30820 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51821 void OnSnapshotAccessibilityTree(int callback_id);
alexmos95733002015-08-24 16:38:09822 void OnUpdateOpener(int opener_routing_id);
dcheng5f60abb2015-05-28 01:39:36823 void OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags);
lazyboy70605c32015-11-03 01:27:31824 void OnSetFrameOwnerProperties(
raymesbba82b32016-07-19 00:41:38825 const FrameOwnerProperties& frame_owner_properties);
alexmos401f0aba2015-12-06 10:07:39826 void OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id);
alexmos5357efb2015-12-16 21:44:00827 void OnSetFocusedFrame();
avallee0206f782016-07-28 18:55:33828 void OnClearFocusedFrame();
dspelle736c9db2015-04-03 04:53:16829 void OnTextTrackSettingsChanged(
830 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16831 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
davidbena5496d62014-10-07 18:52:04832 void OnCommitNavigation(const ResourceResponseHead& response,
833 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42834 const CommonNavigationParams& common_params,
lukaszad04640f2016-05-25 17:08:44835 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57836 void OnFailedNavigation(const CommonNavigationParams& common_params,
837 const RequestNavigationParams& request_params,
838 bool has_stale_copy_in_cache,
839 int error_code);
lukasza6af746b72015-09-18 23:37:22840 void OnGetSavableResourceLinks();
lukasza2e296c32015-09-28 23:29:48841 void OnGetSerializedHtmlWithLocalLinks(
lukasza777a7dd2016-01-25 23:55:47842 const std::map<GURL, base::FilePath>& url_to_local_path,
843 const std::map<int, base::FilePath>& frame_routing_id_to_local_path);
lukaszaede9cc02015-12-30 23:48:32844 void OnSerializeAsMHTML(const FrameMsg_SerializeAsMHTML_Params& params);
paulmeyer5d0a5f02016-01-21 20:15:52845 void OnFind(int request_id,
846 const base::string16& search_text,
847 const blink::WebFindOptions& options);
paulmeyerc8cb7cb2016-06-07 01:14:19848 void OnClearActiveFindMatch();
paulmeyer5d0a5f02016-01-21 20:15:52849 void OnStopFinding(StopFindAction action);
clamy91b7abf2016-03-24 15:17:45850 void OnEnableViewSourceMode();
avi6b8dbb32016-04-08 18:59:35851 void OnSuppressFurtherDialogs();
naskoada75b22016-06-11 16:09:46852 void OnFileChooserResponse(
853 const std::vector<content::FileChooserFileInfo>& files);
paulmeyer5d0a5f02016-01-21 20:15:52854#if defined(OS_ANDROID)
855 void OnActivateNearestFindResult(int request_id, float x, float y);
paulmeyerc8cb7cb2016-06-07 01:14:19856 void OnGetNearestFindResult(int request_id, float x, float y);
paulmeyer5d0a5f02016-01-21 20:15:52857 void OnFindMatchRects(int current_version);
haibinluc643d33c2016-06-03 02:22:34858#endif
859
860#if defined(USE_EXTERNAL_POPUP_MENU)
861#if defined(OS_MACOSX)
862 void OnSelectPopupMenuItem(int selected_index);
863#else
paulmeyer5d0a5f02016-01-21 20:15:52864 void OnSelectPopupMenuItems(bool canceled,
865 const std::vector<int>& selected_indices);
haibinluc643d33c2016-06-03 02:22:34866#endif
867#endif
868
869#if defined(OS_MACOSX)
paulmeyer5d0a5f02016-01-21 20:15:52870 void OnCopyToFindPboard();
871#endif
clamy9bfeef42014-09-30 20:50:42872
creise18ce072015-12-02 02:00:02873 // Requests that the browser process navigates to |url|. If
874 // |is_history_navigation_in_new_child| is true, the browser process should
875 // look for a matching FrameNavigationEntry in the last committed entry to use
876 // instead of |url|.
lukaszabb2101b82016-06-17 16:52:25877 void OpenURL(
878 const GURL& url,
879 bool uses_post,
880 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body,
881 const Referrer& referrer,
882 blink::WebNavigationPolicy policy,
883 bool should_replace_current_entry,
884 bool is_history_navigation_in_new_child);
[email protected]a09d53ce2014-01-31 00:46:42885
clamyd6983032015-04-29 14:48:12886 // Performs a navigation in the frame. This provides a unified function for
887 // the current code path and the browser-side navigation path (in
888 // development). Currently used by OnNavigate, with all *NavigationParams
889 // provided by the browser. |stream_params| should be null.
890 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
891 // |request_params| received by the browser. |stream_params| should be non
892 // null and created from the information provided by the browser.
893 // |start_params| is not used.
dchengcedca5612016-04-09 01:40:15894 void NavigateInternal(
895 const CommonNavigationParams& common_params,
896 const StartNavigationParams& start_params,
897 const RequestNavigationParams& request_params,
lukaszad04640f2016-05-25 17:08:44898 std::unique_ptr<StreamOverrideParameters> stream_params);
clamyd6983032015-04-29 14:48:12899
[email protected]ef3adfc2014-05-11 00:04:54900 // Update current main frame's encoding and send it to browser window.
901 // Since we want to let users see the right encoding info from menu
902 // before finishing loading, we call the UpdateEncoding in
903 // a) function:DidCommitLoadForFrame. When this function is called,
904 // that means we have got first data. In here we try to get encoding
905 // of page if it has been specified in http header.
906 // b) function:DidReceiveTitle. When this function is called,
907 // that means we have got specified title. Because in most of webpages,
908 // title tags will follow meta tags. In here we try to get encoding of
909 // page if it has been specified in meta tag.
910 // c) function:DidFinishDocumentLoadForFrame. When this function is
911 // called, that means we have got whole html page. In here we should
912 // finally get right encoding of page.
913 void UpdateEncoding(blink::WebFrame* frame,
914 const std::string& encoding_name);
915
[email protected]4ee64622014-03-21 22:34:15916 // Dispatches the current state of selection on the webpage to the browser if
917 // it has changed.
918 // TODO(varunjain): delete this method once we figure out how to keep
919 // selection handles in sync with the webpage.
920 void SyncSelectionIfRequired();
921
[email protected]87de04b02014-04-08 22:14:49922 bool RunJavaScriptMessage(JavaScriptMessageType type,
923 const base::string16& message,
924 const base::string16& default_value,
925 const GURL& frame_url,
926 base::string16* result);
927
naskoada75b22016-06-11 16:09:46928 // Adds the given file chooser request to the file_chooser_completion_ queue
929 // (see that var for more) and requests the chooser be displayed if there are
930 // no other waiting items in the queue.
931 //
932 // Returns true if the chooser was successfully scheduled. False means we
933 // didn't schedule anything.
934 bool ScheduleFileChooser(const FileChooserParams& params,
935 blink::WebFileChooserCompletion* completion);
936
[email protected]457736d2014-04-30 15:54:27937 // Loads the appropriate error page for the specified failure into the frame.
yzshen0424e6952016-09-06 16:48:58938 // |entry| is only used by PlzNavigate when navigating to a history item.
[email protected]457736d2014-04-30 15:54:27939 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
940 const blink::WebURLError& error,
yzshen0424e6952016-09-06 16:48:58941 bool replace,
942 HistoryEntry* entry);
[email protected]457736d2014-04-30 15:54:27943
zeeshanq3454e9c2014-09-04 21:30:28944 void HandleJavascriptExecutionResult(const base::string16& javascript,
945 int id,
946 bool notify_result,
deepak.s750d68f2015-04-30 07:32:41947 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:28948
[email protected]977db4a42014-07-17 08:04:32949 // Initializes |web_user_media_client_|. If this fails, because it wasn't
950 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
951 // |web_user_media_client_| will remain NULL.
952 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19953
954 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
guidou9c3cc3e2015-10-27 13:38:15955 blink::WebMediaPlayerClient* client,
956 const blink::WebString& sink_id,
957 const blink::WebSecurityOrigin& security_origin);
[email protected]96307312014-05-04 01:00:19958
[email protected]ae2477e2014-05-27 23:47:08959 // Creates a factory object used for creating audio and video renderers.
dchengcedca5612016-04-09 01:40:15960 std::unique_ptr<MediaStreamRendererFactory> CreateRendererFactory();
[email protected]ae2477e2014-05-27 23:47:08961
avi5cad4912015-06-19 05:25:44962 // Does preparation for the navigation to |url|.
963 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:25964 const GURL& url,
toyoshimf3f7f682016-04-08 07:47:48965 const RequestNavigationParams& request_params);
clamyda97e8322014-10-07 21:57:25966
clamyece38882014-11-19 15:00:20967 // PlzNavigate
arthursonzogni69824eb2016-07-13 16:22:03968 // Sends a FrameHostMsg_BeginNavigation to the browser
969 void BeginNavigation(const NavigationPolicyInfo& info);
clamyece38882014-11-19 15:00:20970
clamy4cc9b8202015-03-02 13:51:36971 // Loads a data url.
972 void LoadDataURL(const CommonNavigationParams& params,
mnaganovbf087422015-12-16 05:10:03973 const RequestNavigationParams& request_params,
clamy0f4ccc82016-02-24 12:43:53974 blink::WebLocalFrame* frame,
975 blink::WebFrameLoadType load_type,
976 blink::WebHistoryItem item_for_history_navigation,
977 blink::WebHistoryLoadType history_load_type,
978 bool is_client_redirect);
clamy4cc9b8202015-03-02 13:51:36979
clamy62b271d2015-04-16 11:54:57980 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
981 // the failed request |request|.
982 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
983 const blink::WebURLError& error,
984 blink::WebLocalFrame* frame);
985
986 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
987 const GURL& unreachable_url);
988
[email protected]f3a95312014-06-12 16:46:58989 // Returns the URL being loaded by the |frame_|'s request.
990 GURL GetLoadingUrl() const;
991
avi0392dbf52015-03-25 16:55:45992 // If we initiated a navigation, this function will populate |document_state|
993 // with the navigation information saved in OnNavigate().
994 void PopulateDocumentStateFromPending(DocumentState* document_state);
995
996 // Returns a new NavigationState populated with the navigation information
997 // saved in OnNavigate().
998 NavigationState* CreateNavigationStateFromPending();
999
csharrison1ce0e852015-11-07 16:45:131000 // Sets the NavigationState on the DocumentState based on
1001 // the value of |pending_navigation_params_|.
boliuac512fd2016-03-16 23:33:351002 void UpdateNavigationState(DocumentState* document_state,
avi68a109ab2016-05-15 01:46:321003 bool was_within_same_page,
1004 bool content_initiated);
csharrison1ce0e852015-11-07 16:45:131005
[email protected]96307312014-05-04 01:00:191006#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:001007 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
jrummell65b7d272014-09-24 20:49:271008 blink::WebMediaPlayerClient* client,
srirama.m26f864d02015-07-14 05:21:461009 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
dalecurtis49f363882015-08-25 21:05:381010 const media::WebMediaPlayerParams& params);
[email protected]a017938b2014-05-27 21:17:171011
[email protected]65f3d1aa2014-05-29 01:57:001012 RendererMediaPlayerManager* GetMediaPlayerManager();
davve859f4f92015-11-27 10:16:191013
1014 RendererMediaSessionManager* GetMediaSessionManager();
[email protected]4b556cf2014-06-10 23:21:531015#endif
1016
sandersd02d9aea2015-05-12 02:29:261017 bool AreSecureCodecsSupported();
xhwang33f939e2015-06-23 04:33:421018
xhwange70b7ee12015-06-25 09:17:171019#if defined(ENABLE_MOJO_MEDIA)
rockotb00e6462016-04-14 02:24:031020 shell::mojom::InterfaceProvider* GetMediaInterfaceProvider();
xhwang33f939e2015-06-23 04:33:421021#endif
1022
miu1ddf18c62016-09-24 01:39:411023 media::mojom::RemoterFactory* GetRemoterFactory();
xhwangd7180832015-04-03 05:38:151024 media::CdmFactory* GetCdmFactory();
xhwang409e53552016-02-23 00:52:441025 media::DecoderFactory* GetDecoderFactory();
[email protected]96307312014-05-04 01:00:191026
ben155ecf82016-06-21 22:43:261027 void RegisterMojoInterfaces();
halton.huoca2eabd2015-07-06 08:17:401028
xhwang6bca21e2016-02-06 00:21:451029 // Connect to an interface provided by the service registry.
1030 template <typename Interface>
bene3bc9022016-02-10 17:38:241031 void GetInterface(mojo::InterfaceRequest<Interface> request);
xhwang6bca21e2016-02-06 00:21:451032
dalecurtisa12e6062015-11-10 23:13:141033 // Returns the media delegate for WebMediaPlayer usage. If
1034 // |media_player_delegate_| is NULL, one is created.
1035 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate();
1036
paulmeyer5d0a5f02016-01-21 20:15:521037 // Called to get the WebPlugin to handle find requests in the document.
1038 // Returns nullptr if there is no such WebPlugin.
1039 blink::WebPlugin* GetWebPluginForFind();
1040
1041 // Sends a reply to the current find operation handling if it was a
1042 // synchronous find request.
1043 void SendFindReply(int request_id,
1044 int match_count,
1045 int ordinal,
1046 const blink::WebRect& selection_rect,
1047 bool final_status_update);
1048
skyostilb4cce1b2016-03-31 17:56:341049 void InitializeBlameContext(RenderFrameImpl* parent_frame);
1050
creiscfaa4462015-03-16 19:27:181051 // Stores the WebLocalFrame we are associated with. This is null from the
ddorwinf63505e2016-01-08 00:54:501052 // constructor until BindToWebFrame is called, and it is null after
creiscfaa4462015-03-16 19:27:181053 // frameDetached is called until destruction (which is asynchronous in the
1054 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:221055 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:091056
dglazkov2e140f52015-09-28 16:10:071057 // Boolean value indicating whether this RenderFrameImpl object is for the
1058 // main frame or not. It remains accurate during destruction, even when
1059 // |frame_| has been invalidated.
1060 bool is_main_frame_;
nasko8b9d9bd2015-05-06 19:23:191061
naskoeab5c5582015-12-15 05:20:001062 // When a frame is detached in response to a message from the browser process,
1063 // this RenderFrame should not be sending notifications back to it. This
1064 // boolean is used to indicate this case.
1065 bool in_browser_initiated_detach_;
1066
1067 // Indicates whether the frame has been inserted into the frame tree yet or
1068 // not.
1069 //
1070 // When a frame is created by the browser process, it is for a pending
1071 // navigation. In this case, it is not immediately attached to the frame tree
1072 // if there is a RenderFrameProxy for the same frame. It is inserted into the
1073 // frame tree at the time the pending navigation commits.
1074 // Frames added by the parent document are created from the renderer process
1075 // and are immediately inserted in the frame tree.
1076 // TODO(dcheng): Remove this once we have FrameTreeHandle and can use the
1077 // Blink Web* layer to check for provisional frames.
1078 bool in_frame_tree_;
1079
[email protected]abc501e2014-01-27 19:27:261080 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:041081 int routing_id_;
nasko8b9d9bd2015-05-06 19:23:191082
japhete6adf142014-10-31 00:01:491083 // If this frame was created to replace a proxy, this will store the routing
1084 // id of the proxy to replace at commit-time, at which time it will be
1085 // cleared.
1086 // TODO(creis): Remove this after switching to PlzNavigate.
1087 int proxy_routing_id_;
1088
dcheng3d886b732015-11-05 19:16:011089 // Non-null when the RenderFrame is a local root for compositing, input,
1090 // layout, etc. A local frame is also a local root iff it does not have a
1091 // parent that is a local frame.
kenrba7199832015-01-22 23:44:591092 scoped_refptr<RenderWidget> render_widget_;
1093
avi0392dbf52015-03-25 16:55:451094 // Temporarily holds state pertaining to a navigation that has been initiated
1095 // until the NavigationState corresponding to the new navigation is created in
1096 // didCreateDataSource().
dchengcedca5612016-04-09 01:40:151097 std::unique_ptr<NavigationParams> pending_navigation_params_;
avi0392dbf52015-03-25 16:55:451098
creis45b3bba2016-09-22 22:47:131099 // Keeps track of whether the browser process has any history items that need
1100 // to be used for subframes of this frame (in the case of a history
1101 // navigation). If not, the renderer can skip sending an IPC to the browser
1102 // and directly load any initial URLs for children itself. This state is
1103 // cleared during didStopLoading, since it is not needed after the first load
1104 // completes and is never used after the initial navigation. It is inherited
1105 // by subframes.
1106 // TODO(creis): Switch this to a data structure of unique names and
1107 // corresponding same-process PageStates in https://crbug.com/639842.
1108 bool browser_has_subtree_history_items_;
1109
creis8eb8ef22015-11-04 22:51:381110 // Stores the current history item for this frame, so that updates to it can
1111 // be reported to the browser process via SendUpdateState.
1112 blink::WebHistoryItem current_history_item_;
1113
[email protected]7a4e2532013-12-02 21:30:021114#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:021115 // Current text input composition text. Empty if no composition is in
1116 // progress.
[email protected]fcf75d42013-12-03 20:11:261117 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:091118
tommycli59bd86c2014-12-10 02:09:381119 PluginPowerSaverHelper* plugin_power_saver_helper_;
paulmeyer5d0a5f02016-01-21 20:15:521120
1121 PepperPluginInstanceImpl* plugin_find_handler_;
[email protected]7a4e2532013-12-02 21:30:021122#endif
1123
[email protected]f3add922013-12-20 23:17:161124 RendererWebCookieJarImpl cookie_jar_;
1125
[email protected]2e2d9632013-12-03 00:55:261126 // All the registered observers.
brettw236d3172015-06-03 16:31:431127 base::ObserverList<RenderFrameObserver> observers_;
[email protected]2e2d9632013-12-03 00:55:261128
[email protected]bffc8302014-01-23 20:52:161129 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
1130
[email protected]a09d53ce2014-01-31 00:46:421131 // External context menu requests we're waiting for. "Internal"
1132 // (WebKit-originated) context menu events will have an ID of 0 and will not
1133 // be in this map.
1134 //
1135 // We don't want to add internal ones since some of the "special" page
1136 // handlers in the browser process just ignore the context menu requests so
1137 // avoid showing context menus, and so this will cause right clicks to leak
1138 // entries in this map. Most users of the custom context menu (e.g. Pepper
1139 // plugins) are normally only on "regular" pages and the regular pages will
1140 // always respond properly to the request, so we don't have to worry so
1141 // much about leaks.
1142 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
1143
[email protected]4ee64622014-03-21 22:34:151144 // The text selection the last time DidChangeSelection got called. May contain
1145 // additional characters before and after the selected text, for IMEs. The
1146 // portion of this string that is the actual selected text starts at index
1147 // |selection_range_.GetMin() - selection_text_offset_| and has length
1148 // |selection_range_.length()|.
1149 base::string16 selection_text_;
1150 // The offset corresponding to the start of |selection_text_| in the document.
1151 size_t selection_text_offset_;
1152 // Range over the document corresponding to the actual selected text (which
1153 // could correspond to a substring of |selection_text_|; see above).
1154 gfx::Range selection_range_;
1155 // Used to inform didChangeSelection() when it is called in the context
1156 // of handling a InputMsg_SelectRange IPC.
1157 bool handling_select_range_;
1158
[email protected]2626d142014-04-22 17:24:021159 // The next group of objects all implement RenderFrameObserver, so are deleted
1160 // along with the RenderFrame automatically. This is why we just store weak
1161 // references.
1162
[email protected]977db4a42014-07-17 08:04:321163 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:331164 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:191165
jrummell109c3a602014-12-18 01:08:501166 // EncryptedMediaClient attached to this frame; lazily initialized.
dchengcedca5612016-04-09 01:40:151167 std::unique_ptr<media::WebEncryptedMediaClientImpl>
1168 web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:501169
xhwang6bca21e2016-02-06 00:21:451170 // The media permission dispatcher attached to this frame.
dchengcedca5612016-04-09 01:40:151171 std::unique_ptr<MediaPermissionDispatcher> media_permission_dispatcher_;
xhwang36b1f3b2015-01-27 17:54:011172
xhwange70b7ee12015-06-25 09:17:171173#if defined(ENABLE_MOJO_MEDIA)
xhwanga5967e552016-02-26 00:54:081174 // The media interface provider attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151175 std::unique_ptr<MediaInterfaceProvider> media_interface_provider_;
xhwang065b54b2015-06-03 22:25:551176#endif
1177
[email protected]a017938b2014-05-27 21:17:171178#if defined(OS_ANDROID)
davve859f4f92015-11-27 10:16:191179 // Manages all media players and sessions in this render frame for
1180 // communicating with the real media player and sessions in the
1181 // browser process. It's okay to use raw pointers since they're both
1182 // RenderFrameObservers.
[email protected]a017938b2014-05-27 21:17:171183 RendererMediaPlayerManager* media_player_manager_;
davve859f4f92015-11-27 10:16:191184 RendererMediaSessionManager* media_session_manager_;
[email protected]4b556cf2014-06-10 23:21:531185#endif
1186
watkdee516f2016-02-18 02:22:191187 media::SurfaceManager* media_surface_manager_;
1188
miu1ddf18c62016-09-24 01:39:411189 // Lazy-bound pointer to the RemoterFactory service in the browser
1190 // process. Always use the GetRemoterFactory() accessor instead of this.
1191 media::mojom::RemoterFactoryPtr remoter_factory_;
1192
[email protected]4b556cf2014-06-10 23:21:531193#if defined(ENABLE_BROWSER_CDMS)
1194 // Manage all CDMs in this render frame for communicating with the real CDM in
1195 // the browser process. It's okay to use a raw pointer since it's a
1196 // RenderFrameObserver.
[email protected]65f3d1aa2014-05-29 01:57:001197 RendererCdmManager* cdm_manager_;
[email protected]a017938b2014-05-27 21:17:171198#endif
1199
xhwang409e53552016-02-23 00:52:441200 // The CDM and decoder factory attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151201 std::unique_ptr<media::CdmFactory> cdm_factory_;
1202 std::unique_ptr<media::DecoderFactory> decoder_factory_;
xhwangd7180832015-04-03 05:38:151203
hubbe5f0ad43b2015-12-14 20:57:261204 // Media resource cache, lazily initialized.
1205 linked_ptr<media::UrlIndex> url_index_;
1206
dgozman358ba322015-03-26 15:05:301207 // The devtools agent for this frame; only created for main frame and
1208 // local roots.
1209 DevToolsAgent* devtools_agent_;
1210
[email protected]45920862014-07-02 12:53:021211 // The push messaging dispatcher attached to this frame, lazily initialized.
1212 PushMessagingDispatcher* push_messaging_dispatcher_;
1213
avayvodbca35fad2015-01-29 20:20:571214 // The presentation dispatcher implementation attached to this frame, lazily
1215 // initialized.
1216 PresentationDispatcher* presentation_dispatcher_;
1217
ben155ecf82016-06-21 22:43:261218 std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
1219 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
ben88716142016-07-30 00:03:031220 std::unique_ptr<BlinkInterfaceProviderImpl> blink_interface_provider_;
ben155ecf82016-06-21 22:43:261221 shell::mojom::InterfaceProviderRequest
1222 pending_remote_interface_provider_request_;
[email protected]c52a1412014-06-25 06:09:251223
rockotd9260982015-08-21 22:26:301224 // The shell proxy used to connect to Mojo applications.
rockotb00e6462016-04-14 02:24:031225 shell::mojom::ConnectorPtr connector_;
rockotd9260982015-08-21 22:26:301226
[email protected]45920862014-07-02 12:53:021227 // The screen orientation dispatcher attached to the frame, lazily
1228 // initialized.
[email protected]cf78eda2014-06-13 16:57:411229 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
1230
mlamouriefdca9d2014-09-16 16:55:401231 // The Manifest Manager handles the manifest requests from the browser
1232 // process.
1233 ManifestManager* manifest_manager_;
1234
[email protected]95640212014-07-26 18:14:301235 // The current accessibility mode.
1236 AccessibilityMode accessibility_mode_;
1237
1238 // Only valid if |accessibility_mode_| is anything other than
1239 // AccessibilityModeOff.
dmazzoni8e6fe4d2016-06-27 06:35:371240 RenderAccessibilityImpl* render_accessibility_;
[email protected]95640212014-07-26 18:14:301241
dchengcedca5612016-04-09 01:40:151242 std::unique_ptr<blink::WebAppBannerClient> app_banner_client_;
benwells04ab5b962015-05-06 08:29:401243
dchengcedca5612016-04-09 01:40:151244 std::unique_ptr<blink::WebBluetooth> bluetooth_;
jyasskinf89a11b2015-07-21 00:27:481245
dalecurtisa12e6062015-11-10 23:13:141246 // Manages play, pause notifications for WebMediaPlayer implementations; its
1247 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface.
1248 media::RendererWebMediaPlayerDelegate* media_player_delegate_;
1249
megjablond5ac7d52015-10-22 23:56:121250 // Whether or not this RenderFrame is using Lo-Fi mode.
1251 bool is_using_lofi_;
1252
tbansal7b6cf8b2016-05-10 19:27:231253 // Effective connection type when the document of this frame was fetched.
1254 blink::WebEffectiveConnectionType effective_connection_type_;
1255
ellyjonesdb20fae12015-12-04 16:47:551256 // Whether or not this RenderFrame is currently pasting.
1257 bool is_pasting_;
1258
avi6b8dbb32016-04-08 18:59:351259 // Whether we must stop creating nested message loops for modal dialogs. This
1260 // is necessary because modal dialogs have a ScopedPageLoadDeferrer on the
1261 // stack that interferes with swapping out.
1262 bool suppress_further_dialogs_;
1263
naskoada75b22016-06-11 16:09:461264 // The current and pending file chooser completion objects. If the queue is
1265 // nonempty, the first item represents the currently running file chooser
1266 // callback, and the remaining elements are the other file chooser completion
1267 // still waiting to be run (in order).
1268 struct PendingFileChooser;
1269 std::deque<std::unique_ptr<PendingFileChooser>> file_chooser_completions_;
1270
haibinluc643d33c2016-06-03 02:22:341271#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:141272 // The external popup for the currently showing select popup.
dchengcedca5612016-04-09 01:40:151273 std::unique_ptr<ExternalPopupMenu> external_popup_menu_;
avi485e5fd62014-08-25 23:26:141274#endif
1275
xiaochengh01c3b102016-06-13 23:56:081276 std::unique_ptr<FrameBlameContext> blame_context_;
skyostilb4cce1b2016-03-31 17:56:341277
lfge0c2792ec2016-05-11 18:52:081278 // Plugins -------------------------------------------------------------------
1279#if defined(ENABLE_PLUGINS)
1280 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
1281 PepperPluginSet active_pepper_instances_;
1282
1283 // Whether or not the focus is on a PPAPI plugin
1284 PepperPluginInstanceImpl* focused_pepper_plugin_;
1285
1286 // The plugin instance that received the last mouse event. It is set to NULL
1287 // if the last mouse event went to elements other than Pepper plugins.
1288 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on
1289 // the RenderFrameImpl to NULL it out when it destructs.
1290 PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
1291#endif
1292
ben76f52b242016-06-18 05:42:481293 mojo::Binding<mojom::Frame> frame_binding_;
1294 mojom::FrameHostPtr frame_host_;
1295
ahesteacad602016-08-30 21:25:541296 // Indicates whether |didAccessInitialDocument| was called.
1297 bool has_accessed_initial_document_;
1298
rockotf62002a2016-09-15 00:08:591299 AssociatedInterfaceRegistryImpl associated_interfaces_;
1300 std::unique_ptr<AssociatedInterfaceProviderImpl>
1301 remote_associated_interfaces_;
1302
[email protected]96307312014-05-04 01:00:191303 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1304
[email protected]227692c52013-05-31 22:43:041305 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1306};
1307
1308} // namespace content
1309
[email protected]85d85fd2013-06-19 00:57:411310#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_