blob: 35ff78529613bbad3c1aaf450a77bfc8362c99da [file] [log] [blame]
[email protected]227692c52013-05-31 22:43:041// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
6#define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
7
[email protected]7a4e2532013-12-02 21:30:028#include <vector>
9
[email protected]227692c52013-05-31 22:43:0410#include "base/basictypes.h"
[email protected]7a4e2532013-12-02 21:30:0211#include "base/files/file_path.h"
[email protected]a09d53ce2014-01-31 00:46:4212#include "base/gtest_prod_util.h"
13#include "base/id_map.h"
xhwang430baee2015-01-22 05:46:2014#include "base/memory/scoped_ptr.h"
[email protected]abc501e2014-01-27 19:27:2615#include "base/memory/weak_ptr.h"
[email protected]2e2d9632013-12-03 00:55:2616#include "base/observer_list.h"
[email protected]7a4e2532013-12-02 21:30:0217#include "base/process/process_handle.h"
[email protected]95640212014-07-26 18:14:3018#include "content/common/accessibility_mode_enums.h"
clamyda97e8322014-10-07 21:57:2519#include "content/common/frame_message_enums.h"
[email protected]c52a1412014-06-25 06:09:2520#include "content/common/mojo/service_registry_impl.h"
[email protected]87de04b02014-04-08 22:14:4921#include "content/public/common/javascript_message_type.h"
[email protected]65920f332014-03-04 21:14:1822#include "content/public/common/referrer.h"
[email protected]227692c52013-05-31 22:43:0423#include "content/public/renderer/render_frame.h"
[email protected]5a7100d2014-05-19 01:29:0424#include "content/renderer/render_frame_proxy.h"
[email protected]f3add922013-12-20 23:17:1625#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0426#include "ipc/ipc_message.h"
acolwell9e0840d2014-09-06 19:01:3227#include "media/blink/webmediaplayer_delegate.h"
benwells04ab5b962015-05-06 08:29:4028#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h"
[email protected]95640212014-07-26 18:14:3029#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4130#include "third_party/WebKit/public/web/WebDataSource.h"
31#include "third_party/WebKit/public/web/WebFrameClient.h"
[email protected]680575542014-04-03 17:12:5232#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
twellington376424ad2015-05-04 18:57:2533#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
zhenwd47fd722014-11-13 00:43:4734#include "third_party/WebKit/public/web/WebTransitionElementData.h"
[email protected]4ee64622014-03-21 22:34:1535#include "ui/gfx/range/range.h"
[email protected]227692c52013-05-31 22:43:0436
tommyclid481c482014-12-03 01:50:4137#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3838#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4139#endif
40
[email protected]a017938b2014-05-27 21:17:1741#if defined(OS_ANDROID)
42#include "content/renderer/media/android/renderer_media_player_manager.h"
43#endif
44
clamy9bfeef42014-09-30 20:50:4245class GURL;
[email protected]7a4e2532013-12-02 21:30:0246class TransportDIB;
zhenw70986bd2014-10-20 18:50:2647struct FrameHostMsg_AddNavigationTransitionData_Params;
kenrba7199832015-01-22 23:44:5948struct FrameMsg_NewFrame_WidgetParams;
alexmose7da5a12015-04-09 02:22:1649struct FrameMsg_PostMessage_Params;
dspelle736c9db2015-04-03 04:53:1650struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0251
52namespace blink {
[email protected]5ee7f182014-04-25 19:45:2653class WebGeolocationClient;
[email protected]7a4e2532013-12-02 21:30:0254class WebMouseEvent;
[email protected]82ce5b92014-03-22 05:15:2655class WebContentDecryptionModule;
[email protected]96307312014-05-04 01:00:1956class WebMediaPlayer;
avayvodbca35fad2015-01-29 20:20:5757class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0258class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2659class WebSecurityOrigin;
[email protected]7a4e2532013-12-02 21:30:0260struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4261struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0262struct WebCursorInfo;
zhenwd47fd722014-11-13 00:43:4763struct WebTransitionElementData;
[email protected]7a4e2532013-12-02 21:30:0264}
65
66namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4267class Point;
[email protected]7a4e2532013-12-02 21:30:0268class Range;
69class Rect;
70}
71
jrummell109c3a602014-12-18 01:08:5072namespace media {
xhwangd7180832015-04-03 05:38:1573class CdmFactory;
xhwang60b430a2015-02-01 05:20:4674class MediaPermission;
jrummell109c3a602014-12-18 01:08:5075class WebEncryptedMediaClientImpl;
76}
77
[email protected]227692c52013-05-31 22:43:0478namespace content {
79
[email protected]bffc8302014-01-23 20:52:1680class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:5981class CompositorDependencies;
dgozman358ba322015-03-26 15:05:3082class DevToolsAgent;
avi0392dbf52015-03-25 16:55:4583class DocumentState;
avi485e5fd62014-08-25 23:26:1484class ExternalPopupMenu;
[email protected]8eae0802014-06-02 21:35:5585class GeolocationDispatcher;
mlamouriefdca9d2014-09-16 16:55:4086class ManifestManager;
[email protected]977db4a42014-07-17 08:04:3287class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:0888class MediaStreamRendererFactory;
xhwang36b1f3b2015-01-27 17:54:0189class MediaPermissionDispatcher;
[email protected]52d3e172014-06-16 16:57:0290class MidiDispatcher;
avi0392dbf52015-03-25 16:55:4591class NavigationState;
[email protected]4459599e2014-07-29 22:40:0992class NotificationPermissionDispatcher;
clamyda97e8322014-10-07 21:57:2593class PageState;
[email protected]7a4e2532013-12-02 21:30:0294class PepperPluginInstanceImpl;
mlamouric6d31db2015-03-28 17:48:1495class PermissionDispatcher;
avayvodbca35fad2015-01-29 20:20:5796class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:0297class PushMessagingDispatcher;
xhwangd7180832015-04-03 05:38:1598class RenderCdmFactory;
[email protected]95640212014-07-26 18:14:3099class RendererAccessibility;
[email protected]4b556cf2014-06-10 23:21:53100class RendererCdmManager;
101class RendererMediaPlayerManager;
[email protected]7a4e2532013-12-02 21:30:02102class RendererPpapiHost;
[email protected]2e2d9632013-12-03 00:55:26103class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04104class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02105class RenderWidget;
106class RenderWidgetFullscreenPepper;
[email protected]cf78eda2014-06-13 16:57:41107class ScreenOrientationDispatcher;
perkj1a2d0432014-09-03 13:52:33108class UserMediaClientImpl;
alexmose48b1df932015-01-16 01:34:17109enum class SandboxFlags;
clamy9bfeef42014-09-30 20:50:42110struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42111struct CustomContextMenuContext;
alexmosbc7eafa2014-12-06 01:38:09112struct FrameReplicationState;
avi0392dbf52015-03-25 16:55:45113struct NavigationParams;
clamy79b3da62014-10-14 08:50:37114struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04115struct ResourceResponseHead;
clamy34e12782015-03-12 11:26:13116struct StartNavigationParams;
clamyd6983032015-04-29 14:48:12117struct StreamOverrideParameters;
[email protected]227692c52013-05-31 22:43:04118
[email protected]85d85fd2013-06-19 00:57:41119class CONTENT_EXPORT RenderFrameImpl
120 : public RenderFrame,
[email protected]96307312014-05-04 01:00:19121 NON_EXPORTED_BASE(public blink::WebFrameClient),
acolwell9e0840d2014-09-06 19:01:32122 NON_EXPORTED_BASE(public media::WebMediaPlayerDelegate) {
[email protected]227692c52013-05-31 22:43:04123 public:
[email protected]2f61bdd2013-07-02 18:38:47124 // Creates a new RenderFrame. |render_view| is the RenderView object that this
125 // frame belongs to.
[email protected]b70da4c2014-01-06 19:57:09126 // Callers *must* call |SetWebFrame| immediately after creation.
[email protected]82307f6b2014-08-07 03:30:12127 // Note: This is called only when RenderFrame is created by Blink through
128 // createChildFrame.
[email protected]b70da4c2014-01-06 19:57:09129 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed.
[email protected]2f61bdd2013-07-02 18:38:47130 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
131
[email protected]82307f6b2014-08-07 03:30:12132 // Creates a new RenderFrame with |routing_id| as a child of the RenderFrame
133 // identified by |parent_routing_id| or as the top-level frame if the latter
japhete6adf142014-10-31 00:01:49134 // is MSG_ROUTING_NONE. If |proxy_routing_id| is MSG_ROUTING_NONE, it creates
pimane94c7ac2015-05-05 22:30:41135 // the Blink WebLocalFrame and inserts it in the proper place in the frame
136 // tree. Otherwise, the frame is semi-orphaned until it commits, at which
137 // point it replaces the proxy identified by |proxy_routing_id|.
138 // Note: This is called only when RenderFrame is being created in response to
139 // IPC message from the browser process. All other frame creation is driven
140 // through Blink and Create.
japhete6adf142014-10-31 00:01:49141 static void CreateFrame(int routing_id,
142 int parent_routing_id,
alexmose48b1df932015-01-16 01:34:17143 int proxy_routing_id,
kenrba7199832015-01-22 23:44:59144 const FrameReplicationState& replicated_state,
145 CompositorDependencies* compositor_deps,
146 const FrameMsg_NewFrame_WidgetParams& params);
[email protected]82307f6b2014-08-07 03:30:12147
[email protected]5a7100d2014-05-19 01:29:04148 // Returns the RenderFrameImpl for the given routing ID.
149 static RenderFrameImpl* FromRoutingID(int routing_id);
150
[email protected]a5ac6dc2014-01-15 07:02:14151 // Just like RenderFrame::FromWebFrame but returns the implementation.
152 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09153
[email protected]2f61bdd2013-07-02 18:38:47154 // Used by content_layouttest_support to hook into the creation of
155 // RenderFrameImpls.
dongseong.hwangb721ddf2014-12-10 21:22:50156 using CreateRenderFrameImplFunction = RenderFrameImpl* (*)(RenderViewImpl*,
157 int32);
[email protected]2f61bdd2013-07-02 18:38:47158 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50159 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47160
alexmose48b1df932015-01-16 01:34:17161 static content::SandboxFlags WebToContentSandboxFlags(
162 blink::WebSandboxFlags flags);
163
164 static blink::WebSandboxFlags ContentToWebSandboxFlags(
165 content::SandboxFlags flags);
166
[email protected]227692c52013-05-31 22:43:04167 virtual ~RenderFrameImpl();
168
[email protected]b70da4c2014-01-06 19:57:09169 bool is_swapped_out() const {
170 return is_swapped_out_;
171 }
172
[email protected]5a7100d2014-05-19 01:29:04173 // TODO(nasko): This can be removed once we don't have a swapped out state on
174 // RenderFrames. See https://crbug.com/357747.
175 void set_render_frame_proxy(RenderFrameProxy* proxy) {
176 render_frame_proxy_ = proxy;
177 }
178
[email protected]bffc8302014-01-23 20:52:16179 // Out-of-process child frames receive a signal from RenderWidgetCompositor
180 // when a compositor frame has committed.
181 void DidCommitCompositorFrame();
182
[email protected]7a4e2532013-12-02 21:30:02183 // TODO(jam): this is a temporary getter until all the code is transitioned
184 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26185 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02186
[email protected]f3add922013-12-20 23:17:16187 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
188
[email protected]7a4e2532013-12-02 21:30:02189 // Returns the RenderWidget associated with this frame.
190 RenderWidget* GetRenderWidget();
191
dgozmancf9039cd2015-04-06 12:01:31192 DevToolsAgent* devtools_agent() { return devtools_agent_; }
193
[email protected]35b2a972014-04-04 15:50:22194 // This is called right after creation with the WebLocalFrame for this
[email protected]0287e762014-04-11 13:07:58195 // RenderFrame. It must be called before Initialize.
[email protected]35b2a972014-04-04 15:50:22196 void SetWebFrame(blink::WebLocalFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09197
[email protected]0287e762014-04-11 13:07:58198 // This method must be called after the frame has been added to the frame
199 // tree. It creates all objects that depend on the frame being at its proper
200 // spot.
201 void Initialize();
202
[email protected]de3c5d82014-05-28 22:12:59203 // Notifications from RenderWidget.
204 void WasHidden();
205 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31206 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59207
[email protected]723971b2014-02-12 11:08:25208 // Start/Stop loading notifications.
209 // TODO(nasko): Those are page-level methods at this time and come from
210 // WebViewClient. We should move them to be WebFrameClient calls and put
211 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09212 // |to_different_document| will be true unless the load is a fragment
213 // navigation, or triggered by history.pushState/replaceState.
[email protected]6dd5c322014-03-12 07:58:46214 virtual void didStartLoading(bool to_different_document);
215 virtual void didStopLoading();
216 virtual void didChangeLoadProgress(double load_progress);
[email protected]723971b2014-02-12 11:08:25217
[email protected]95640212014-07-26 18:14:30218 AccessibilityMode accessibility_mode() {
219 return accessibility_mode_;
220 }
221
222 RendererAccessibility* renderer_accessibility() {
223 return renderer_accessibility_;
224 }
225
226 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
227 blink::WebAXEvent event);
228
estade31c54342015-01-23 03:34:36229 // The focused node changed to |node|. If focus was lost from this frame,
230 // |node| will be null.
[email protected]95640212014-07-26 18:14:30231 void FocusedNodeChanged(const blink::WebNode& node);
232
estade31c54342015-01-23 03:34:36233 // TODO(dmazzoni): the only reason this is here is to plumb it through to
234 // RendererAccessibility. It should use the RenderFrameObserver method, once
235 // blink has a separate accessibility tree per frame.
236 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
237
[email protected]7a4e2532013-12-02 21:30:02238#if defined(ENABLE_PLUGINS)
[email protected]271ff5792013-12-04 22:29:31239 // Notification that a PPAPI plugin has been created.
240 void PepperPluginCreated(RendererPpapiHost* host);
241
[email protected]7a4e2532013-12-02 21:30:02242 // Notifies that |instance| has changed the cursor.
243 // This will update the cursor appearance if it is currently over the plugin
244 // instance.
245 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
246 const blink::WebCursorInfo& cursor);
247
248 // Notifies that |instance| has received a mouse event.
249 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
250
[email protected]7a4e2532013-12-02 21:30:02251 // Informs the render view that a PPAPI plugin has changed text input status.
252 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
253 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
254
255 // Cancels current composition.
256 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
257
258 // Informs the render view that a PPAPI plugin has changed selection.
259 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
260
261 // Creates a fullscreen container for a pepper plugin instance.
262 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
263 PepperPluginInstanceImpl* plugin);
264
[email protected]7a4e2532013-12-02 21:30:02265 bool IsPepperAcceptingCompositionEvents() const;
266
267 // Notification that the given plugin has crashed.
268 void PluginCrashed(const base::FilePath& plugin_path,
269 base::ProcessId plugin_pid);
270
[email protected]7a4e2532013-12-02 21:30:02271 // Simulates IME events for testing purpose.
272 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26273 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02274 const std::vector<blink::WebCompositionUnderline>& underlines,
275 int selection_start,
276 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26277 void SimulateImeConfirmComposition(const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02278 const gfx::Range& replacement_range);
279
280 // TODO(jam): remove these once the IPC handler moves from RenderView to
281 // RenderFrame.
282 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42283 const base::string16& text,
284 const std::vector<blink::WebCompositionUnderline>& underlines,
285 int selection_start,
286 int selection_end);
287 void OnImeConfirmComposition(const base::string16& text,
288 const gfx::Range& replacement_range,
289 bool keep_selection);
290#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02291
[email protected]977db4a42014-07-17 08:04:32292 // May return NULL in some cases, especially if userMediaClient() returns
293 // NULL.
294 MediaStreamDispatcher* GetMediaStreamDispatcher();
295
avi485e5fd62014-08-25 23:26:14296#if defined(OS_MACOSX) || defined(OS_ANDROID)
297 void DidHideExternalPopupMenu();
298#endif
299
[email protected]227692c52013-05-31 22:43:04300 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52301 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04302
303 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52304 bool OnMessageReceived(const IPC::Message& msg) override;
[email protected]227692c52013-05-31 22:43:04305
[email protected]271ff5792013-12-04 22:29:31306 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52307 RenderView* GetRenderView() override;
308 int GetRoutingID() override;
309 blink::WebLocalFrame* GetWebFrame() override;
estade78d655f82015-01-30 01:55:08310 blink::WebElement GetFocusedElement() const override;
dcheng6d18e402014-10-21 12:32:52311 WebPreferences& GetWebkitPreferences() override;
312 int ShowContextMenu(ContextMenuClient* client,
313 const ContextMenuParams& params) override;
314 void CancelContextMenu(int request_id) override;
315 blink::WebNode GetContextMenuNode() const override;
tommycli59bd86c2014-12-10 02:09:38316 blink::WebPlugin* CreatePlugin(
317 blink::WebFrame* frame,
318 const WebPluginInfo& info,
319 const blink::WebPluginParams& params,
tommyclie8722702015-01-16 11:40:41320 scoped_ptr<PluginInstanceThrottler> throttler) override;
dcheng6d18e402014-10-21 12:32:52321 void LoadURLExternally(blink::WebLocalFrame* frame,
322 const blink::WebURLRequest& request,
323 blink::WebNavigationPolicy policy) override;
324 void ExecuteJavaScript(const base::string16& javascript) override;
325 bool IsHidden() override;
326 ServiceRegistry* GetServiceRegistry() override;
tommyclid481c482014-12-03 01:50:41327#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38328 void RegisterPeripheralPlugin(
329 const GURL& content_origin,
330 const base::Closure& unthrottle_callback) override;
tommyclid7798e12015-02-09 21:08:56331 PluginPowerSaverHelper* plugin_power_saver_helper() {
332 return plugin_power_saver_helper_;
333 }
tommyclid481c482014-12-03 01:50:41334#endif
dcheng6d18e402014-10-21 12:32:52335 bool IsFTPDirectoryListing() override;
336 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52337 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52338 void SetSelectedText(const base::string16& selection_text,
339 size_t offset,
340 const gfx::Range& range) override;
341 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19342 v8::Local<v8::Context> context) override;
[email protected]271ff5792013-12-04 22:29:31343
[email protected]96307312014-05-04 01:00:19344 // blink::WebFrameClient implementation:
jbroman73e9f7962014-10-30 00:43:45345 blink::WebPluginPlaceholder* createPluginPlaceholder(
346 blink::WebLocalFrame*,
347 const blink::WebPluginParams&) override;
[email protected]35b2a972014-04-04 15:50:22348 virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
349 const blink::WebPluginParams& params);
jrummell65b7d272014-09-24 20:49:27350 // TODO(jrummell): Remove this method once blink updated.
[email protected]180ef242013-11-07 06:50:46351 virtual blink::WebMediaPlayer* createMediaPlayer(
[email protected]35b2a972014-04-04 15:50:22352 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46353 const blink::WebURL& url,
354 blink::WebMediaPlayerClient* client);
jrummell65b7d272014-09-24 20:49:27355 virtual blink::WebMediaPlayer* createMediaPlayer(
356 blink::WebLocalFrame* frame,
357 const blink::WebURL& url,
358 blink::WebMediaPlayerClient* client,
359 blink::WebContentDecryptionModule* initial_cdm);
[email protected]180ef242013-11-07 06:50:46360 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
[email protected]35b2a972014-04-04 15:50:22361 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46362 blink::WebApplicationCacheHostClient* client);
mlamouria5b294552015-03-09 16:16:36363 virtual blink::WebWorkerContentSettingsClientProxy*
364 createWorkerContentSettingsClientProxy(blink::WebLocalFrame* frame);
[email protected]b20c3222014-08-22 00:50:22365 virtual blink::WebExternalPopupMenu* createExternalPopupMenu(
366 const blink::WebPopupMenuInfo& popup_menu_info,
367 blink::WebExternalPopupMenuClient* popup_menu_client);
[email protected]35b2a972014-04-04 15:50:22368 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame);
[email protected]180ef242013-11-07 06:50:46369 virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider(
[email protected]35b2a972014-04-04 15:50:22370 blink::WebLocalFrame* frame);
371 virtual void didAccessInitialDocument(blink::WebLocalFrame* frame);
alexmose48b1df932015-01-16 01:34:17372 virtual blink::WebFrame* createChildFrame(
373 blink::WebLocalFrame* parent,
374 const blink::WebString& name,
375 blink::WebSandboxFlags sandboxFlags);
[email protected]35b2a972014-04-04 15:50:22376 virtual void didDisownOpener(blink::WebLocalFrame* frame);
[email protected]180ef242013-11-07 06:50:46377 virtual void frameDetached(blink::WebFrame* frame);
[email protected]9c9343b2014-03-08 02:56:07378 virtual void frameFocused();
[email protected]180ef242013-11-07 06:50:46379 virtual void willClose(blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22380 virtual void didChangeName(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46381 const blink::WebString& name);
alexmos6b294562015-03-05 19:24:10382 virtual void didChangeSandboxFlags(blink::WebFrame* child_frame,
383 blink::WebSandboxFlags flags);
[email protected]f5b6dd1122013-10-04 02:42:50384 virtual void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22385 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46386 const blink::WebVector<blink::WebString>& newly_matching_selectors,
387 const blink::WebVector<blink::WebString>& stopped_matching_selectors);
[email protected]c31a84802014-04-03 15:55:49388 virtual bool shouldReportDetailedMessageForSource(
389 const blink::WebString& source);
390 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
391 const blink::WebString& source_name,
392 unsigned source_line,
393 const blink::WebString& stack_trace);
[email protected]35b2a972014-04-04 15:50:22394 virtual void loadURLExternally(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46395 const blink::WebURLRequest& request,
[email protected]35b2a972014-04-04 15:50:22396 blink::WebNavigationPolicy policy,
397 const blink::WebString& suggested_name);
[email protected]1a4e9752013-12-31 20:10:58398 // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass.
[email protected]180ef242013-11-07 06:50:46399 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
[email protected]0c3c54f2014-07-31 01:29:00400 const NavigationPolicyInfo& info);
[email protected]680575542014-04-03 17:12:52401 virtual blink::WebHistoryItem historyItemForNewChildFrame(
402 blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22403 virtual void willSendSubmitEvent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46404 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22405 virtual void willSubmitForm(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46406 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22407 virtual void didCreateDataSource(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46408 blink::WebDataSource* datasource);
[email protected]0c3c54f2014-07-31 01:29:00409 virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame,
japhet69a06302014-12-12 19:37:14410 bool is_transition_navigation,
411 double triggering_event_time);
[email protected]85d85fd2013-06-19 00:57:41412 virtual void didReceiveServerRedirectForProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22413 blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41414 virtual void didFailProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22415 blink::WebLocalFrame* frame,
avibe2d51d2015-03-31 00:21:17416 const blink::WebURLError& error,
417 blink::WebHistoryCommitType commit_type);
[email protected]680575542014-04-03 17:12:52418 virtual void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22419 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52420 const blink::WebHistoryItem& item,
421 blink::WebHistoryCommitType commit_type);
rob5ef11ff2014-11-17 23:56:20422 virtual void didCreateNewDocument(blink::WebLocalFrame* frame);
[email protected]06181e52014-05-10 11:59:09423 virtual void didClearWindowObject(blink::WebLocalFrame* frame);
[email protected]35b2a972014-04-04 15:50:22424 virtual void didCreateDocumentElement(blink::WebLocalFrame* frame);
425 virtual void didReceiveTitle(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46426 const blink::WebString& title,
427 blink::WebTextDirection direction);
[email protected]35b2a972014-04-04 15:50:22428 virtual void didChangeIcon(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46429 blink::WebIconURL::Type icon_type);
[email protected]35b2a972014-04-04 15:50:22430 virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame);
431 virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame);
432 virtual void didFailLoad(blink::WebLocalFrame* frame,
avibe2d51d2015-03-31 00:21:17433 const blink::WebURLError& error,
434 blink::WebHistoryCommitType commit_type);
[email protected]45d877f2014-04-05 07:36:22435 virtual void didFinishLoad(blink::WebLocalFrame* frame);
436 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52437 const blink::WebHistoryItem& item,
438 blink::WebHistoryCommitType commit_type);
[email protected]35b2a972014-04-04 15:50:22439 virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
[email protected]9e6bea412014-08-08 06:35:25440 virtual void addNavigationTransitionData(
zhenwd47fd722014-11-13 00:43:47441 const blink::WebTransitionElementData& data);
[email protected]37b64c52014-07-11 21:14:05442 virtual void didChangeThemeColor();
alexmosf40ce5b02015-02-25 20:19:56443 virtual void dispatchLoad();
[email protected]4459599e2014-07-29 22:40:09444 virtual void requestNotificationPermission(
445 const blink::WebSecurityOrigin& origin,
446 blink::WebNotificationPermissionCallback* callback);
[email protected]c3f2c702014-03-19 23:39:48447 virtual void didChangeSelection(bool is_empty_selection);
[email protected]f3c59d62014-04-09 16:33:55448 virtual blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19449 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55450 const blink::WebColor& initial_color,
451 const blink::WebVector<blink::WebColorSuggestion>& suggestions);
[email protected]87de04b02014-04-08 22:14:49452 virtual void runModalAlertDialog(const blink::WebString& message);
453 virtual bool runModalConfirmDialog(const blink::WebString& message);
454 virtual bool runModalPromptDialog(const blink::WebString& message,
455 const blink::WebString& default_value,
456 blink::WebString* actual_value);
457 virtual bool runModalBeforeUnloadDialog(bool is_reload,
458 const blink::WebString& message);
[email protected]12cc5112014-03-03 17:01:10459 virtual void showContextMenu(const blink::WebContextMenuData& data);
[email protected]91070342014-03-07 00:29:02460 virtual void clearContextMenu();
[email protected]35b2a972014-04-04 15:50:22461 virtual void willSendRequest(blink::WebLocalFrame* frame,
462 unsigned identifier,
463 blink::WebURLRequest& request,
464 const blink::WebURLResponse& redirect_response);
465 virtual void didReceiveResponse(blink::WebLocalFrame* frame,
466 unsigned identifier,
467 const blink::WebURLResponse& response);
468 virtual void didFinishResourceLoad(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14469 unsigned identifier);
[email protected]85d85fd2013-06-19 00:57:41470 virtual void didLoadResourceFromMemoryCache(
[email protected]35b2a972014-04-04 15:50:22471 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46472 const blink::WebURLRequest& request,
473 const blink::WebURLResponse& response);
[email protected]35b2a972014-04-04 15:50:22474 virtual void didDisplayInsecureContent(blink::WebLocalFrame* frame);
475 virtual void didRunInsecureContent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46476 const blink::WebSecurityOrigin& origin,
477 const blink::WebURL& target);
[email protected]35b2a972014-04-04 15:50:22478 virtual void didAbortLoading(blink::WebLocalFrame* frame);
479 virtual void didCreateScriptContext(blink::WebLocalFrame* frame,
deepak.s750d68f2015-04-30 07:32:41480 v8::Local<v8::Context> context,
[email protected]85d85fd2013-06-19 00:57:41481 int extension_group,
[email protected]255eea092013-06-28 17:19:14482 int world_id);
[email protected]35b2a972014-04-04 15:50:22483 virtual void willReleaseScriptContext(blink::WebLocalFrame* frame,
deepak.s750d68f2015-04-30 07:32:41484 v8::Local<v8::Context> context,
[email protected]255eea092013-06-28 17:19:14485 int world_id);
[email protected]35b2a972014-04-04 15:50:22486 virtual void didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame* frame);
[email protected]35b2a972014-04-04 15:50:22487 virtual void didChangeScrollOffset(blink::WebLocalFrame* frame);
488 virtual void willInsertBody(blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41489 virtual void reportFindInPageMatchCount(int request_id,
490 int count,
[email protected]255eea092013-06-28 17:19:14491 bool final_update);
[email protected]85d85fd2013-06-19 00:57:41492 virtual void reportFindInPageSelection(int request_id,
493 int active_match_ordinal,
[email protected]180ef242013-11-07 06:50:46494 const blink::WebRect& sel);
[email protected]35b2a972014-04-04 15:50:22495 virtual void requestStorageQuota(blink::WebLocalFrame* frame,
496 blink::WebStorageQuotaType type,
497 unsigned long long requested_size,
498 blink::WebStorageQuotaCallbacks callbacks);
[email protected]a14903e02014-06-02 07:35:12499 virtual void willOpenWebSocket(blink::WebSocketHandle* handle);
[email protected]5ee7f182014-04-25 19:45:26500 virtual blink::WebGeolocationClient* geolocationClient();
[email protected]45920862014-07-02 12:53:02501 virtual blink::WebPushClient* pushClient();
avayvodbca35fad2015-01-29 20:20:57502 virtual blink::WebPresentationClient* presentationClient();
[email protected]85d85fd2013-06-19 00:57:41503 virtual void willStartUsingPeerConnectionHandler(
[email protected]35b2a972014-04-04 15:50:22504 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46505 blink::WebRTCPeerConnectionHandler* handler);
[email protected]bfe45e22014-04-25 16:47:53506 virtual blink::WebUserMediaClient* userMediaClient();
jrummell109c3a602014-12-18 01:08:50507 virtual blink::WebEncryptedMediaClient* encryptedMediaClient();
[email protected]8538385f2014-04-25 19:45:04508 virtual blink::WebMIDIClient* webMIDIClient();
[email protected]85d85fd2013-06-19 00:57:41509 virtual bool willCheckAndDispatchMessageEvent(
[email protected]ce5064f2014-05-07 22:49:20510 blink::WebLocalFrame* source_frame,
511 blink::WebFrame* target_frame,
512 blink::WebSecurityOrigin target_origin,
[email protected]180ef242013-11-07 06:50:46513 blink::WebDOMMessageEvent event);
[email protected]35b2a972014-04-04 15:50:22514 virtual blink::WebString userAgentOverride(blink::WebLocalFrame* frame,
515 const blink::WebURL& url);
516 virtual blink::WebString doNotTrackValue(blink::WebLocalFrame* frame);
517 virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value);
518 virtual void didLoseWebGLContext(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14519 int arb_robustness_status_code);
[email protected]cf78eda2014-06-13 16:57:41520 virtual blink::WebScreenOrientationClient* webScreenOrientationClient();
nhirokifebadeed2014-10-29 04:02:47521 virtual bool isControlledByServiceWorker(blink::WebDataSource& data_source);
522 virtual int64_t serviceWorkerID(blink::WebDataSource& data_source);
dmazzoni0b5d2482014-09-10 19:45:57523 virtual void postAccessibilityEvent(const blink::WebAXObject& obj,
524 blink::WebAXEvent event);
dmazzoni1a69e2b32014-11-06 20:34:28525 virtual void handleAccessibilityFindInPageResult(
526 int identifier,
527 int match_index,
528 const blink::WebAXObject& start_object,
529 int start_offset,
530 const blink::WebAXObject& end_object,
531 int end_offset);
mlamouriefdca9d2014-09-16 16:55:40532 virtual void didChangeManifest(blink::WebLocalFrame*);
avayvod5efd9a922015-03-13 15:41:02533 virtual void didChangeDefaultPresentation(blink::WebLocalFrame*);
mlamouri7a78d6fd2015-01-17 13:23:53534 virtual bool enterFullscreen();
535 virtual bool exitFullscreen();
mlamouri670a86d2015-03-17 16:06:25536 virtual blink::WebPermissionClient* permissionClient();
benwells04ab5b962015-05-06 08:29:40537 virtual blink::WebAppBannerClient* appBannerClient();
[email protected]85d85fd2013-06-19 00:57:41538
[email protected]96307312014-05-04 01:00:19539 // WebMediaPlayerDelegate implementation:
dcheng6d18e402014-10-21 12:32:52540 void DidPlay(blink::WebMediaPlayer* player) override;
541 void DidPause(blink::WebMediaPlayer* player) override;
542 void PlayerGone(blink::WebMediaPlayer* player) override;
[email protected]96307312014-05-04 01:00:19543
[email protected]c6bc20332014-02-28 18:30:39544 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
545 // this back to private member.
clamy34e12782015-03-12 11:26:13546 void OnNavigate(const CommonNavigationParams& common_params,
547 const StartNavigationParams& start_params,
clamy57b4b8e2015-03-24 13:32:11548 const RequestNavigationParams& request_params);
[email protected]c6bc20332014-02-28 18:30:39549
nasko78f06bc2014-11-18 18:18:57550 // Make this frame show an empty, unscriptable page.
551 // TODO(nasko): Remove this method once swapped out state is no longer used.
552 void NavigateToSwappedOutURL();
553
rockot775ce0d2015-01-27 18:35:01554 // Binds this render frame's service registry.
[email protected]c52a1412014-06-25 06:09:25555 void BindServiceRegistry(
rockot775ce0d2015-01-27 18:35:01556 mojo::InterfaceRequest<mojo::ServiceProvider> services,
557 mojo::ServiceProviderPtr exposed_services);
[email protected]c52a1412014-06-25 06:09:25558
mlamouri4fff1992014-09-30 11:22:46559 ManifestManager* manifest_manager();
560
avi0392dbf52015-03-25 16:55:45561 // TODO(creis): Remove when the only caller, the HistoryController, is no
562 // more.
563 void SetPendingNavigationParams(
564 scoped_ptr<NavigationParams> navigation_params);
565
[email protected]2f61bdd2013-07-02 18:38:47566 protected:
567 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
568
[email protected]227692c52013-05-31 22:43:04569 private:
kenrbf98a4d22015-04-01 21:59:35570 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26571 friend class RenderFrameObserver;
clamy5c7ede52015-04-09 11:32:24572 friend class RenderViewImplTest;
[email protected]95640212014-07-26 18:14:30573 friend class RendererAccessibilityTest;
avi485e5fd62014-08-25 23:26:14574 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
575 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
576 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
577 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]66bbadaf2014-03-28 16:25:54578 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
579 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]2e2d9632013-12-03 00:55:26580
twellington376424ad2015-05-04 18:57:25581 // A wrapper class used as the callback for JavaScript executed
582 // in an isolated world.
583 class JavaScriptIsolatedWorldRequest
584 : public blink::WebScriptExecutionCallback {
585 public:
586 JavaScriptIsolatedWorldRequest(
587 int id,
588 bool notify_result,
589 int routing_id,
590 base::WeakPtr<RenderFrameImpl> render_frame_impl);
591 void completed(
592 const blink::WebVector<v8::Local<v8::Value>>& result) override;
593
594 private:
595 ~JavaScriptIsolatedWorldRequest();
596
597 int id_;
598 bool notify_result_;
599 int routing_id_;
600 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
601
602 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
603 };
604
[email protected]37567b432014-02-12 01:12:22605 typedef std::map<GURL, double> HostZoomLevels;
606
[email protected]2e2d9632013-12-03 00:55:26607 // Functions to add and remove observers for this object.
608 void AddObserver(RenderFrameObserver* observer);
609 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34610
[email protected]f0906a02014-08-07 07:18:55611 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35612 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
613 blink::WebHistoryCommitType commit_type);
[email protected]37567b432014-02-12 01:12:22614
[email protected]b70da4c2014-01-06 19:57:09615 // IPC message handlers ------------------------------------------------------
616 //
617 // The documentation for these functions should be in
618 // content/common/*_messages.h for the message that the function is handling.
[email protected]f76f32232014-03-11 17:36:17619 void OnBeforeUnload();
alexmosbc7eafa2014-12-06 01:38:09620 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56621 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09622 const FrameReplicationState& replicated_frame_state);
Nasko Oskov85f60222014-08-28 22:53:30623 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42624 void OnShowContextMenu(const gfx::Point& location);
625 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
626 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
627 unsigned action);
[email protected]4ee64622014-03-21 22:34:15628 void OnUndo();
629 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07630 void OnCut();
631 void OnCopy();
632 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15633 void OnPasteAndMatchStyle();
634 void OnDelete();
635 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14636 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
[email protected]4ee64622014-03-21 22:34:15637 void OnUnselect();
christiankaeed9862014-11-05 10:49:14638 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17639 void OnReplace(const base::string16& text);
640 void OnReplaceMisspelling(const base::string16& text);
[email protected]e31b8ebb2014-03-07 17:59:34641 void OnCSSInsertRequest(const std::string& css);
[email protected]f13ab892014-03-12 06:48:52642 void OnJavaScriptExecuteRequest(const base::string16& javascript,
643 int id,
644 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28645 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
646 int id,
jochen2e7d95b2015-05-04 15:28:50647 bool notify_result,
648 bool has_user_gesture);
twellington376424ad2015-05-04 18:57:25649 void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
650 int id,
651 bool notify_result,
652 int world_id);
igsolla1cea67b72015-02-11 16:25:04653 void OnVisualStateRequest(uint64 key);
[email protected]4ee64622014-03-21 22:34:15654 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16655 void OnSetCompositionFromExistingText(
656 int start, int end,
657 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24658 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16659 void OnExtendSelectionAndDelete(int before, int after);
[email protected]4fed3702014-04-01 09:08:00660 void OnReload(bool ignore_cache);
[email protected]96bb6132014-06-16 17:22:19661 void OnTextSurroundingSelectionRequest(size_t max_length);
[email protected]2e531f72014-06-20 23:23:39662 void OnAddStyleSheetByURL(const std::string& url);
[email protected]9e6bea412014-08-08 06:35:25663 void OnSetupTransitionView(const std::string& markup);
zhenwe8f14fc2014-11-25 01:00:54664 void OnBeginExitTransition(const std::string& css_selector,
665 bool exit_to_native_app);
zhenw5a707892014-12-10 02:31:03666 void OnRevertExitTransition();
zhenwabf9b9d2014-11-15 04:04:18667 void OnHideTransitionElements(const std::string& css_selector);
668 void OnShowTransitionElements(const std::string& css_selector);
[email protected]95640212014-07-26 18:14:30669 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51670 void OnSnapshotAccessibilityTree(int callback_id);
creisbbbeb062014-08-25 18:20:31671 void OnDisownOpener();
alexmos6b294562015-03-05 19:24:10672 void OnDidUpdateSandboxFlags(SandboxFlags flags);
dspelle736c9db2015-04-03 04:53:16673 void OnTextTrackSettingsChanged(
674 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16675 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
avi485e5fd62014-08-25 23:26:14676#if defined(OS_ANDROID)
677 void OnSelectPopupMenuItems(bool canceled,
678 const std::vector<int>& selected_indices);
679#elif defined(OS_MACOSX)
680 void OnSelectPopupMenuItem(int selected_index);
[email protected]4ee64622014-03-21 22:34:15681 void OnCopyToFindPboard();
682#endif
[email protected]9c9343b2014-03-08 02:56:07683
davidbena5496d62014-10-07 18:52:04684 void OnCommitNavigation(const ResourceResponseHead& response,
685 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42686 const CommonNavigationParams& common_params,
clamy57b4b8e2015-03-24 13:32:11687 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57688 void OnFailedNavigation(const CommonNavigationParams& common_params,
689 const RequestNavigationParams& request_params,
690 bool has_stale_copy_in_cache,
691 int error_code);
clamy9bfeef42014-09-30 20:50:42692
[email protected]65920f332014-03-04 21:14:18693 // Virtual since overridden by WebTestProxy for layout tests.
694 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
695 RenderFrame* render_frame,
[email protected]0c3c54f2014-07-31 01:29:00696 const NavigationPolicyInfo& info);
[email protected]65920f332014-03-04 21:14:18697 void OpenURL(blink::WebFrame* frame,
698 const GURL& url,
699 const Referrer& referrer,
700 blink::WebNavigationPolicy policy);
[email protected]a09d53ce2014-01-31 00:46:42701
clamyd6983032015-04-29 14:48:12702 // Performs a navigation in the frame. This provides a unified function for
703 // the current code path and the browser-side navigation path (in
704 // development). Currently used by OnNavigate, with all *NavigationParams
705 // provided by the browser. |stream_params| should be null.
706 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
707 // |request_params| received by the browser. |stream_params| should be non
708 // null and created from the information provided by the browser.
709 // |start_params| is not used.
710 void NavigateInternal(const CommonNavigationParams& common_params,
711 const StartNavigationParams& start_params,
712 const RequestNavigationParams& request_params,
713 scoped_ptr<StreamOverrideParameters> stream_params);
714
[email protected]ef3adfc2014-05-11 00:04:54715 // Update current main frame's encoding and send it to browser window.
716 // Since we want to let users see the right encoding info from menu
717 // before finishing loading, we call the UpdateEncoding in
718 // a) function:DidCommitLoadForFrame. When this function is called,
719 // that means we have got first data. In here we try to get encoding
720 // of page if it has been specified in http header.
721 // b) function:DidReceiveTitle. When this function is called,
722 // that means we have got specified title. Because in most of webpages,
723 // title tags will follow meta tags. In here we try to get encoding of
724 // page if it has been specified in meta tag.
725 // c) function:DidFinishDocumentLoadForFrame. When this function is
726 // called, that means we have got whole html page. In here we should
727 // finally get right encoding of page.
728 void UpdateEncoding(blink::WebFrame* frame,
729 const std::string& encoding_name);
730
[email protected]4ee64622014-03-21 22:34:15731 // Dispatches the current state of selection on the webpage to the browser if
732 // it has changed.
733 // TODO(varunjain): delete this method once we figure out how to keep
734 // selection handles in sync with the webpage.
735 void SyncSelectionIfRequired();
736
[email protected]87de04b02014-04-08 22:14:49737 bool RunJavaScriptMessage(JavaScriptMessageType type,
738 const base::string16& message,
739 const base::string16& default_value,
740 const GURL& frame_url,
741 base::string16* result);
742
[email protected]457736d2014-04-30 15:54:27743 // Loads the appropriate error page for the specified failure into the frame.
744 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
745 const blink::WebURLError& error,
746 bool replace);
747
zeeshanq3454e9c2014-09-04 21:30:28748 void HandleJavascriptExecutionResult(const base::string16& javascript,
749 int id,
750 bool notify_result,
deepak.s750d68f2015-04-30 07:32:41751 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:28752
[email protected]977db4a42014-07-17 08:04:32753 // Initializes |web_user_media_client_|. If this fails, because it wasn't
754 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
755 // |web_user_media_client_| will remain NULL.
756 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19757
758 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
759 const blink::WebURL& url,
760 blink::WebMediaPlayerClient* client);
761
[email protected]ae2477e2014-05-27 23:47:08762 // Creates a factory object used for creating audio and video renderers.
763 // The method is virtual so that layouttests can override it.
764 virtual scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
765
clamyda97e8322014-10-07 21:57:25766 // Checks that the RenderView is ready to display the navigation to |url|. If
sungmann.cho12349f0e2014-12-05 23:42:19767 // the return value is false, the navigation should be abandoned.
clamyda97e8322014-10-07 21:57:25768 bool PrepareRenderViewForNavigation(
769 const GURL& url,
avi2b177592014-12-10 02:08:02770 bool is_history_navigation,
clamy57b4b8e2015-03-24 13:32:11771 const RequestNavigationParams& request_params,
clamyda97e8322014-10-07 21:57:25772 bool* is_reload,
773 blink::WebURLRequest::CachePolicy* cache_policy);
774
clamyece38882014-11-19 15:00:20775 // PlzNavigate
776 // Sends a FrameHostMsg_BeginNavigation to the browser based on the contents
777 // of the WebURLRequest.
778 void BeginNavigation(blink::WebURLRequest* request);
779
clamy4cc9b8202015-03-02 13:51:36780 // Loads a data url.
781 void LoadDataURL(const CommonNavigationParams& params,
782 blink::WebFrame* frame);
783
clamy62b271d2015-04-16 11:54:57784 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
785 // the failed request |request|.
786 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
787 const blink::WebURLError& error,
788 blink::WebLocalFrame* frame);
789
790 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
791 const GURL& unreachable_url);
792
[email protected]f3a95312014-06-12 16:46:58793 // Returns the URL being loaded by the |frame_|'s request.
794 GURL GetLoadingUrl() const;
795
avi0392dbf52015-03-25 16:55:45796 // If we initiated a navigation, this function will populate |document_state|
797 // with the navigation information saved in OnNavigate().
798 void PopulateDocumentStateFromPending(DocumentState* document_state);
799
800 // Returns a new NavigationState populated with the navigation information
801 // saved in OnNavigate().
802 NavigationState* CreateNavigationStateFromPending();
803
[email protected]96307312014-05-04 01:00:19804#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:00805 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
[email protected]96307312014-05-04 01:00:19806 const blink::WebURL& url,
jrummell65b7d272014-09-24 20:49:27807 blink::WebMediaPlayerClient* client,
xhwang60b430a2015-02-01 05:20:46808 media::MediaPermission* media_permission,
jrummell65b7d272014-09-24 20:49:27809 blink::WebContentDecryptionModule* initial_cdm);
[email protected]a017938b2014-05-27 21:17:17810
[email protected]65f3d1aa2014-05-29 01:57:00811 RendererMediaPlayerManager* GetMediaPlayerManager();
[email protected]4b556cf2014-06-10 23:21:53812#endif
813
xhwangd7180832015-04-03 05:38:15814 media::MediaPermission* GetMediaPermission();
815 media::CdmFactory* GetCdmFactory();
[email protected]96307312014-05-04 01:00:19816
creiscfaa4462015-03-16 19:27:18817 // Stores the WebLocalFrame we are associated with. This is null from the
818 // constructor until SetWebFrame is called, and it is null after
819 // frameDetached is called until destruction (which is asynchronous in the
820 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:22821 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:09822
dgozman358ba322015-03-26 15:05:30823 // Frame is a local root if it is rendered in a process different than parent
824 // or it is a main frame.
825 bool is_local_root_;
826
[email protected]abc501e2014-01-27 19:27:26827 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:04828 int routing_id_;
[email protected]1c2052f2013-08-28 08:24:34829 bool is_swapped_out_;
[email protected]5a7100d2014-05-19 01:29:04830 // RenderFrameProxy exists only when is_swapped_out_ is true.
831 // TODO(nasko): This can be removed once we don't have a swapped out state on
832 // RenderFrame. See https://crbug.com/357747.
833 RenderFrameProxy* render_frame_proxy_;
[email protected]1c2052f2013-08-28 08:24:34834 bool is_detaching_;
[email protected]227692c52013-05-31 22:43:04835
japhete6adf142014-10-31 00:01:49836 // If this frame was created to replace a proxy, this will store the routing
837 // id of the proxy to replace at commit-time, at which time it will be
838 // cleared.
839 // TODO(creis): Remove this after switching to PlzNavigate.
840 int proxy_routing_id_;
841
kenrba7199832015-01-22 23:44:59842 // Used when the RenderFrame is a local root. For now, RenderWidgets are
843 // added only when a child frame is in a different process from its parent
844 // frame, but eventually this will also apply to top-level frames.
845 // TODO(kenrb): Correct the above statement when top-level frames have their
846 // own RenderWidgets.
847 scoped_refptr<RenderWidget> render_widget_;
848
avi0392dbf52015-03-25 16:55:45849 // Temporarily holds state pertaining to a navigation that has been initiated
850 // until the NavigationState corresponding to the new navigation is created in
851 // didCreateDataSource().
852 scoped_ptr<NavigationParams> pending_navigation_params_;
853
[email protected]7a4e2532013-12-02 21:30:02854#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02855 // Current text input composition text. Empty if no composition is in
856 // progress.
[email protected]fcf75d42013-12-03 20:11:26857 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:09858
tommycli59bd86c2014-12-10 02:09:38859 PluginPowerSaverHelper* plugin_power_saver_helper_;
[email protected]7a4e2532013-12-02 21:30:02860#endif
861
[email protected]f3add922013-12-20 23:17:16862 RendererWebCookieJarImpl cookie_jar_;
863
[email protected]2e2d9632013-12-03 00:55:26864 // All the registered observers.
865 ObserverList<RenderFrameObserver> observers_;
866
[email protected]bffc8302014-01-23 20:52:16867 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
868
[email protected]4ecee352014-03-11 21:12:19869 // The node that the context menu was pressed over.
870 blink::WebNode context_menu_node_;
871
[email protected]a09d53ce2014-01-31 00:46:42872 // External context menu requests we're waiting for. "Internal"
873 // (WebKit-originated) context menu events will have an ID of 0 and will not
874 // be in this map.
875 //
876 // We don't want to add internal ones since some of the "special" page
877 // handlers in the browser process just ignore the context menu requests so
878 // avoid showing context menus, and so this will cause right clicks to leak
879 // entries in this map. Most users of the custom context menu (e.g. Pepper
880 // plugins) are normally only on "regular" pages and the regular pages will
881 // always respond properly to the request, so we don't have to worry so
882 // much about leaks.
883 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
884
[email protected]4ee64622014-03-21 22:34:15885 // The text selection the last time DidChangeSelection got called. May contain
886 // additional characters before and after the selected text, for IMEs. The
887 // portion of this string that is the actual selected text starts at index
888 // |selection_range_.GetMin() - selection_text_offset_| and has length
889 // |selection_range_.length()|.
890 base::string16 selection_text_;
891 // The offset corresponding to the start of |selection_text_| in the document.
892 size_t selection_text_offset_;
893 // Range over the document corresponding to the actual selected text (which
894 // could correspond to a substring of |selection_text_|; see above).
895 gfx::Range selection_range_;
896 // Used to inform didChangeSelection() when it is called in the context
897 // of handling a InputMsg_SelectRange IPC.
898 bool handling_select_range_;
899
[email protected]2626d142014-04-22 17:24:02900 // The next group of objects all implement RenderFrameObserver, so are deleted
901 // along with the RenderFrame automatically. This is why we just store weak
902 // references.
903
[email protected]4459599e2014-07-29 22:40:09904 // Dispatches permission requests for Web Notifications.
905 NotificationPermissionDispatcher* notification_permission_dispatcher_;
906
[email protected]977db4a42014-07-17 08:04:32907 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:33908 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:19909
jrummell109c3a602014-12-18 01:08:50910 // EncryptedMediaClient attached to this frame; lazily initialized.
xhwang430baee2015-01-22 05:46:20911 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:50912
xhwang36b1f3b2015-01-27 17:54:01913 // The media permission dispatcher attached to this frame, lazily initialized.
914 MediaPermissionDispatcher* media_permission_dispatcher_;
915
[email protected]52d3e172014-06-16 16:57:02916 // MidiClient attached to this frame; lazily initialized.
917 MidiDispatcher* midi_dispatcher_;
918
[email protected]a017938b2014-05-27 21:17:17919#if defined(OS_ANDROID)
[email protected]4b556cf2014-06-10 23:21:53920 // Manages all media players in this render frame for communicating with the
921 // real media player in the browser process. It's okay to use a raw pointer
922 // since it's a RenderFrameObserver.
[email protected]a017938b2014-05-27 21:17:17923 RendererMediaPlayerManager* media_player_manager_;
[email protected]4b556cf2014-06-10 23:21:53924#endif
925
926#if defined(ENABLE_BROWSER_CDMS)
927 // Manage all CDMs in this render frame for communicating with the real CDM in
928 // the browser process. It's okay to use a raw pointer since it's a
929 // RenderFrameObserver.
[email protected]65f3d1aa2014-05-29 01:57:00930 RendererCdmManager* cdm_manager_;
[email protected]a017938b2014-05-27 21:17:17931#endif
932
xhwangd7180832015-04-03 05:38:15933 // The CDM factory attached to this frame, lazily initialized.
934 RenderCdmFactory* cdm_factory_;
935
[email protected]a6e21c372014-07-12 02:27:21936#if defined(VIDEO_HOLE)
937 // Whether or not this RenderFrameImpl contains a media player. Used to
938 // register as an observer for video-hole-specific events.
939 bool contains_media_player_;
940#endif
941
dgozman358ba322015-03-26 15:05:30942 // The devtools agent for this frame; only created for main frame and
943 // local roots.
944 DevToolsAgent* devtools_agent_;
945
[email protected]45920862014-07-02 12:53:02946 // The geolocation dispatcher attached to this frame, lazily initialized.
[email protected]8eae0802014-06-02 21:35:55947 GeolocationDispatcher* geolocation_dispatcher_;
948
[email protected]45920862014-07-02 12:53:02949 // The push messaging dispatcher attached to this frame, lazily initialized.
950 PushMessagingDispatcher* push_messaging_dispatcher_;
951
avayvodbca35fad2015-01-29 20:20:57952 // The presentation dispatcher implementation attached to this frame, lazily
953 // initialized.
954 PresentationDispatcher* presentation_dispatcher_;
955
[email protected]c52a1412014-06-25 06:09:25956 ServiceRegistryImpl service_registry_;
957
[email protected]45920862014-07-02 12:53:02958 // The screen orientation dispatcher attached to the frame, lazily
959 // initialized.
[email protected]cf78eda2014-06-13 16:57:41960 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
961
mlamouriefdca9d2014-09-16 16:55:40962 // The Manifest Manager handles the manifest requests from the browser
963 // process.
964 ManifestManager* manifest_manager_;
965
[email protected]95640212014-07-26 18:14:30966 // The current accessibility mode.
967 AccessibilityMode accessibility_mode_;
968
969 // Only valid if |accessibility_mode_| is anything other than
970 // AccessibilityModeOff.
971 RendererAccessibility* renderer_accessibility_;
972
mlamouric6d31db2015-03-28 17:48:14973 scoped_ptr<PermissionDispatcher> permission_client_;
mlamouri670a86d2015-03-17 16:06:25974
benwells04ab5b962015-05-06 08:29:40975 scoped_ptr<blink::WebAppBannerClient> app_banner_client_;
976
avi485e5fd62014-08-25 23:26:14977#if defined(OS_MACOSX) || defined(OS_ANDROID)
978 // The external popup for the currently showing select popup.
979 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
980#endif
981
[email protected]96307312014-05-04 01:00:19982 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
983
[email protected]227692c52013-05-31 22:43:04984 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
985};
986
987} // namespace content
988
[email protected]85d85fd2013-06-19 00:57:41989#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_