blob: 21dca97af789f02d7b4b05a2aaaa09f9303197e5 [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"
[email protected]95640212014-07-26 18:14:3028#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4129#include "third_party/WebKit/public/web/WebDataSource.h"
30#include "third_party/WebKit/public/web/WebFrameClient.h"
[email protected]680575542014-04-03 17:12:5231#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
zhenwd47fd722014-11-13 00:43:4732#include "third_party/WebKit/public/web/WebTransitionElementData.h"
[email protected]4ee64622014-03-21 22:34:1533#include "ui/gfx/range/range.h"
[email protected]227692c52013-05-31 22:43:0434
tommyclid481c482014-12-03 01:50:4135#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3836#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4137#endif
38
[email protected]a017938b2014-05-27 21:17:1739#if defined(OS_ANDROID)
40#include "content/renderer/media/android/renderer_media_player_manager.h"
41#endif
42
clamy9bfeef42014-09-30 20:50:4243class GURL;
[email protected]7a4e2532013-12-02 21:30:0244class TransportDIB;
zhenw70986bd2014-10-20 18:50:2645struct FrameHostMsg_AddNavigationTransitionData_Params;
kenrba7199832015-01-22 23:44:5946struct FrameMsg_NewFrame_WidgetParams;
alexmose7da5a12015-04-09 02:22:1647struct FrameMsg_PostMessage_Params;
dspelle736c9db2015-04-03 04:53:1648struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0249
50namespace blink {
[email protected]5ee7f182014-04-25 19:45:2651class WebGeolocationClient;
[email protected]7a4e2532013-12-02 21:30:0252class WebMouseEvent;
[email protected]82ce5b92014-03-22 05:15:2653class WebContentDecryptionModule;
[email protected]96307312014-05-04 01:00:1954class WebMediaPlayer;
avayvodbca35fad2015-01-29 20:20:5755class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0256class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2657class WebSecurityOrigin;
[email protected]7a4e2532013-12-02 21:30:0258struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4259struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0260struct WebCursorInfo;
zhenwd47fd722014-11-13 00:43:4761struct WebTransitionElementData;
[email protected]7a4e2532013-12-02 21:30:0262}
63
64namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4265class Point;
[email protected]7a4e2532013-12-02 21:30:0266class Range;
67class Rect;
68}
69
jrummell109c3a602014-12-18 01:08:5070namespace media {
xhwangd7180832015-04-03 05:38:1571class CdmFactory;
xhwang60b430a2015-02-01 05:20:4672class MediaPermission;
jrummell109c3a602014-12-18 01:08:5073class WebEncryptedMediaClientImpl;
74}
75
[email protected]227692c52013-05-31 22:43:0476namespace content {
77
[email protected]bffc8302014-01-23 20:52:1678class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:5979class CompositorDependencies;
dgozman358ba322015-03-26 15:05:3080class DevToolsAgent;
avi0392dbf52015-03-25 16:55:4581class DocumentState;
avi485e5fd62014-08-25 23:26:1482class ExternalPopupMenu;
[email protected]8eae0802014-06-02 21:35:5583class GeolocationDispatcher;
mlamouriefdca9d2014-09-16 16:55:4084class ManifestManager;
[email protected]977db4a42014-07-17 08:04:3285class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:0886class MediaStreamRendererFactory;
xhwang36b1f3b2015-01-27 17:54:0187class MediaPermissionDispatcher;
[email protected]52d3e172014-06-16 16:57:0288class MidiDispatcher;
avi0392dbf52015-03-25 16:55:4589class NavigationState;
[email protected]4459599e2014-07-29 22:40:0990class NotificationPermissionDispatcher;
clamyda97e8322014-10-07 21:57:2591class PageState;
[email protected]7a4e2532013-12-02 21:30:0292class PepperPluginInstanceImpl;
mlamouric6d31db2015-03-28 17:48:1493class PermissionDispatcher;
avayvodbca35fad2015-01-29 20:20:5794class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:0295class PushMessagingDispatcher;
xhwangd7180832015-04-03 05:38:1596class RenderCdmFactory;
[email protected]95640212014-07-26 18:14:3097class RendererAccessibility;
[email protected]4b556cf2014-06-10 23:21:5398class RendererCdmManager;
99class RendererMediaPlayerManager;
[email protected]7a4e2532013-12-02 21:30:02100class RendererPpapiHost;
[email protected]2e2d9632013-12-03 00:55:26101class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04102class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02103class RenderWidget;
104class RenderWidgetFullscreenPepper;
[email protected]cf78eda2014-06-13 16:57:41105class ScreenOrientationDispatcher;
perkj1a2d0432014-09-03 13:52:33106class UserMediaClientImpl;
alexmose48b1df932015-01-16 01:34:17107enum class SandboxFlags;
clamy9bfeef42014-09-30 20:50:42108struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42109struct CustomContextMenuContext;
alexmosbc7eafa2014-12-06 01:38:09110struct FrameReplicationState;
avi0392dbf52015-03-25 16:55:45111struct NavigationParams;
clamy79b3da62014-10-14 08:50:37112struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04113struct ResourceResponseHead;
clamy34e12782015-03-12 11:26:13114struct StartNavigationParams;
[email protected]227692c52013-05-31 22:43:04115
[email protected]85d85fd2013-06-19 00:57:41116class CONTENT_EXPORT RenderFrameImpl
117 : public RenderFrame,
[email protected]96307312014-05-04 01:00:19118 NON_EXPORTED_BASE(public blink::WebFrameClient),
acolwell9e0840d2014-09-06 19:01:32119 NON_EXPORTED_BASE(public media::WebMediaPlayerDelegate) {
[email protected]227692c52013-05-31 22:43:04120 public:
[email protected]2f61bdd2013-07-02 18:38:47121 // Creates a new RenderFrame. |render_view| is the RenderView object that this
122 // frame belongs to.
[email protected]b70da4c2014-01-06 19:57:09123 // Callers *must* call |SetWebFrame| immediately after creation.
[email protected]82307f6b2014-08-07 03:30:12124 // Note: This is called only when RenderFrame is created by Blink through
125 // createChildFrame.
[email protected]b70da4c2014-01-06 19:57:09126 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed.
[email protected]2f61bdd2013-07-02 18:38:47127 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
128
[email protected]82307f6b2014-08-07 03:30:12129 // Creates a new RenderFrame with |routing_id| as a child of the RenderFrame
130 // identified by |parent_routing_id| or as the top-level frame if the latter
japhete6adf142014-10-31 00:01:49131 // is MSG_ROUTING_NONE. If |proxy_routing_id| is MSG_ROUTING_NONE, it creates
132 // the Blink WebLocalFrame and inserts it in the proper place in the frame
133 // tree. Otherwise, the frame is semi-orphaned until it commits, at which
134 // point it replaces the proxy identified by |proxy_routing_id|.
[email protected]82307f6b2014-08-07 03:30:12135 // Note: This is called only when RenderFrame is being created in response to
136 // IPC message from the browser process. All other frame creation is driven
137 // through Blink and Create.
japhete6adf142014-10-31 00:01:49138 static void CreateFrame(int routing_id,
139 int parent_routing_id,
alexmose48b1df932015-01-16 01:34:17140 int proxy_routing_id,
kenrba7199832015-01-22 23:44:59141 const FrameReplicationState& replicated_state,
142 CompositorDependencies* compositor_deps,
143 const FrameMsg_NewFrame_WidgetParams& params);
[email protected]82307f6b2014-08-07 03:30:12144
[email protected]5a7100d2014-05-19 01:29:04145 // Returns the RenderFrameImpl for the given routing ID.
146 static RenderFrameImpl* FromRoutingID(int routing_id);
147
[email protected]a5ac6dc2014-01-15 07:02:14148 // Just like RenderFrame::FromWebFrame but returns the implementation.
149 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09150
[email protected]2f61bdd2013-07-02 18:38:47151 // Used by content_layouttest_support to hook into the creation of
152 // RenderFrameImpls.
dongseong.hwangb721ddf2014-12-10 21:22:50153 using CreateRenderFrameImplFunction = RenderFrameImpl* (*)(RenderViewImpl*,
154 int32);
[email protected]2f61bdd2013-07-02 18:38:47155 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50156 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47157
alexmose48b1df932015-01-16 01:34:17158 static content::SandboxFlags WebToContentSandboxFlags(
159 blink::WebSandboxFlags flags);
160
161 static blink::WebSandboxFlags ContentToWebSandboxFlags(
162 content::SandboxFlags flags);
163
[email protected]227692c52013-05-31 22:43:04164 virtual ~RenderFrameImpl();
165
[email protected]b70da4c2014-01-06 19:57:09166 bool is_swapped_out() const {
167 return is_swapped_out_;
168 }
169
[email protected]5a7100d2014-05-19 01:29:04170 // TODO(nasko): This can be removed once we don't have a swapped out state on
171 // RenderFrames. See https://crbug.com/357747.
172 void set_render_frame_proxy(RenderFrameProxy* proxy) {
173 render_frame_proxy_ = proxy;
174 }
175
[email protected]bffc8302014-01-23 20:52:16176 // Out-of-process child frames receive a signal from RenderWidgetCompositor
177 // when a compositor frame has committed.
178 void DidCommitCompositorFrame();
179
[email protected]7a4e2532013-12-02 21:30:02180 // TODO(jam): this is a temporary getter until all the code is transitioned
181 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26182 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02183
[email protected]f3add922013-12-20 23:17:16184 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
185
[email protected]7a4e2532013-12-02 21:30:02186 // Returns the RenderWidget associated with this frame.
187 RenderWidget* GetRenderWidget();
188
dgozmancf9039cd2015-04-06 12:01:31189 DevToolsAgent* devtools_agent() { return devtools_agent_; }
190
[email protected]35b2a972014-04-04 15:50:22191 // This is called right after creation with the WebLocalFrame for this
[email protected]0287e762014-04-11 13:07:58192 // RenderFrame. It must be called before Initialize.
[email protected]35b2a972014-04-04 15:50:22193 void SetWebFrame(blink::WebLocalFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09194
[email protected]0287e762014-04-11 13:07:58195 // This method must be called after the frame has been added to the frame
196 // tree. It creates all objects that depend on the frame being at its proper
197 // spot.
198 void Initialize();
199
[email protected]de3c5d82014-05-28 22:12:59200 // Notifications from RenderWidget.
201 void WasHidden();
202 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31203 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59204
[email protected]723971b2014-02-12 11:08:25205 // Start/Stop loading notifications.
206 // TODO(nasko): Those are page-level methods at this time and come from
207 // WebViewClient. We should move them to be WebFrameClient calls and put
208 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09209 // |to_different_document| will be true unless the load is a fragment
210 // navigation, or triggered by history.pushState/replaceState.
[email protected]6dd5c322014-03-12 07:58:46211 virtual void didStartLoading(bool to_different_document);
212 virtual void didStopLoading();
213 virtual void didChangeLoadProgress(double load_progress);
[email protected]723971b2014-02-12 11:08:25214
[email protected]95640212014-07-26 18:14:30215 AccessibilityMode accessibility_mode() {
216 return accessibility_mode_;
217 }
218
219 RendererAccessibility* renderer_accessibility() {
220 return renderer_accessibility_;
221 }
222
223 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
224 blink::WebAXEvent event);
225
estade31c54342015-01-23 03:34:36226 // The focused node changed to |node|. If focus was lost from this frame,
227 // |node| will be null.
[email protected]95640212014-07-26 18:14:30228 void FocusedNodeChanged(const blink::WebNode& node);
229
estade31c54342015-01-23 03:34:36230 // TODO(dmazzoni): the only reason this is here is to plumb it through to
231 // RendererAccessibility. It should use the RenderFrameObserver method, once
232 // blink has a separate accessibility tree per frame.
233 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
234
[email protected]7a4e2532013-12-02 21:30:02235#if defined(ENABLE_PLUGINS)
[email protected]271ff5792013-12-04 22:29:31236 // Notification that a PPAPI plugin has been created.
237 void PepperPluginCreated(RendererPpapiHost* host);
238
[email protected]7a4e2532013-12-02 21:30:02239 // Notifies that |instance| has changed the cursor.
240 // This will update the cursor appearance if it is currently over the plugin
241 // instance.
242 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
243 const blink::WebCursorInfo& cursor);
244
245 // Notifies that |instance| has received a mouse event.
246 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
247
[email protected]7a4e2532013-12-02 21:30:02248 // Informs the render view that a PPAPI plugin has changed text input status.
249 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
250 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
251
252 // Cancels current composition.
253 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
254
255 // Informs the render view that a PPAPI plugin has changed selection.
256 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
257
258 // Creates a fullscreen container for a pepper plugin instance.
259 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
260 PepperPluginInstanceImpl* plugin);
261
[email protected]7a4e2532013-12-02 21:30:02262 bool IsPepperAcceptingCompositionEvents() const;
263
264 // Notification that the given plugin has crashed.
265 void PluginCrashed(const base::FilePath& plugin_path,
266 base::ProcessId plugin_pid);
267
[email protected]7a4e2532013-12-02 21:30:02268 // Simulates IME events for testing purpose.
269 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26270 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02271 const std::vector<blink::WebCompositionUnderline>& underlines,
272 int selection_start,
273 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26274 void SimulateImeConfirmComposition(const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02275 const gfx::Range& replacement_range);
276
277 // TODO(jam): remove these once the IPC handler moves from RenderView to
278 // RenderFrame.
279 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42280 const base::string16& text,
281 const std::vector<blink::WebCompositionUnderline>& underlines,
282 int selection_start,
283 int selection_end);
284 void OnImeConfirmComposition(const base::string16& text,
285 const gfx::Range& replacement_range,
286 bool keep_selection);
287#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02288
[email protected]977db4a42014-07-17 08:04:32289 // May return NULL in some cases, especially if userMediaClient() returns
290 // NULL.
291 MediaStreamDispatcher* GetMediaStreamDispatcher();
292
avi485e5fd62014-08-25 23:26:14293#if defined(OS_MACOSX) || defined(OS_ANDROID)
294 void DidHideExternalPopupMenu();
295#endif
296
[email protected]227692c52013-05-31 22:43:04297 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52298 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04299
300 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52301 bool OnMessageReceived(const IPC::Message& msg) override;
[email protected]227692c52013-05-31 22:43:04302
[email protected]271ff5792013-12-04 22:29:31303 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52304 RenderView* GetRenderView() override;
305 int GetRoutingID() override;
306 blink::WebLocalFrame* GetWebFrame() override;
estade78d655f82015-01-30 01:55:08307 blink::WebElement GetFocusedElement() const override;
dcheng6d18e402014-10-21 12:32:52308 WebPreferences& GetWebkitPreferences() override;
309 int ShowContextMenu(ContextMenuClient* client,
310 const ContextMenuParams& params) override;
311 void CancelContextMenu(int request_id) override;
312 blink::WebNode GetContextMenuNode() const override;
tommycli59bd86c2014-12-10 02:09:38313 blink::WebPlugin* CreatePlugin(
314 blink::WebFrame* frame,
315 const WebPluginInfo& info,
316 const blink::WebPluginParams& params,
tommyclie8722702015-01-16 11:40:41317 scoped_ptr<PluginInstanceThrottler> throttler) override;
dcheng6d18e402014-10-21 12:32:52318 void LoadURLExternally(blink::WebLocalFrame* frame,
319 const blink::WebURLRequest& request,
320 blink::WebNavigationPolicy policy) override;
321 void ExecuteJavaScript(const base::string16& javascript) override;
322 bool IsHidden() override;
323 ServiceRegistry* GetServiceRegistry() override;
tommyclid481c482014-12-03 01:50:41324#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38325 void RegisterPeripheralPlugin(
326 const GURL& content_origin,
327 const base::Closure& unthrottle_callback) override;
tommyclid7798e12015-02-09 21:08:56328 PluginPowerSaverHelper* plugin_power_saver_helper() {
329 return plugin_power_saver_helper_;
330 }
tommyclid481c482014-12-03 01:50:41331#endif
dcheng6d18e402014-10-21 12:32:52332 bool IsFTPDirectoryListing() override;
333 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52334 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52335 void SetSelectedText(const base::string16& selection_text,
336 size_t offset,
337 const gfx::Range& range) override;
338 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
339 v8::Handle<v8::Context> context) override;
[email protected]271ff5792013-12-04 22:29:31340
[email protected]96307312014-05-04 01:00:19341 // blink::WebFrameClient implementation:
jbroman73e9f7962014-10-30 00:43:45342 blink::WebPluginPlaceholder* createPluginPlaceholder(
343 blink::WebLocalFrame*,
344 const blink::WebPluginParams&) override;
[email protected]35b2a972014-04-04 15:50:22345 virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
346 const blink::WebPluginParams& params);
jrummell65b7d272014-09-24 20:49:27347 // TODO(jrummell): Remove this method once blink updated.
[email protected]180ef242013-11-07 06:50:46348 virtual blink::WebMediaPlayer* createMediaPlayer(
[email protected]35b2a972014-04-04 15:50:22349 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46350 const blink::WebURL& url,
351 blink::WebMediaPlayerClient* client);
jrummell65b7d272014-09-24 20:49:27352 virtual blink::WebMediaPlayer* createMediaPlayer(
353 blink::WebLocalFrame* frame,
354 const blink::WebURL& url,
355 blink::WebMediaPlayerClient* client,
356 blink::WebContentDecryptionModule* initial_cdm);
[email protected]180ef242013-11-07 06:50:46357 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
[email protected]35b2a972014-04-04 15:50:22358 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46359 blink::WebApplicationCacheHostClient* client);
mlamouria5b294552015-03-09 16:16:36360 virtual blink::WebWorkerContentSettingsClientProxy*
361 createWorkerContentSettingsClientProxy(blink::WebLocalFrame* frame);
[email protected]b20c3222014-08-22 00:50:22362 virtual blink::WebExternalPopupMenu* createExternalPopupMenu(
363 const blink::WebPopupMenuInfo& popup_menu_info,
364 blink::WebExternalPopupMenuClient* popup_menu_client);
[email protected]35b2a972014-04-04 15:50:22365 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame);
[email protected]180ef242013-11-07 06:50:46366 virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider(
[email protected]35b2a972014-04-04 15:50:22367 blink::WebLocalFrame* frame);
368 virtual void didAccessInitialDocument(blink::WebLocalFrame* frame);
alexmose48b1df932015-01-16 01:34:17369 virtual blink::WebFrame* createChildFrame(
370 blink::WebLocalFrame* parent,
371 const blink::WebString& name,
372 blink::WebSandboxFlags sandboxFlags);
[email protected]35b2a972014-04-04 15:50:22373 virtual void didDisownOpener(blink::WebLocalFrame* frame);
[email protected]180ef242013-11-07 06:50:46374 virtual void frameDetached(blink::WebFrame* frame);
[email protected]9c9343b2014-03-08 02:56:07375 virtual void frameFocused();
[email protected]180ef242013-11-07 06:50:46376 virtual void willClose(blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22377 virtual void didChangeName(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46378 const blink::WebString& name);
alexmos6b294562015-03-05 19:24:10379 virtual void didChangeSandboxFlags(blink::WebFrame* child_frame,
380 blink::WebSandboxFlags flags);
[email protected]f5b6dd1122013-10-04 02:42:50381 virtual void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22382 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46383 const blink::WebVector<blink::WebString>& newly_matching_selectors,
384 const blink::WebVector<blink::WebString>& stopped_matching_selectors);
[email protected]c31a84802014-04-03 15:55:49385 virtual bool shouldReportDetailedMessageForSource(
386 const blink::WebString& source);
387 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
388 const blink::WebString& source_name,
389 unsigned source_line,
390 const blink::WebString& stack_trace);
[email protected]35b2a972014-04-04 15:50:22391 virtual void loadURLExternally(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46392 const blink::WebURLRequest& request,
[email protected]35b2a972014-04-04 15:50:22393 blink::WebNavigationPolicy policy,
394 const blink::WebString& suggested_name);
[email protected]1a4e9752013-12-31 20:10:58395 // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass.
[email protected]180ef242013-11-07 06:50:46396 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
[email protected]0c3c54f2014-07-31 01:29:00397 const NavigationPolicyInfo& info);
[email protected]680575542014-04-03 17:12:52398 virtual blink::WebHistoryItem historyItemForNewChildFrame(
399 blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22400 virtual void willSendSubmitEvent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46401 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22402 virtual void willSubmitForm(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46403 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22404 virtual void didCreateDataSource(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46405 blink::WebDataSource* datasource);
[email protected]0c3c54f2014-07-31 01:29:00406 virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame,
japhet69a06302014-12-12 19:37:14407 bool is_transition_navigation,
408 double triggering_event_time);
[email protected]85d85fd2013-06-19 00:57:41409 virtual void didReceiveServerRedirectForProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22410 blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41411 virtual void didFailProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22412 blink::WebLocalFrame* frame,
avibe2d51d2015-03-31 00:21:17413 const blink::WebURLError& error,
414 blink::WebHistoryCommitType commit_type);
[email protected]680575542014-04-03 17:12:52415 virtual void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22416 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52417 const blink::WebHistoryItem& item,
418 blink::WebHistoryCommitType commit_type);
rob5ef11ff2014-11-17 23:56:20419 virtual void didCreateNewDocument(blink::WebLocalFrame* frame);
[email protected]06181e52014-05-10 11:59:09420 virtual void didClearWindowObject(blink::WebLocalFrame* frame);
[email protected]35b2a972014-04-04 15:50:22421 virtual void didCreateDocumentElement(blink::WebLocalFrame* frame);
422 virtual void didReceiveTitle(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46423 const blink::WebString& title,
424 blink::WebTextDirection direction);
[email protected]35b2a972014-04-04 15:50:22425 virtual void didChangeIcon(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46426 blink::WebIconURL::Type icon_type);
[email protected]35b2a972014-04-04 15:50:22427 virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame);
428 virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame);
429 virtual void didFailLoad(blink::WebLocalFrame* frame,
avibe2d51d2015-03-31 00:21:17430 const blink::WebURLError& error,
431 blink::WebHistoryCommitType commit_type);
[email protected]45d877f2014-04-05 07:36:22432 virtual void didFinishLoad(blink::WebLocalFrame* frame);
433 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52434 const blink::WebHistoryItem& item,
435 blink::WebHistoryCommitType commit_type);
[email protected]35b2a972014-04-04 15:50:22436 virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
[email protected]9e6bea412014-08-08 06:35:25437 virtual void addNavigationTransitionData(
zhenwd47fd722014-11-13 00:43:47438 const blink::WebTransitionElementData& data);
[email protected]37b64c52014-07-11 21:14:05439 virtual void didChangeThemeColor();
alexmosf40ce5b02015-02-25 20:19:56440 virtual void dispatchLoad();
[email protected]4459599e2014-07-29 22:40:09441 virtual void requestNotificationPermission(
442 const blink::WebSecurityOrigin& origin,
443 blink::WebNotificationPermissionCallback* callback);
[email protected]c3f2c702014-03-19 23:39:48444 virtual void didChangeSelection(bool is_empty_selection);
[email protected]f3c59d62014-04-09 16:33:55445 virtual blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19446 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55447 const blink::WebColor& initial_color,
448 const blink::WebVector<blink::WebColorSuggestion>& suggestions);
[email protected]87de04b02014-04-08 22:14:49449 virtual void runModalAlertDialog(const blink::WebString& message);
450 virtual bool runModalConfirmDialog(const blink::WebString& message);
451 virtual bool runModalPromptDialog(const blink::WebString& message,
452 const blink::WebString& default_value,
453 blink::WebString* actual_value);
454 virtual bool runModalBeforeUnloadDialog(bool is_reload,
455 const blink::WebString& message);
[email protected]12cc5112014-03-03 17:01:10456 virtual void showContextMenu(const blink::WebContextMenuData& data);
[email protected]91070342014-03-07 00:29:02457 virtual void clearContextMenu();
[email protected]35b2a972014-04-04 15:50:22458 virtual void willSendRequest(blink::WebLocalFrame* frame,
459 unsigned identifier,
460 blink::WebURLRequest& request,
461 const blink::WebURLResponse& redirect_response);
462 virtual void didReceiveResponse(blink::WebLocalFrame* frame,
463 unsigned identifier,
464 const blink::WebURLResponse& response);
465 virtual void didFinishResourceLoad(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14466 unsigned identifier);
[email protected]85d85fd2013-06-19 00:57:41467 virtual void didLoadResourceFromMemoryCache(
[email protected]35b2a972014-04-04 15:50:22468 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46469 const blink::WebURLRequest& request,
470 const blink::WebURLResponse& response);
[email protected]35b2a972014-04-04 15:50:22471 virtual void didDisplayInsecureContent(blink::WebLocalFrame* frame);
472 virtual void didRunInsecureContent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46473 const blink::WebSecurityOrigin& origin,
474 const blink::WebURL& target);
[email protected]35b2a972014-04-04 15:50:22475 virtual void didAbortLoading(blink::WebLocalFrame* frame);
476 virtual void didCreateScriptContext(blink::WebLocalFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41477 v8::Handle<v8::Context> context,
478 int extension_group,
[email protected]255eea092013-06-28 17:19:14479 int world_id);
[email protected]35b2a972014-04-04 15:50:22480 virtual void willReleaseScriptContext(blink::WebLocalFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41481 v8::Handle<v8::Context> context,
[email protected]255eea092013-06-28 17:19:14482 int world_id);
[email protected]35b2a972014-04-04 15:50:22483 virtual void didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame* frame);
[email protected]35b2a972014-04-04 15:50:22484 virtual void didChangeScrollOffset(blink::WebLocalFrame* frame);
485 virtual void willInsertBody(blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41486 virtual void reportFindInPageMatchCount(int request_id,
487 int count,
[email protected]255eea092013-06-28 17:19:14488 bool final_update);
[email protected]85d85fd2013-06-19 00:57:41489 virtual void reportFindInPageSelection(int request_id,
490 int active_match_ordinal,
[email protected]180ef242013-11-07 06:50:46491 const blink::WebRect& sel);
[email protected]35b2a972014-04-04 15:50:22492 virtual void requestStorageQuota(blink::WebLocalFrame* frame,
493 blink::WebStorageQuotaType type,
494 unsigned long long requested_size,
495 blink::WebStorageQuotaCallbacks callbacks);
[email protected]a14903e02014-06-02 07:35:12496 virtual void willOpenWebSocket(blink::WebSocketHandle* handle);
[email protected]5ee7f182014-04-25 19:45:26497 virtual blink::WebGeolocationClient* geolocationClient();
[email protected]45920862014-07-02 12:53:02498 virtual blink::WebPushClient* pushClient();
avayvodbca35fad2015-01-29 20:20:57499 virtual blink::WebPresentationClient* presentationClient();
[email protected]85d85fd2013-06-19 00:57:41500 virtual void willStartUsingPeerConnectionHandler(
[email protected]35b2a972014-04-04 15:50:22501 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46502 blink::WebRTCPeerConnectionHandler* handler);
[email protected]bfe45e22014-04-25 16:47:53503 virtual blink::WebUserMediaClient* userMediaClient();
jrummell109c3a602014-12-18 01:08:50504 virtual blink::WebEncryptedMediaClient* encryptedMediaClient();
[email protected]8538385f2014-04-25 19:45:04505 virtual blink::WebMIDIClient* webMIDIClient();
[email protected]85d85fd2013-06-19 00:57:41506 virtual bool willCheckAndDispatchMessageEvent(
[email protected]ce5064f2014-05-07 22:49:20507 blink::WebLocalFrame* source_frame,
508 blink::WebFrame* target_frame,
509 blink::WebSecurityOrigin target_origin,
[email protected]180ef242013-11-07 06:50:46510 blink::WebDOMMessageEvent event);
[email protected]35b2a972014-04-04 15:50:22511 virtual blink::WebString userAgentOverride(blink::WebLocalFrame* frame,
512 const blink::WebURL& url);
513 virtual blink::WebString doNotTrackValue(blink::WebLocalFrame* frame);
514 virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value);
515 virtual void didLoseWebGLContext(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14516 int arb_robustness_status_code);
[email protected]cf78eda2014-06-13 16:57:41517 virtual blink::WebScreenOrientationClient* webScreenOrientationClient();
nhirokifebadeed2014-10-29 04:02:47518 virtual bool isControlledByServiceWorker(blink::WebDataSource& data_source);
519 virtual int64_t serviceWorkerID(blink::WebDataSource& data_source);
dmazzoni0b5d2482014-09-10 19:45:57520 virtual void postAccessibilityEvent(const blink::WebAXObject& obj,
521 blink::WebAXEvent event);
dmazzoni1a69e2b32014-11-06 20:34:28522 virtual void handleAccessibilityFindInPageResult(
523 int identifier,
524 int match_index,
525 const blink::WebAXObject& start_object,
526 int start_offset,
527 const blink::WebAXObject& end_object,
528 int end_offset);
mlamouriefdca9d2014-09-16 16:55:40529 virtual void didChangeManifest(blink::WebLocalFrame*);
avayvod5efd9a922015-03-13 15:41:02530 virtual void didChangeDefaultPresentation(blink::WebLocalFrame*);
mlamouri7a78d6fd2015-01-17 13:23:53531 virtual bool enterFullscreen();
532 virtual bool exitFullscreen();
mlamouri670a86d2015-03-17 16:06:25533 virtual blink::WebPermissionClient* permissionClient();
[email protected]85d85fd2013-06-19 00:57:41534
[email protected]96307312014-05-04 01:00:19535 // WebMediaPlayerDelegate implementation:
dcheng6d18e402014-10-21 12:32:52536 void DidPlay(blink::WebMediaPlayer* player) override;
537 void DidPause(blink::WebMediaPlayer* player) override;
538 void PlayerGone(blink::WebMediaPlayer* player) override;
[email protected]96307312014-05-04 01:00:19539
[email protected]c6bc20332014-02-28 18:30:39540 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
541 // this back to private member.
clamy34e12782015-03-12 11:26:13542 void OnNavigate(const CommonNavigationParams& common_params,
543 const StartNavigationParams& start_params,
clamy57b4b8e2015-03-24 13:32:11544 const RequestNavigationParams& request_params);
[email protected]c6bc20332014-02-28 18:30:39545
nasko78f06bc2014-11-18 18:18:57546 // Make this frame show an empty, unscriptable page.
547 // TODO(nasko): Remove this method once swapped out state is no longer used.
548 void NavigateToSwappedOutURL();
549
rockot775ce0d2015-01-27 18:35:01550 // Binds this render frame's service registry.
[email protected]c52a1412014-06-25 06:09:25551 void BindServiceRegistry(
rockot775ce0d2015-01-27 18:35:01552 mojo::InterfaceRequest<mojo::ServiceProvider> services,
553 mojo::ServiceProviderPtr exposed_services);
[email protected]c52a1412014-06-25 06:09:25554
mlamouri4fff1992014-09-30 11:22:46555 ManifestManager* manifest_manager();
556
avi0392dbf52015-03-25 16:55:45557 // TODO(creis): Remove when the only caller, the HistoryController, is no
558 // more.
559 void SetPendingNavigationParams(
560 scoped_ptr<NavigationParams> navigation_params);
561
[email protected]2f61bdd2013-07-02 18:38:47562 protected:
563 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
564
[email protected]227692c52013-05-31 22:43:04565 private:
kenrbf98a4d22015-04-01 21:59:35566 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26567 friend class RenderFrameObserver;
clamy5c7ede52015-04-09 11:32:24568 friend class RenderViewImplTest;
[email protected]95640212014-07-26 18:14:30569 friend class RendererAccessibilityTest;
avi485e5fd62014-08-25 23:26:14570 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
571 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
572 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
573 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]66bbadaf2014-03-28 16:25:54574 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
575 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]2e2d9632013-12-03 00:55:26576
[email protected]37567b432014-02-12 01:12:22577 typedef std::map<GURL, double> HostZoomLevels;
578
[email protected]2e2d9632013-12-03 00:55:26579 // Functions to add and remove observers for this object.
580 void AddObserver(RenderFrameObserver* observer);
581 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34582
[email protected]f0906a02014-08-07 07:18:55583 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35584 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
585 blink::WebHistoryCommitType commit_type);
[email protected]37567b432014-02-12 01:12:22586
[email protected]b70da4c2014-01-06 19:57:09587 // IPC message handlers ------------------------------------------------------
588 //
589 // The documentation for these functions should be in
590 // content/common/*_messages.h for the message that the function is handling.
[email protected]f76f32232014-03-11 17:36:17591 void OnBeforeUnload();
alexmosbc7eafa2014-12-06 01:38:09592 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56593 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09594 const FrameReplicationState& replicated_frame_state);
Nasko Oskov85f60222014-08-28 22:53:30595 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42596 void OnShowContextMenu(const gfx::Point& location);
597 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
598 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
599 unsigned action);
[email protected]4ee64622014-03-21 22:34:15600 void OnUndo();
601 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07602 void OnCut();
603 void OnCopy();
604 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15605 void OnPasteAndMatchStyle();
606 void OnDelete();
607 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14608 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
[email protected]4ee64622014-03-21 22:34:15609 void OnUnselect();
christiankaeed9862014-11-05 10:49:14610 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17611 void OnReplace(const base::string16& text);
612 void OnReplaceMisspelling(const base::string16& text);
[email protected]e31b8ebb2014-03-07 17:59:34613 void OnCSSInsertRequest(const std::string& css);
[email protected]f13ab892014-03-12 06:48:52614 void OnJavaScriptExecuteRequest(const base::string16& javascript,
615 int id,
616 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28617 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
618 int id,
619 bool notify_result);
igsolla1cea67b72015-02-11 16:25:04620 void OnVisualStateRequest(uint64 key);
[email protected]4ee64622014-03-21 22:34:15621 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16622 void OnSetCompositionFromExistingText(
623 int start, int end,
624 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24625 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16626 void OnExtendSelectionAndDelete(int before, int after);
[email protected]4fed3702014-04-01 09:08:00627 void OnReload(bool ignore_cache);
[email protected]96bb6132014-06-16 17:22:19628 void OnTextSurroundingSelectionRequest(size_t max_length);
[email protected]2e531f72014-06-20 23:23:39629 void OnAddStyleSheetByURL(const std::string& url);
[email protected]9e6bea412014-08-08 06:35:25630 void OnSetupTransitionView(const std::string& markup);
zhenwe8f14fc2014-11-25 01:00:54631 void OnBeginExitTransition(const std::string& css_selector,
632 bool exit_to_native_app);
zhenw5a707892014-12-10 02:31:03633 void OnRevertExitTransition();
zhenwabf9b9d2014-11-15 04:04:18634 void OnHideTransitionElements(const std::string& css_selector);
635 void OnShowTransitionElements(const std::string& css_selector);
[email protected]95640212014-07-26 18:14:30636 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51637 void OnSnapshotAccessibilityTree(int callback_id);
creisbbbeb062014-08-25 18:20:31638 void OnDisownOpener();
alexmos6b294562015-03-05 19:24:10639 void OnDidUpdateSandboxFlags(SandboxFlags flags);
dspelle736c9db2015-04-03 04:53:16640 void OnTextTrackSettingsChanged(
641 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16642 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
avi485e5fd62014-08-25 23:26:14643#if defined(OS_ANDROID)
644 void OnSelectPopupMenuItems(bool canceled,
645 const std::vector<int>& selected_indices);
646#elif defined(OS_MACOSX)
647 void OnSelectPopupMenuItem(int selected_index);
[email protected]4ee64622014-03-21 22:34:15648 void OnCopyToFindPboard();
649#endif
[email protected]9c9343b2014-03-08 02:56:07650
davidbena5496d62014-10-07 18:52:04651 void OnCommitNavigation(const ResourceResponseHead& response,
652 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42653 const CommonNavigationParams& common_params,
clamy57b4b8e2015-03-24 13:32:11654 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57655 void OnFailedNavigation(const CommonNavigationParams& common_params,
656 const RequestNavigationParams& request_params,
657 bool has_stale_copy_in_cache,
658 int error_code);
clamy9bfeef42014-09-30 20:50:42659
[email protected]65920f332014-03-04 21:14:18660 // Virtual since overridden by WebTestProxy for layout tests.
661 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
662 RenderFrame* render_frame,
[email protected]0c3c54f2014-07-31 01:29:00663 const NavigationPolicyInfo& info);
[email protected]65920f332014-03-04 21:14:18664 void OpenURL(blink::WebFrame* frame,
665 const GURL& url,
666 const Referrer& referrer,
667 blink::WebNavigationPolicy policy);
[email protected]a09d53ce2014-01-31 00:46:42668
[email protected]ef3adfc2014-05-11 00:04:54669 // Update current main frame's encoding and send it to browser window.
670 // Since we want to let users see the right encoding info from menu
671 // before finishing loading, we call the UpdateEncoding in
672 // a) function:DidCommitLoadForFrame. When this function is called,
673 // that means we have got first data. In here we try to get encoding
674 // of page if it has been specified in http header.
675 // b) function:DidReceiveTitle. When this function is called,
676 // that means we have got specified title. Because in most of webpages,
677 // title tags will follow meta tags. In here we try to get encoding of
678 // page if it has been specified in meta tag.
679 // c) function:DidFinishDocumentLoadForFrame. When this function is
680 // called, that means we have got whole html page. In here we should
681 // finally get right encoding of page.
682 void UpdateEncoding(blink::WebFrame* frame,
683 const std::string& encoding_name);
684
[email protected]4ee64622014-03-21 22:34:15685 // Dispatches the current state of selection on the webpage to the browser if
686 // it has changed.
687 // TODO(varunjain): delete this method once we figure out how to keep
688 // selection handles in sync with the webpage.
689 void SyncSelectionIfRequired();
690
[email protected]87de04b02014-04-08 22:14:49691 bool RunJavaScriptMessage(JavaScriptMessageType type,
692 const base::string16& message,
693 const base::string16& default_value,
694 const GURL& frame_url,
695 base::string16* result);
696
[email protected]457736d2014-04-30 15:54:27697 // Loads the appropriate error page for the specified failure into the frame.
698 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
699 const blink::WebURLError& error,
700 bool replace);
701
zeeshanq3454e9c2014-09-04 21:30:28702 void HandleJavascriptExecutionResult(const base::string16& javascript,
703 int id,
704 bool notify_result,
705 v8::Handle<v8::Value> result);
706
[email protected]977db4a42014-07-17 08:04:32707 // Initializes |web_user_media_client_|. If this fails, because it wasn't
708 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
709 // |web_user_media_client_| will remain NULL.
710 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19711
712 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
713 const blink::WebURL& url,
714 blink::WebMediaPlayerClient* client);
715
[email protected]ae2477e2014-05-27 23:47:08716 // Creates a factory object used for creating audio and video renderers.
717 // The method is virtual so that layouttests can override it.
718 virtual scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
719
clamyda97e8322014-10-07 21:57:25720 // Checks that the RenderView is ready to display the navigation to |url|. If
sungmann.cho12349f0e2014-12-05 23:42:19721 // the return value is false, the navigation should be abandoned.
clamyda97e8322014-10-07 21:57:25722 bool PrepareRenderViewForNavigation(
723 const GURL& url,
avi2b177592014-12-10 02:08:02724 bool is_history_navigation,
clamy57b4b8e2015-03-24 13:32:11725 const RequestNavigationParams& request_params,
clamyda97e8322014-10-07 21:57:25726 bool* is_reload,
727 blink::WebURLRequest::CachePolicy* cache_policy);
728
clamyece38882014-11-19 15:00:20729 // PlzNavigate
730 // Sends a FrameHostMsg_BeginNavigation to the browser based on the contents
731 // of the WebURLRequest.
732 void BeginNavigation(blink::WebURLRequest* request);
733
clamy4cc9b8202015-03-02 13:51:36734 // Loads a data url.
735 void LoadDataURL(const CommonNavigationParams& params,
736 blink::WebFrame* frame);
737
clamy62b271d2015-04-16 11:54:57738 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
739 // the failed request |request|.
740 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
741 const blink::WebURLError& error,
742 blink::WebLocalFrame* frame);
743
744 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
745 const GURL& unreachable_url);
746
[email protected]f3a95312014-06-12 16:46:58747 // Returns the URL being loaded by the |frame_|'s request.
748 GURL GetLoadingUrl() const;
749
avi0392dbf52015-03-25 16:55:45750 // If we initiated a navigation, this function will populate |document_state|
751 // with the navigation information saved in OnNavigate().
752 void PopulateDocumentStateFromPending(DocumentState* document_state);
753
754 // Returns a new NavigationState populated with the navigation information
755 // saved in OnNavigate().
756 NavigationState* CreateNavigationStateFromPending();
757
[email protected]96307312014-05-04 01:00:19758#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:00759 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
[email protected]96307312014-05-04 01:00:19760 const blink::WebURL& url,
jrummell65b7d272014-09-24 20:49:27761 blink::WebMediaPlayerClient* client,
xhwang60b430a2015-02-01 05:20:46762 media::MediaPermission* media_permission,
jrummell65b7d272014-09-24 20:49:27763 blink::WebContentDecryptionModule* initial_cdm);
[email protected]a017938b2014-05-27 21:17:17764
[email protected]65f3d1aa2014-05-29 01:57:00765 RendererMediaPlayerManager* GetMediaPlayerManager();
[email protected]4b556cf2014-06-10 23:21:53766#endif
767
xhwangd7180832015-04-03 05:38:15768 media::MediaPermission* GetMediaPermission();
769 media::CdmFactory* GetCdmFactory();
[email protected]96307312014-05-04 01:00:19770
creiscfaa4462015-03-16 19:27:18771 // Stores the WebLocalFrame we are associated with. This is null from the
772 // constructor until SetWebFrame is called, and it is null after
773 // frameDetached is called until destruction (which is asynchronous in the
774 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:22775 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:09776
dgozman358ba322015-03-26 15:05:30777 // Frame is a local root if it is rendered in a process different than parent
778 // or it is a main frame.
779 bool is_local_root_;
780
[email protected]abc501e2014-01-27 19:27:26781 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:04782 int routing_id_;
[email protected]1c2052f2013-08-28 08:24:34783 bool is_swapped_out_;
[email protected]5a7100d2014-05-19 01:29:04784 // RenderFrameProxy exists only when is_swapped_out_ is true.
785 // TODO(nasko): This can be removed once we don't have a swapped out state on
786 // RenderFrame. See https://crbug.com/357747.
787 RenderFrameProxy* render_frame_proxy_;
[email protected]1c2052f2013-08-28 08:24:34788 bool is_detaching_;
[email protected]227692c52013-05-31 22:43:04789
japhete6adf142014-10-31 00:01:49790 // If this frame was created to replace a proxy, this will store the routing
791 // id of the proxy to replace at commit-time, at which time it will be
792 // cleared.
793 // TODO(creis): Remove this after switching to PlzNavigate.
794 int proxy_routing_id_;
795
kenrba7199832015-01-22 23:44:59796 // Used when the RenderFrame is a local root. For now, RenderWidgets are
797 // added only when a child frame is in a different process from its parent
798 // frame, but eventually this will also apply to top-level frames.
799 // TODO(kenrb): Correct the above statement when top-level frames have their
800 // own RenderWidgets.
801 scoped_refptr<RenderWidget> render_widget_;
802
avi0392dbf52015-03-25 16:55:45803 // Temporarily holds state pertaining to a navigation that has been initiated
804 // until the NavigationState corresponding to the new navigation is created in
805 // didCreateDataSource().
806 scoped_ptr<NavigationParams> pending_navigation_params_;
807
[email protected]7a4e2532013-12-02 21:30:02808#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02809 // Current text input composition text. Empty if no composition is in
810 // progress.
[email protected]fcf75d42013-12-03 20:11:26811 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:09812
tommycli59bd86c2014-12-10 02:09:38813 PluginPowerSaverHelper* plugin_power_saver_helper_;
[email protected]7a4e2532013-12-02 21:30:02814#endif
815
[email protected]f3add922013-12-20 23:17:16816 RendererWebCookieJarImpl cookie_jar_;
817
[email protected]2e2d9632013-12-03 00:55:26818 // All the registered observers.
819 ObserverList<RenderFrameObserver> observers_;
820
[email protected]bffc8302014-01-23 20:52:16821 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
822
[email protected]4ecee352014-03-11 21:12:19823 // The node that the context menu was pressed over.
824 blink::WebNode context_menu_node_;
825
[email protected]a09d53ce2014-01-31 00:46:42826 // External context menu requests we're waiting for. "Internal"
827 // (WebKit-originated) context menu events will have an ID of 0 and will not
828 // be in this map.
829 //
830 // We don't want to add internal ones since some of the "special" page
831 // handlers in the browser process just ignore the context menu requests so
832 // avoid showing context menus, and so this will cause right clicks to leak
833 // entries in this map. Most users of the custom context menu (e.g. Pepper
834 // plugins) are normally only on "regular" pages and the regular pages will
835 // always respond properly to the request, so we don't have to worry so
836 // much about leaks.
837 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
838
[email protected]4ee64622014-03-21 22:34:15839 // The text selection the last time DidChangeSelection got called. May contain
840 // additional characters before and after the selected text, for IMEs. The
841 // portion of this string that is the actual selected text starts at index
842 // |selection_range_.GetMin() - selection_text_offset_| and has length
843 // |selection_range_.length()|.
844 base::string16 selection_text_;
845 // The offset corresponding to the start of |selection_text_| in the document.
846 size_t selection_text_offset_;
847 // Range over the document corresponding to the actual selected text (which
848 // could correspond to a substring of |selection_text_|; see above).
849 gfx::Range selection_range_;
850 // Used to inform didChangeSelection() when it is called in the context
851 // of handling a InputMsg_SelectRange IPC.
852 bool handling_select_range_;
853
[email protected]2626d142014-04-22 17:24:02854 // The next group of objects all implement RenderFrameObserver, so are deleted
855 // along with the RenderFrame automatically. This is why we just store weak
856 // references.
857
[email protected]4459599e2014-07-29 22:40:09858 // Dispatches permission requests for Web Notifications.
859 NotificationPermissionDispatcher* notification_permission_dispatcher_;
860
[email protected]977db4a42014-07-17 08:04:32861 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:33862 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:19863
jrummell109c3a602014-12-18 01:08:50864 // EncryptedMediaClient attached to this frame; lazily initialized.
xhwang430baee2015-01-22 05:46:20865 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:50866
xhwang36b1f3b2015-01-27 17:54:01867 // The media permission dispatcher attached to this frame, lazily initialized.
868 MediaPermissionDispatcher* media_permission_dispatcher_;
869
[email protected]52d3e172014-06-16 16:57:02870 // MidiClient attached to this frame; lazily initialized.
871 MidiDispatcher* midi_dispatcher_;
872
[email protected]a017938b2014-05-27 21:17:17873#if defined(OS_ANDROID)
[email protected]4b556cf2014-06-10 23:21:53874 // Manages all media players in this render frame for communicating with the
875 // real media player in the browser process. It's okay to use a raw pointer
876 // since it's a RenderFrameObserver.
[email protected]a017938b2014-05-27 21:17:17877 RendererMediaPlayerManager* media_player_manager_;
[email protected]4b556cf2014-06-10 23:21:53878#endif
879
880#if defined(ENABLE_BROWSER_CDMS)
881 // Manage all CDMs in this render frame for communicating with the real CDM in
882 // the browser process. It's okay to use a raw pointer since it's a
883 // RenderFrameObserver.
[email protected]65f3d1aa2014-05-29 01:57:00884 RendererCdmManager* cdm_manager_;
[email protected]a017938b2014-05-27 21:17:17885#endif
886
xhwangd7180832015-04-03 05:38:15887 // The CDM factory attached to this frame, lazily initialized.
888 RenderCdmFactory* cdm_factory_;
889
[email protected]a6e21c372014-07-12 02:27:21890#if defined(VIDEO_HOLE)
891 // Whether or not this RenderFrameImpl contains a media player. Used to
892 // register as an observer for video-hole-specific events.
893 bool contains_media_player_;
894#endif
895
dgozman358ba322015-03-26 15:05:30896 // The devtools agent for this frame; only created for main frame and
897 // local roots.
898 DevToolsAgent* devtools_agent_;
899
[email protected]45920862014-07-02 12:53:02900 // The geolocation dispatcher attached to this frame, lazily initialized.
[email protected]8eae0802014-06-02 21:35:55901 GeolocationDispatcher* geolocation_dispatcher_;
902
[email protected]45920862014-07-02 12:53:02903 // The push messaging dispatcher attached to this frame, lazily initialized.
904 PushMessagingDispatcher* push_messaging_dispatcher_;
905
avayvodbca35fad2015-01-29 20:20:57906 // The presentation dispatcher implementation attached to this frame, lazily
907 // initialized.
908 PresentationDispatcher* presentation_dispatcher_;
909
[email protected]c52a1412014-06-25 06:09:25910 ServiceRegistryImpl service_registry_;
911
[email protected]45920862014-07-02 12:53:02912 // The screen orientation dispatcher attached to the frame, lazily
913 // initialized.
[email protected]cf78eda2014-06-13 16:57:41914 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
915
mlamouriefdca9d2014-09-16 16:55:40916 // The Manifest Manager handles the manifest requests from the browser
917 // process.
918 ManifestManager* manifest_manager_;
919
[email protected]95640212014-07-26 18:14:30920 // The current accessibility mode.
921 AccessibilityMode accessibility_mode_;
922
923 // Only valid if |accessibility_mode_| is anything other than
924 // AccessibilityModeOff.
925 RendererAccessibility* renderer_accessibility_;
926
mlamouric6d31db2015-03-28 17:48:14927 scoped_ptr<PermissionDispatcher> permission_client_;
mlamouri670a86d2015-03-17 16:06:25928
avi485e5fd62014-08-25 23:26:14929#if defined(OS_MACOSX) || defined(OS_ANDROID)
930 // The external popup for the currently showing select popup.
931 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
932#endif
933
[email protected]96307312014-05-04 01:00:19934 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
935
[email protected]227692c52013-05-31 22:43:04936 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
937};
938
939} // namespace content
940
[email protected]85d85fd2013-06-19 00:57:41941#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_