[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 1 | // 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 | |
guidou | 3906a72 | 2015-11-12 22:14:42 | [diff] [blame^] | 8 | #include <string> |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 9 | #include <vector> |
| 10 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 11 | #include "base/basictypes.h" |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 12 | #include "base/files/file_path.h" |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 13 | #include "base/gtest_prod_util.h" |
| 14 | #include "base/id_map.h" |
xhwang | 430baee | 2015-01-22 05:46:20 | [diff] [blame] | 15 | #include "base/memory/scoped_ptr.h" |
[email protected] | abc501e | 2014-01-27 19:27:26 | [diff] [blame] | 16 | #include "base/memory/weak_ptr.h" |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 17 | #include "base/observer_list.h" |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 18 | #include "base/process/process_handle.h" |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 19 | #include "content/common/accessibility_mode_enums.h" |
clamy | da97e832 | 2014-10-07 21:57:25 | [diff] [blame] | 20 | #include "content/common/frame_message_enums.h" |
[email protected] | c52a141 | 2014-06-25 06:09:25 | [diff] [blame] | 21 | #include "content/common/mojo/service_registry_impl.h" |
peter | 4eb24200 | 2015-06-02 12:45:13 | [diff] [blame] | 22 | #include "content/public/common/console_message_level.h" |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 23 | #include "content/public/common/javascript_message_type.h" |
[email protected] | 65920f33 | 2014-03-04 21:14:18 | [diff] [blame] | 24 | #include "content/public/common/referrer.h" |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 25 | #include "content/public/renderer/render_frame.h" |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 26 | #include "content/renderer/render_frame_proxy.h" |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 27 | #include "content/renderer/renderer_webcookiejar_impl.h" |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 28 | #include "ipc/ipc_message.h" |
acolwell | 9e0840d | 2014-09-06 19:01:32 | [diff] [blame] | 29 | #include "media/blink/webmediaplayer_delegate.h" |
dalecurtis | 49f36388 | 2015-08-25 21:05:38 | [diff] [blame] | 30 | #include "media/blink/webmediaplayer_params.h" |
rockot | d926098 | 2015-08-21 22:26:30 | [diff] [blame] | 31 | #include "mojo/application/public/interfaces/service_provider.mojom.h" |
| 32 | #include "mojo/application/public/interfaces/shell.mojom.h" |
benwells | 04ab5b96 | 2015-05-06 08:29:40 | [diff] [blame] | 33 | #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h" |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 34 | #include "third_party/WebKit/public/web/WebAXObject.h" |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 35 | #include "third_party/WebKit/public/web/WebDataSource.h" |
| 36 | #include "third_party/WebKit/public/web/WebFrameClient.h" |
lazyboy | 70605c3 | 2015-11-03 01:27:31 | [diff] [blame] | 37 | #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" |
[email protected] | 68057554 | 2014-04-03 17:12:52 | [diff] [blame] | 38 | #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
skyostil | c3ed565 | 2015-10-19 16:28:46 | [diff] [blame] | 39 | #include "third_party/WebKit/public/web/WebMeaningfulLayout.h" |
lukasza | 2e296c3 | 2015-09-28 23:29:48 | [diff] [blame] | 40 | #include "third_party/WebKit/public/web/WebPageSerializerClient.h" |
twellington | 376424ad | 2015-05-04 18:57:25 | [diff] [blame] | 41 | #include "third_party/WebKit/public/web/WebScriptExecutionCallback.h" |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 42 | #include "ui/gfx/range/range.h" |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 43 | |
tommycli | d481c48 | 2014-12-03 01:50:41 | [diff] [blame] | 44 | #if defined(ENABLE_PLUGINS) |
tommycli | 59bd86c | 2014-12-10 02:09:38 | [diff] [blame] | 45 | #include "content/renderer/pepper/plugin_power_saver_helper.h" |
tommycli | d481c48 | 2014-12-03 01:50:41 | [diff] [blame] | 46 | #endif |
| 47 | |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 48 | #if defined(OS_ANDROID) |
| 49 | #include "content/renderer/media/android/renderer_media_player_manager.h" |
| 50 | #endif |
| 51 | |
xhwang | c0299ae3 | 2015-07-21 23:39:50 | [diff] [blame] | 52 | #if defined(ENABLE_MOJO_MEDIA) |
| 53 | #include "media/mojo/interfaces/service_factory.mojom.h" |
| 54 | #endif |
| 55 | |
clamy | 9bfeef4 | 2014-09-30 20:50:42 | [diff] [blame] | 56 | class GURL; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 57 | class TransportDIB; |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 58 | struct FrameMsg_NewFrame_WidgetParams; |
alexmos | e7da5a1 | 2015-04-09 02:22:16 | [diff] [blame] | 59 | struct FrameMsg_PostMessage_Params; |
dspell | e736c9db | 2015-04-03 04:53:16 | [diff] [blame] | 60 | struct FrameMsg_TextTrackSettings_Params; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 61 | |
| 62 | namespace blink { |
[email protected] | 5ee7f18 | 2014-04-25 19:45:26 | [diff] [blame] | 63 | class WebGeolocationClient; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 64 | class WebMouseEvent; |
[email protected] | 82ce5b9 | 2014-03-22 05:15:26 | [diff] [blame] | 65 | class WebContentDecryptionModule; |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 66 | class WebMediaPlayer; |
avayvod | bca35fad | 2015-01-29 20:20:57 | [diff] [blame] | 67 | class WebPresentationClient; |
[email protected] | 4592086 | 2014-07-02 12:53:02 | [diff] [blame] | 68 | class WebPushClient; |
[email protected] | 82ce5b9 | 2014-03-22 05:15:26 | [diff] [blame] | 69 | class WebSecurityOrigin; |
alogvinov | f50445a | 2015-10-30 13:00:12 | [diff] [blame] | 70 | class WebWakeLockClient; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 71 | struct WebCompositionUnderline; |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 72 | struct WebContextMenuData; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 73 | struct WebCursorInfo; |
dcheng | 3ce04b6 | 2015-10-26 23:30:55 | [diff] [blame] | 74 | struct WebScreenInfo; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | namespace gfx { |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 78 | class Point; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 79 | class Range; |
| 80 | class Rect; |
| 81 | } |
| 82 | |
jrummell | 109c3a60 | 2014-12-18 01:08:50 | [diff] [blame] | 83 | namespace media { |
xhwang | d718083 | 2015-04-03 05:38:15 | [diff] [blame] | 84 | class CdmFactory; |
xhwang | 60b430a | 2015-02-01 05:20:46 | [diff] [blame] | 85 | class MediaPermission; |
dalecurtis | a12e606 | 2015-11-10 23:13:14 | [diff] [blame] | 86 | class RendererWebMediaPlayerDelegate; |
jrummell | 109c3a60 | 2014-12-18 01:08:50 | [diff] [blame] | 87 | class WebEncryptedMediaClientImpl; |
| 88 | } |
| 89 | |
xhwang | 33f939e | 2015-06-23 04:33:42 | [diff] [blame] | 90 | namespace mojo { |
| 91 | class ServiceProvider; |
| 92 | } |
| 93 | |
tommycli | 58e3172c | 2015-09-15 18:18:26 | [diff] [blame] | 94 | namespace url { |
| 95 | class Origin; |
| 96 | } |
| 97 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 98 | namespace content { |
| 99 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 100 | class ChildFrameCompositingHelper; |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 101 | class CompositorDependencies; |
dgozman | 358ba32 | 2015-03-26 15:05:30 | [diff] [blame] | 102 | class DevToolsAgent; |
avi | 0392dbf5 | 2015-03-25 16:55:45 | [diff] [blame] | 103 | class DocumentState; |
avi | 485e5fd6 | 2014-08-25 23:26:14 | [diff] [blame] | 104 | class ExternalPopupMenu; |
[email protected] | 8eae080 | 2014-06-02 21:35:55 | [diff] [blame] | 105 | class GeolocationDispatcher; |
mlamouri | efdca9d | 2014-09-16 16:55:40 | [diff] [blame] | 106 | class ManifestManager; |
[email protected] | 977db4a4 | 2014-07-17 08:04:32 | [diff] [blame] | 107 | class MediaStreamDispatcher; |
[email protected] | ae2477e | 2014-05-27 23:47:08 | [diff] [blame] | 108 | class MediaStreamRendererFactory; |
guoweis | f4282b0 | 2015-09-24 23:05:22 | [diff] [blame] | 109 | class MediaPermissionDispatcherImpl; |
[email protected] | 52d3e17 | 2014-06-16 16:57:02 | [diff] [blame] | 110 | class MidiDispatcher; |
avi | 0392dbf5 | 2015-03-25 16:55:45 | [diff] [blame] | 111 | class NavigationState; |
[email protected] | 4459599e | 2014-07-29 22:40:09 | [diff] [blame] | 112 | class NotificationPermissionDispatcher; |
clamy | da97e832 | 2014-10-07 21:57:25 | [diff] [blame] | 113 | class PageState; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 114 | class PepperPluginInstanceImpl; |
mlamouri | c6d31db | 2015-03-28 17:48:14 | [diff] [blame] | 115 | class PermissionDispatcher; |
avayvod | bca35fad | 2015-01-29 20:20:57 | [diff] [blame] | 116 | class PresentationDispatcher; |
[email protected] | 4592086 | 2014-07-02 12:53:02 | [diff] [blame] | 117 | class PushMessagingDispatcher; |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 118 | class RendererAccessibility; |
[email protected] | 4b556cf | 2014-06-10 23:21:53 | [diff] [blame] | 119 | class RendererCdmManager; |
| 120 | class RendererMediaPlayerManager; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 121 | class RendererPpapiHost; |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 122 | class RenderFrameObserver; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 123 | class RenderViewImpl; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 124 | class RenderWidget; |
| 125 | class RenderWidgetFullscreenPepper; |
[email protected] | cf78eda | 2014-06-13 16:57:41 | [diff] [blame] | 126 | class ScreenOrientationDispatcher; |
perkj | 1a2d043 | 2014-09-03 13:52:33 | [diff] [blame] | 127 | class UserMediaClientImpl; |
alogvinov | f50445a | 2015-10-30 13:00:12 | [diff] [blame] | 128 | class WakeLockDispatcher; |
clamy | 9bfeef4 | 2014-09-30 20:50:42 | [diff] [blame] | 129 | struct CommonNavigationParams; |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 130 | struct CustomContextMenuContext; |
alexmos | bc7eafa | 2014-12-06 01:38:09 | [diff] [blame] | 131 | struct FrameReplicationState; |
avi | 0392dbf5 | 2015-03-25 16:55:45 | [diff] [blame] | 132 | struct NavigationParams; |
clamy | 79b3da6 | 2014-10-14 08:50:37 | [diff] [blame] | 133 | struct RequestNavigationParams; |
davidben | a5496d6 | 2014-10-07 18:52:04 | [diff] [blame] | 134 | struct ResourceResponseHead; |
clamy | 34e1278 | 2015-03-12 11:26:13 | [diff] [blame] | 135 | struct StartNavigationParams; |
clamy | d698303 | 2015-04-29 14:48:12 | [diff] [blame] | 136 | struct StreamOverrideParameters; |
bajones | 0244353 | 2015-06-22 21:17:40 | [diff] [blame] | 137 | class VRDispatcher; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 138 | |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 139 | class CONTENT_EXPORT RenderFrameImpl |
| 140 | : public RenderFrame, |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 141 | NON_EXPORTED_BASE(public blink::WebFrameClient), |
lukasza | 2e296c3 | 2015-09-28 23:29:48 | [diff] [blame] | 142 | NON_EXPORTED_BASE(public blink::WebPageSerializerClient) { |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 143 | public: |
dcheng | c5ef1a5 | 2015-08-26 20:58:30 | [diff] [blame] | 144 | // Creates a new RenderFrame as the main frame of |render_view|. |
dcheng | 3ce04b6 | 2015-10-26 23:30:55 | [diff] [blame] | 145 | static RenderFrameImpl* CreateMainFrame( |
| 146 | RenderViewImpl* render_view, |
| 147 | int32_t routing_id, |
| 148 | int32_t widget_routing_id, |
| 149 | bool hidden, |
| 150 | const blink::WebScreenInfo& screen_info, |
| 151 | CompositorDependencies* compositor_deps); |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 152 | |
alexmos | a181efc | 2015-09-03 00:39:04 | [diff] [blame] | 153 | // Creates a new RenderFrame with |routing_id|. If |proxy_routing_id| is |
| 154 | // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into |
| 155 | // the frame tree after the frame identified by |
| 156 | // |previous_sibling_routing_id|, or as the first child if |
alexmos | 9f8705a | 2015-05-06 19:58:59 | [diff] [blame] | 157 | // |previous_sibling_routing_id| is MSG_ROUTING_NONE. Otherwise, the frame is |
| 158 | // semi-orphaned until it commits, at which point it replaces the proxy |
alexmos | a181efc | 2015-09-03 00:39:04 | [diff] [blame] | 159 | // identified by |proxy_routing_id|. The frame's opener is set to the frame |
| 160 | // identified by |opener_routing_id|. The frame is created as a child of the |
| 161 | // RenderFrame identified by |parent_routing_id| or as the top-level frame if |
| 162 | // the latter is MSG_ROUTING_NONE. Note: This is called only when |
alexmos | 9f8705a | 2015-05-06 19:58:59 | [diff] [blame] | 163 | // RenderFrame is being created in response to IPC message from the browser |
| 164 | // process. All other frame creation is driven through Blink and Create. |
lazyboy | 70605c3 | 2015-11-03 01:27:31 | [diff] [blame] | 165 | static void CreateFrame( |
| 166 | int routing_id, |
| 167 | int proxy_routing_id, |
| 168 | int opener_routing_id, |
| 169 | int parent_routing_id, |
| 170 | int previous_sibling_routing_id, |
| 171 | const FrameReplicationState& replicated_state, |
| 172 | CompositorDependencies* compositor_deps, |
| 173 | const FrameMsg_NewFrame_WidgetParams& params, |
| 174 | const blink::WebFrameOwnerProperties& frameOwner_properties); |
[email protected] | 82307f6b | 2014-08-07 03:30:12 | [diff] [blame] | 175 | |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 176 | // Returns the RenderFrameImpl for the given routing ID. |
| 177 | static RenderFrameImpl* FromRoutingID(int routing_id); |
| 178 | |
[email protected] | a5ac6dc | 2014-01-15 07:02:14 | [diff] [blame] | 179 | // Just like RenderFrame::FromWebFrame but returns the implementation. |
| 180 | static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame); |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 181 | |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 182 | // Used by content_layouttest_support to hook into the creation of |
| 183 | // RenderFrameImpls. |
jochen | 664198b | 2015-06-25 14:13:00 | [diff] [blame] | 184 | struct CreateParams { |
| 185 | CreateParams(RenderViewImpl* render_view, int32 routing_id) |
| 186 | : render_view(render_view), routing_id(routing_id) {} |
| 187 | ~CreateParams() {} |
| 188 | |
| 189 | RenderViewImpl* render_view; |
| 190 | int32 routing_id; |
| 191 | }; |
| 192 | |
| 193 | using CreateRenderFrameImplFunction = |
| 194 | RenderFrameImpl* (*)(const CreateParams&); |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 195 | static void InstallCreateHook( |
dongseong.hwang | b721ddf | 2014-12-10 21:22:50 | [diff] [blame] | 196 | CreateRenderFrameImplFunction create_render_frame_impl); |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 197 | |
alexmos | 9573300 | 2015-08-24 16:38:09 | [diff] [blame] | 198 | // Looks up and returns the WebFrame corresponding to a given opener frame |
| 199 | // routing ID. Also stores the opener's RenderView routing ID into |
| 200 | // |opener_view_routing_id|. |
| 201 | // |
| 202 | // TODO(alexmos): remove RenderViewImpl's dependency on |
| 203 | // opener_view_routing_id. |
| 204 | static blink::WebFrame* ResolveOpener(int opener_frame_routing_id, |
| 205 | int* opener_view_routing_id); |
| 206 | |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 207 | ~RenderFrameImpl() override; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 208 | |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 209 | bool is_swapped_out() const { |
| 210 | return is_swapped_out_; |
| 211 | } |
| 212 | |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 213 | // TODO(nasko): This can be removed once we don't have a swapped out state on |
| 214 | // RenderFrames. See https://crbug.com/357747. |
| 215 | void set_render_frame_proxy(RenderFrameProxy* proxy) { |
| 216 | render_frame_proxy_ = proxy; |
| 217 | } |
| 218 | |
dglazkov | f0e1d6d | 2015-10-10 02:13:48 | [diff] [blame] | 219 | // Called by RenderWidget when meaningful layout has happened. |
| 220 | // See RenderFrameObserver::DidMeaningfulLayout declaration for details. |
| 221 | void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type); |
| 222 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 223 | // Out-of-process child frames receive a signal from RenderWidgetCompositor |
| 224 | // when a compositor frame has committed. |
| 225 | void DidCommitCompositorFrame(); |
| 226 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 227 | // TODO(jam): this is a temporary getter until all the code is transitioned |
| 228 | // to using RenderFrame instead of RenderView. |
[email protected] | abc501e | 2014-01-27 19:27:26 | [diff] [blame] | 229 | RenderViewImpl* render_view() { return render_view_.get(); } |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 230 | |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 231 | RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } |
| 232 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 233 | // Returns the RenderWidget associated with this frame. |
| 234 | RenderWidget* GetRenderWidget(); |
| 235 | |
dgozman | cf9039cd | 2015-04-06 12:01:31 | [diff] [blame] | 236 | DevToolsAgent* devtools_agent() { return devtools_agent_; } |
| 237 | |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 238 | // This is called right after creation with the WebLocalFrame for this |
[email protected] | 0287e76 | 2014-04-11 13:07:58 | [diff] [blame] | 239 | // RenderFrame. It must be called before Initialize. |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 240 | void SetWebFrame(blink::WebLocalFrame* web_frame); |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 241 | |
[email protected] | 0287e76 | 2014-04-11 13:07:58 | [diff] [blame] | 242 | // This method must be called after the frame has been added to the frame |
| 243 | // tree. It creates all objects that depend on the frame being at its proper |
| 244 | // spot. |
| 245 | void Initialize(); |
| 246 | |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 247 | // Notifications from RenderWidget. |
| 248 | void WasHidden(); |
| 249 | void WasShown(); |
dgozman | cf9039cd | 2015-04-06 12:01:31 | [diff] [blame] | 250 | void WidgetWillClose(); |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 251 | |
[email protected] | 723971b | 2014-02-12 11:08:25 | [diff] [blame] | 252 | // Start/Stop loading notifications. |
| 253 | // TODO(nasko): Those are page-level methods at this time and come from |
| 254 | // WebViewClient. We should move them to be WebFrameClient calls and put |
| 255 | // logic in the browser side to balance starts/stops. |
[email protected] | e3b10d1 | 2014-03-28 16:06:09 | [diff] [blame] | 256 | // |to_different_document| will be true unless the load is a fragment |
| 257 | // navigation, or triggered by history.pushState/replaceState. |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 258 | void didStartLoading(bool to_different_document) override; |
| 259 | void didStopLoading() override; |
| 260 | void didChangeLoadProgress(double load_progress) override; |
[email protected] | 723971b | 2014-02-12 11:08:25 | [diff] [blame] | 261 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 262 | AccessibilityMode accessibility_mode() { |
| 263 | return accessibility_mode_; |
| 264 | } |
| 265 | |
| 266 | RendererAccessibility* renderer_accessibility() { |
| 267 | return renderer_accessibility_; |
| 268 | } |
| 269 | |
| 270 | void HandleWebAccessibilityEvent(const blink::WebAXObject& obj, |
| 271 | blink::WebAXEvent event); |
| 272 | |
estade | 31c5434 | 2015-01-23 03:34:36 | [diff] [blame] | 273 | // The focused node changed to |node|. If focus was lost from this frame, |
| 274 | // |node| will be null. |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 275 | void FocusedNodeChanged(const blink::WebNode& node); |
| 276 | |
estade | 31c5434 | 2015-01-23 03:34:36 | [diff] [blame] | 277 | // TODO(dmazzoni): the only reason this is here is to plumb it through to |
| 278 | // RendererAccessibility. It should use the RenderFrameObserver method, once |
| 279 | // blink has a separate accessibility tree per frame. |
| 280 | void FocusedNodeChangedForAccessibility(const blink::WebNode& node); |
| 281 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 282 | #if defined(ENABLE_PLUGINS) |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 283 | // Notification that a PPAPI plugin has been created. |
| 284 | void PepperPluginCreated(RendererPpapiHost* host); |
| 285 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 286 | // Notifies that |instance| has changed the cursor. |
| 287 | // This will update the cursor appearance if it is currently over the plugin |
| 288 | // instance. |
| 289 | void PepperDidChangeCursor(PepperPluginInstanceImpl* instance, |
| 290 | const blink::WebCursorInfo& cursor); |
| 291 | |
| 292 | // Notifies that |instance| has received a mouse event. |
| 293 | void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance); |
| 294 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 295 | // Informs the render view that a PPAPI plugin has changed text input status. |
| 296 | void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance); |
| 297 | void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance); |
| 298 | |
| 299 | // Cancels current composition. |
| 300 | void PepperCancelComposition(PepperPluginInstanceImpl* instance); |
| 301 | |
| 302 | // Informs the render view that a PPAPI plugin has changed selection. |
| 303 | void PepperSelectionChanged(PepperPluginInstanceImpl* instance); |
| 304 | |
| 305 | // Creates a fullscreen container for a pepper plugin instance. |
| 306 | RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer( |
| 307 | PepperPluginInstanceImpl* plugin); |
| 308 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 309 | bool IsPepperAcceptingCompositionEvents() const; |
| 310 | |
| 311 | // Notification that the given plugin has crashed. |
| 312 | void PluginCrashed(const base::FilePath& plugin_path, |
| 313 | base::ProcessId plugin_pid); |
| 314 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 315 | // Simulates IME events for testing purpose. |
| 316 | void SimulateImeSetComposition( |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 317 | const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 318 | const std::vector<blink::WebCompositionUnderline>& underlines, |
| 319 | int selection_start, |
| 320 | int selection_end); |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 321 | void SimulateImeConfirmComposition(const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 322 | const gfx::Range& replacement_range); |
| 323 | |
| 324 | // TODO(jam): remove these once the IPC handler moves from RenderView to |
| 325 | // RenderFrame. |
| 326 | void OnImeSetComposition( |
tommycli | e6633ca7 | 2014-10-31 00:40:42 | [diff] [blame] | 327 | const base::string16& text, |
| 328 | const std::vector<blink::WebCompositionUnderline>& underlines, |
| 329 | int selection_start, |
| 330 | int selection_end); |
| 331 | void OnImeConfirmComposition(const base::string16& text, |
| 332 | const gfx::Range& replacement_range, |
| 333 | bool keep_selection); |
| 334 | #endif // defined(ENABLE_PLUGINS) |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 335 | |
[email protected] | 977db4a4 | 2014-07-17 08:04:32 | [diff] [blame] | 336 | // May return NULL in some cases, especially if userMediaClient() returns |
| 337 | // NULL. |
| 338 | MediaStreamDispatcher* GetMediaStreamDispatcher(); |
| 339 | |
avi | 485e5fd6 | 2014-08-25 23:26:14 | [diff] [blame] | 340 | #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 341 | void DidHideExternalPopupMenu(); |
| 342 | #endif |
| 343 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 344 | // IPC::Sender |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 345 | bool Send(IPC::Message* msg) override; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 346 | |
| 347 | // IPC::Listener |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 348 | bool OnMessageReceived(const IPC::Message& msg) override; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 349 | |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 350 | // RenderFrame implementation: |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 351 | RenderView* GetRenderView() override; |
| 352 | int GetRoutingID() override; |
| 353 | blink::WebLocalFrame* GetWebFrame() override; |
estade | 78d655f8 | 2015-01-30 01:55:08 | [diff] [blame] | 354 | blink::WebElement GetFocusedElement() const override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 355 | WebPreferences& GetWebkitPreferences() override; |
| 356 | int ShowContextMenu(ContextMenuClient* client, |
| 357 | const ContextMenuParams& params) override; |
| 358 | void CancelContextMenu(int request_id) override; |
| 359 | blink::WebNode GetContextMenuNode() const override; |
tommycli | 59bd86c | 2014-12-10 02:09:38 | [diff] [blame] | 360 | blink::WebPlugin* CreatePlugin( |
| 361 | blink::WebFrame* frame, |
| 362 | const WebPluginInfo& info, |
| 363 | const blink::WebPluginParams& params, |
tommycli | e872270 | 2015-01-16 11:40:41 | [diff] [blame] | 364 | scoped_ptr<PluginInstanceThrottler> throttler) override; |
japhet | b0bae9d8 | 2015-10-19 20:43:40 | [diff] [blame] | 365 | void LoadURLExternally(const blink::WebURLRequest& request, |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 366 | blink::WebNavigationPolicy policy) override; |
| 367 | void ExecuteJavaScript(const base::string16& javascript) override; |
dglazkov | 2e140f5 | 2015-09-28 16:10:07 | [diff] [blame] | 368 | bool IsMainFrame() override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 369 | bool IsHidden() override; |
| 370 | ServiceRegistry* GetServiceRegistry() override; |
tommycli | d481c48 | 2014-12-03 01:50:41 | [diff] [blame] | 371 | #if defined(ENABLE_PLUGINS) |
tommycli | 59bd86c | 2014-12-10 02:09:38 | [diff] [blame] | 372 | void RegisterPeripheralPlugin( |
tommycli | 58e3172c | 2015-09-15 18:18:26 | [diff] [blame] | 373 | const url::Origin& content_origin, |
tommycli | 59bd86c | 2014-12-10 02:09:38 | [diff] [blame] | 374 | const base::Closure& unthrottle_callback) override; |
tommycli | bae63b9 | 2015-10-23 02:56:20 | [diff] [blame] | 375 | bool ShouldThrottleContent(const url::Origin& main_frame_origin, |
| 376 | const url::Origin& content_origin, |
tommycli | bae63b9 | 2015-10-23 02:56:20 | [diff] [blame] | 377 | int width, |
| 378 | int height, |
| 379 | bool* cross_origin_main_content) const override; |
| 380 | void WhitelistContentOrigin(const url::Origin& content_origin) override; |
tommycli | d481c48 | 2014-12-03 01:50:41 | [diff] [blame] | 381 | #endif |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 382 | bool IsFTPDirectoryListing() override; |
| 383 | void AttachGuest(int element_instance_id) override; |
fsamuel | a95fef4 | 2014-12-03 20:16:52 | [diff] [blame] | 384 | void DetachGuest(int element_instance_id) override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 385 | void SetSelectedText(const base::string16& selection_text, |
| 386 | size_t offset, |
| 387 | const gfx::Range& range) override; |
| 388 | void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate, |
dcarney | 4410a7c9 | 2015-04-20 11:28:19 | [diff] [blame] | 389 | v8::Local<v8::Context> context) override; |
rdevlin.cronin | b2cec91 | 2015-06-24 20:36:01 | [diff] [blame] | 390 | void AddMessageToConsole(ConsoleMessageLevel level, |
| 391 | const std::string& message) override; |
megjablon | d5ac7d5 | 2015-10-22 23:56:12 | [diff] [blame] | 392 | bool IsUsingLoFi() const override; |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 393 | |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 394 | // blink::WebFrameClient implementation: |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 395 | blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame, |
| 396 | const blink::WebPluginParams& params) override; |
| 397 | blink::WebMediaPlayer* createMediaPlayer( |
srirama.m | 26f864d0 | 2015-07-14 05:21:46 | [diff] [blame] | 398 | blink::WebLocalFrame* frame, |
| 399 | const blink::WebURL& url, |
| 400 | blink::WebMediaPlayerClient* client, |
| 401 | blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
guidou | 9c3cc3e | 2015-10-27 13:38:15 | [diff] [blame] | 402 | blink::WebContentDecryptionModule* initial_cdm, |
| 403 | const blink::WebString& sink_id) override; |
davve | 50137b6 | 2015-10-23 12:15:21 | [diff] [blame] | 404 | blink::WebMediaSession* createMediaSession() override; |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 405 | blink::WebApplicationCacheHost* createApplicationCacheHost( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 406 | blink::WebLocalFrame* frame, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 407 | blink::WebApplicationCacheHostClient* client) override; |
| 408 | blink::WebWorkerContentSettingsClientProxy* |
| 409 | createWorkerContentSettingsClientProxy(blink::WebLocalFrame* frame) override; |
| 410 | blink::WebExternalPopupMenu* createExternalPopupMenu( |
[email protected] | b20c322 | 2014-08-22 00:50:22 | [diff] [blame] | 411 | const blink::WebPopupMenuInfo& popup_menu_info, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 412 | blink::WebExternalPopupMenuClient* popup_menu_client) override; |
| 413 | blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame) override; |
| 414 | blink::WebServiceWorkerProvider* createServiceWorkerProvider( |
| 415 | blink::WebLocalFrame* frame) override; |
| 416 | void didAccessInitialDocument(blink::WebLocalFrame* frame) override; |
| 417 | blink::WebFrame* createChildFrame( |
alexmos | e48b1df93 | 2015-01-16 01:34:17 | [diff] [blame] | 418 | blink::WebLocalFrame* parent, |
dcheng | 860817a | 2015-05-22 03:16:56 | [diff] [blame] | 419 | blink::WebTreeScopeType scope, |
| 420 | const blink::WebString& name, |
lazyboy | 70605c3 | 2015-11-03 01:27:31 | [diff] [blame] | 421 | blink::WebSandboxFlags sandboxFlags, |
| 422 | const blink::WebFrameOwnerProperties& frameOwnerProperties) override; |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 423 | void didChangeOpener(blink::WebFrame* frame) override; |
| 424 | void frameDetached(blink::WebFrame* frame, DetachType type) override; |
| 425 | void frameFocused() override; |
| 426 | void willClose(blink::WebFrame* frame) override; |
| 427 | void didChangeName(blink::WebLocalFrame* frame, |
| 428 | const blink::WebString& name) override; |
| 429 | void didChangeSandboxFlags(blink::WebFrame* child_frame, |
| 430 | blink::WebSandboxFlags flags) override; |
lazyboy | 70605c3 | 2015-11-03 01:27:31 | [diff] [blame] | 431 | virtual void didChangeFrameOwnerProperties( |
| 432 | blink::WebFrame* child_frame, |
| 433 | const blink::WebFrameOwnerProperties& frame_owner_properties) override; |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 434 | void didMatchCSS( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 435 | blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 436 | const blink::WebVector<blink::WebString>& newly_matching_selectors, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 437 | const blink::WebVector<blink::WebString>& stopped_matching_selectors) |
| 438 | override; |
| 439 | bool shouldReportDetailedMessageForSource( |
| 440 | const blink::WebString& source) override; |
| 441 | void didAddMessageToConsole(const blink::WebConsoleMessage& message, |
| 442 | const blink::WebString& source_name, |
| 443 | unsigned source_line, |
| 444 | const blink::WebString& stack_trace) override; |
japhet | b0bae9d8 | 2015-10-19 20:43:40 | [diff] [blame] | 445 | void loadURLExternally(const blink::WebURLRequest& request, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 446 | blink::WebNavigationPolicy policy, |
japhet | b0bae9d8 | 2015-10-19 20:43:40 | [diff] [blame] | 447 | const blink::WebString& suggested_name, |
| 448 | bool should_replace_current_entry) override; |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 449 | blink::WebNavigationPolicy decidePolicyForNavigation( |
| 450 | const NavigationPolicyInfo& info) override; |
| 451 | blink::WebHistoryItem historyItemForNewChildFrame( |
| 452 | blink::WebFrame* frame) override; |
| 453 | void willSendSubmitEvent(blink::WebLocalFrame* frame, |
| 454 | const blink::WebFormElement& form) override; |
| 455 | void willSubmitForm(blink::WebLocalFrame* frame, |
| 456 | const blink::WebFormElement& form) override; |
| 457 | void didCreateDataSource(blink::WebLocalFrame* frame, |
| 458 | blink::WebDataSource* datasource) override; |
| 459 | void didStartProvisionalLoad(blink::WebLocalFrame* frame, |
| 460 | double triggering_event_time) override; |
| 461 | void didReceiveServerRedirectForProvisionalLoad( |
| 462 | blink::WebLocalFrame* frame) override; |
| 463 | void didFailProvisionalLoad(blink::WebLocalFrame* frame, |
| 464 | const blink::WebURLError& error, |
| 465 | blink::WebHistoryCommitType commit_type) override; |
| 466 | void didCommitProvisionalLoad( |
[email protected] | 45d877f | 2014-04-05 07:36:22 | [diff] [blame] | 467 | blink::WebLocalFrame* frame, |
[email protected] | 68057554 | 2014-04-03 17:12:52 | [diff] [blame] | 468 | const blink::WebHistoryItem& item, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 469 | blink::WebHistoryCommitType commit_type) override; |
| 470 | void didCreateNewDocument(blink::WebLocalFrame* frame) override; |
| 471 | void didClearWindowObject(blink::WebLocalFrame* frame) override; |
| 472 | void didCreateDocumentElement(blink::WebLocalFrame* frame) override; |
| 473 | void didReceiveTitle(blink::WebLocalFrame* frame, |
| 474 | const blink::WebString& title, |
| 475 | blink::WebTextDirection direction) override; |
| 476 | void didChangeIcon(blink::WebLocalFrame* frame, |
| 477 | blink::WebIconURL::Type icon_type) override; |
| 478 | void didFinishDocumentLoad(blink::WebLocalFrame* frame, |
| 479 | bool document_is_empty) override; |
| 480 | void didHandleOnloadEvents(blink::WebLocalFrame* frame) override; |
| 481 | void didFailLoad(blink::WebLocalFrame* frame, |
| 482 | const blink::WebURLError& error, |
| 483 | blink::WebHistoryCommitType commit_type) override; |
| 484 | void didFinishLoad(blink::WebLocalFrame* frame) override; |
| 485 | void didNavigateWithinPage(blink::WebLocalFrame* frame, |
| 486 | const blink::WebHistoryItem& item, |
| 487 | blink::WebHistoryCommitType commit_type) override; |
| 488 | void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame) override; |
| 489 | void didChangeThemeColor() override; |
| 490 | void dispatchLoad() override; |
| 491 | void requestNotificationPermission( |
[email protected] | 4459599e | 2014-07-29 22:40:09 | [diff] [blame] | 492 | const blink::WebSecurityOrigin& origin, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 493 | blink::WebNotificationPermissionCallback* callback) override; |
| 494 | void didChangeSelection(bool is_empty_selection) override; |
| 495 | blink::WebColorChooser* createColorChooser( |
[email protected] | eb8c216a | 2014-04-09 19:19:19 | [diff] [blame] | 496 | blink::WebColorChooserClient* client, |
[email protected] | f3c59d6 | 2014-04-09 16:33:55 | [diff] [blame] | 497 | const blink::WebColor& initial_color, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 498 | const blink::WebVector<blink::WebColorSuggestion>& suggestions) override; |
| 499 | void runModalAlertDialog(const blink::WebString& message) override; |
| 500 | bool runModalConfirmDialog(const blink::WebString& message) override; |
| 501 | bool runModalPromptDialog(const blink::WebString& message, |
| 502 | const blink::WebString& default_value, |
| 503 | blink::WebString* actual_value) override; |
| 504 | bool runModalBeforeUnloadDialog(bool is_reload, |
| 505 | const blink::WebString& message) override; |
| 506 | void showContextMenu(const blink::WebContextMenuData& data) override; |
| 507 | void clearContextMenu() override; |
| 508 | void willSendRequest(blink::WebLocalFrame* frame, |
| 509 | unsigned identifier, |
| 510 | blink::WebURLRequest& request, |
| 511 | const blink::WebURLResponse& redirect_response) override; |
| 512 | void didReceiveResponse(blink::WebLocalFrame* frame, |
| 513 | unsigned identifier, |
| 514 | const blink::WebURLResponse& response) override; |
| 515 | void didLoadResourceFromMemoryCache( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 516 | blink::WebLocalFrame* frame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 517 | const blink::WebURLRequest& request, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 518 | const blink::WebURLResponse& response) override; |
| 519 | void didDisplayInsecureContent() override; |
| 520 | void didRunInsecureContent(const blink::WebSecurityOrigin& origin, |
| 521 | const blink::WebURL& target) override; |
| 522 | void didChangePerformanceTiming() override; |
| 523 | void didAbortLoading(blink::WebLocalFrame* frame) override; |
| 524 | void didCreateScriptContext(blink::WebLocalFrame* frame, |
| 525 | v8::Local<v8::Context> context, |
| 526 | int extension_group, |
| 527 | int world_id) override; |
| 528 | void willReleaseScriptContext(blink::WebLocalFrame* frame, |
| 529 | v8::Local<v8::Context> context, |
| 530 | int world_id) override; |
| 531 | void didChangeScrollOffset(blink::WebLocalFrame* frame) override; |
| 532 | void willInsertBody(blink::WebLocalFrame* frame) override; |
| 533 | void reportFindInPageMatchCount(int request_id, |
| 534 | int count, |
| 535 | bool final_update) override; |
| 536 | void reportFindInPageSelection(int request_id, |
| 537 | int active_match_ordinal, |
| 538 | const blink::WebRect& sel) override; |
| 539 | void requestStorageQuota(blink::WebLocalFrame* frame, |
| 540 | blink::WebStorageQuotaType type, |
| 541 | unsigned long long requested_size, |
| 542 | blink::WebStorageQuotaCallbacks callbacks) override; |
| 543 | void willOpenWebSocket(blink::WebSocketHandle* handle) override; |
alogvinov | f50445a | 2015-10-30 13:00:12 | [diff] [blame] | 544 | blink::WebWakeLockClient* wakeLockClient() override; |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 545 | blink::WebGeolocationClient* geolocationClient() override; |
| 546 | blink::WebPushClient* pushClient() override; |
| 547 | blink::WebPresentationClient* presentationClient() override; |
| 548 | void willStartUsingPeerConnectionHandler( |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 549 | blink::WebLocalFrame* frame, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 550 | blink::WebRTCPeerConnectionHandler* handler) override; |
| 551 | blink::WebUserMediaClient* userMediaClient() override; |
| 552 | blink::WebEncryptedMediaClient* encryptedMediaClient() override; |
| 553 | blink::WebMIDIClient* webMIDIClient() override; |
| 554 | bool willCheckAndDispatchMessageEvent( |
[email protected] | ce5064f | 2014-05-07 22:49:20 | [diff] [blame] | 555 | blink::WebLocalFrame* source_frame, |
| 556 | blink::WebFrame* target_frame, |
| 557 | blink::WebSecurityOrigin target_origin, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 558 | blink::WebDOMMessageEvent event) override; |
tzik | 34958ad6 | 2015-10-08 14:07:45 | [diff] [blame] | 559 | blink::WebString userAgentOverride(blink::WebLocalFrame* frame) override; |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 560 | blink::WebString doNotTrackValue(blink::WebLocalFrame* frame) override; |
| 561 | bool allowWebGL(blink::WebLocalFrame* frame, bool default_value) override; |
| 562 | void didLoseWebGLContext(blink::WebLocalFrame* frame, |
| 563 | int arb_robustness_status_code) override; |
| 564 | blink::WebScreenOrientationClient* webScreenOrientationClient() override; |
| 565 | bool isControlledByServiceWorker(blink::WebDataSource& data_source) override; |
| 566 | int64_t serviceWorkerID(blink::WebDataSource& data_source) override; |
| 567 | void postAccessibilityEvent(const blink::WebAXObject& obj, |
| 568 | blink::WebAXEvent event) override; |
| 569 | void handleAccessibilityFindInPageResult( |
| 570 | int identifier, |
| 571 | int match_index, |
| 572 | const blink::WebAXObject& start_object, |
| 573 | int start_offset, |
| 574 | const blink::WebAXObject& end_object, |
| 575 | int end_offset) override; |
| 576 | void didChangeManifest(blink::WebLocalFrame*) override; |
| 577 | bool enterFullscreen() override; |
| 578 | bool exitFullscreen() override; |
| 579 | blink::WebPermissionClient* permissionClient() override; |
| 580 | blink::WebAppBannerClient* appBannerClient() override; |
| 581 | void registerProtocolHandler(const blink::WebString& scheme, |
| 582 | const blink::WebURL& url, |
| 583 | const blink::WebString& title) override; |
| 584 | void unregisterProtocolHandler(const blink::WebString& scheme, |
| 585 | const blink::WebURL& url) override; |
| 586 | blink::WebBluetooth* bluetooth() override; |
| 587 | blink::WebUSBClient* usbClient() override; |
guidou | 3906a72 | 2015-11-12 22:14:42 | [diff] [blame^] | 588 | void checkIfAudioSinkExistsAndIsAuthorized( |
| 589 | const blink::WebString& sink_id, |
| 590 | const blink::WebSecurityOrigin& security_origin, |
| 591 | blink::WebSetSinkIdCallbacks* web_callbacks) override; |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 592 | |
bajones | 0244353 | 2015-06-22 21:17:40 | [diff] [blame] | 593 | #if defined(ENABLE_WEBVR) |
| 594 | blink::WebVRClient* webVRClient() override; |
| 595 | #endif |
| 596 | |
lukasza | 2e296c3 | 2015-09-28 23:29:48 | [diff] [blame] | 597 | // WebPageSerializerClient implementation: |
| 598 | void didSerializeDataForFrame( |
lukasza | 2e296c3 | 2015-09-28 23:29:48 | [diff] [blame] | 599 | const blink::WebCString& data, |
| 600 | blink::WebPageSerializerClient::PageSerializationStatus status) override; |
| 601 | |
nasko | 78f06bc | 2014-11-18 18:18:57 | [diff] [blame] | 602 | // Make this frame show an empty, unscriptable page. |
| 603 | // TODO(nasko): Remove this method once swapped out state is no longer used. |
| 604 | void NavigateToSwappedOutURL(); |
| 605 | |
rockot | 775ce0d | 2015-01-27 18:35:01 | [diff] [blame] | 606 | // Binds this render frame's service registry. |
[email protected] | c52a141 | 2014-06-25 06:09:25 | [diff] [blame] | 607 | void BindServiceRegistry( |
rockot | 775ce0d | 2015-01-27 18:35:01 | [diff] [blame] | 608 | mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 609 | mojo::ServiceProviderPtr exposed_services); |
[email protected] | c52a141 | 2014-06-25 06:09:25 | [diff] [blame] | 610 | |
mlamouri | 4fff199 | 2014-09-30 11:22:46 | [diff] [blame] | 611 | ManifestManager* manifest_manager(); |
| 612 | |
avi | 0392dbf5 | 2015-03-25 16:55:45 | [diff] [blame] | 613 | // TODO(creis): Remove when the only caller, the HistoryController, is no |
| 614 | // more. |
| 615 | void SetPendingNavigationParams( |
| 616 | scoped_ptr<NavigationParams> navigation_params); |
| 617 | |
guoweis | f4282b0 | 2015-09-24 23:05:22 | [diff] [blame] | 618 | // Expose MediaPermission to the non-UI threads. Any calls to this will be |
| 619 | // redirected to |media_permission_dispatcher_| on UI thread and have the |
| 620 | // callback called on |caller_task_runner|. |
| 621 | scoped_ptr<media::MediaPermission> CreateMediaPermissionProxy( |
| 622 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner); |
| 623 | |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 624 | protected: |
jochen | 664198b | 2015-06-25 14:13:00 | [diff] [blame] | 625 | explicit RenderFrameImpl(const CreateParams& params); |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 626 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 627 | private: |
kenrb | f98a4d2 | 2015-04-01 21:59:35 | [diff] [blame] | 628 | friend class RenderFrameImplTest; |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 629 | friend class RenderFrameObserver; |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 630 | friend class RendererAccessibilityTest; |
clamy | 98a9dee0 | 2015-06-24 16:09:10 | [diff] [blame] | 631 | friend class TestRenderFrame; |
avi | 485e5fd6 | 2014-08-25 23:26:14 | [diff] [blame] | 632 | FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem); |
| 633 | FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange); |
| 634 | FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase); |
| 635 | FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate); |
[email protected] | 66bbadaf | 2014-03-28 16:25:54 | [diff] [blame] | 636 | FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest, |
| 637 | AccessibilityMessagesQueueWhileSwappedOut); |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 638 | |
twellington | 376424ad | 2015-05-04 18:57:25 | [diff] [blame] | 639 | // A wrapper class used as the callback for JavaScript executed |
| 640 | // in an isolated world. |
| 641 | class JavaScriptIsolatedWorldRequest |
| 642 | : public blink::WebScriptExecutionCallback { |
| 643 | public: |
| 644 | JavaScriptIsolatedWorldRequest( |
| 645 | int id, |
| 646 | bool notify_result, |
| 647 | int routing_id, |
| 648 | base::WeakPtr<RenderFrameImpl> render_frame_impl); |
| 649 | void completed( |
| 650 | const blink::WebVector<v8::Local<v8::Value>>& result) override; |
| 651 | |
| 652 | private: |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 653 | ~JavaScriptIsolatedWorldRequest() override; |
twellington | 376424ad | 2015-05-04 18:57:25 | [diff] [blame] | 654 | |
| 655 | int id_; |
| 656 | bool notify_result_; |
| 657 | int routing_id_; |
| 658 | base::WeakPtr<RenderFrameImpl> render_frame_impl_; |
| 659 | |
| 660 | DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest); |
| 661 | }; |
| 662 | |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 663 | typedef std::map<GURL, double> HostZoomLevels; |
| 664 | |
dcheng | c5ef1a5 | 2015-08-26 20:58:30 | [diff] [blame] | 665 | // Creates a new RenderFrame. |render_view| is the RenderView object that this |
| 666 | // frame belongs to. |
| 667 | // Callers *must* call |SetWebFrame| immediately after creation. |
| 668 | static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); |
| 669 | |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 670 | // Functions to add and remove observers for this object. |
| 671 | void AddObserver(RenderFrameObserver* observer); |
| 672 | void RemoveObserver(RenderFrameObserver* observer); |
[email protected] | 1c2052f | 2013-08-28 08:24:34 | [diff] [blame] | 673 | |
dcheng | 3d886b73 | 2015-11-05 19:16:01 | [diff] [blame] | 674 | bool IsLocalRoot() const; |
| 675 | |
[email protected] | f0906a0 | 2014-08-07 07:18:55 | [diff] [blame] | 676 | // Builds and sends DidCommitProvisionalLoad to the host. |
avi | 8c46f7e | 2015-02-03 18:27:35 | [diff] [blame] | 677 | void SendDidCommitProvisionalLoad(blink::WebFrame* frame, |
creis | 8b5cd4c | 2015-06-19 00:11:08 | [diff] [blame] | 678 | blink::WebHistoryCommitType commit_type, |
| 679 | const blink::WebHistoryItem& item); |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 680 | |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 681 | // IPC message handlers ------------------------------------------------------ |
| 682 | // |
| 683 | // The documentation for these functions should be in |
| 684 | // content/common/*_messages.h for the message that the function is handling. |
clamy | 98a9dee0 | 2015-06-24 16:09:10 | [diff] [blame] | 685 | void OnNavigate(const CommonNavigationParams& common_params, |
| 686 | const StartNavigationParams& start_params, |
| 687 | const RequestNavigationParams& request_params); |
[email protected] | f76f3223 | 2014-03-11 17:36:17 | [diff] [blame] | 688 | void OnBeforeUnload(); |
alexmos | bc7eafa | 2014-12-06 01:38:09 | [diff] [blame] | 689 | void OnSwapOut(int proxy_routing_id, |
nasko | 3e8c20e | 2014-12-18 06:54:56 | [diff] [blame] | 690 | bool is_loading, |
alexmos | bc7eafa | 2014-12-06 01:38:09 | [diff] [blame] | 691 | const FrameReplicationState& replicated_frame_state); |
Nasko Oskov | 85f6022 | 2014-08-28 22:53:30 | [diff] [blame] | 692 | void OnStop(); |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 693 | void OnShowContextMenu(const gfx::Point& location); |
| 694 | void OnContextMenuClosed(const CustomContextMenuContext& custom_context); |
| 695 | void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context, |
| 696 | unsigned action); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 697 | void OnUndo(); |
| 698 | void OnRedo(); |
[email protected] | 9c9343b | 2014-03-08 02:56:07 | [diff] [blame] | 699 | void OnCut(); |
| 700 | void OnCopy(); |
| 701 | void OnPaste(); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 702 | void OnPasteAndMatchStyle(); |
| 703 | void OnDelete(); |
| 704 | void OnSelectAll(); |
christiank | aeed986 | 2014-11-05 10:49:14 | [diff] [blame] | 705 | void OnSelectRange(const gfx::Point& base, const gfx::Point& extent); |
aurimas | ab031902 | 2015-07-10 21:57:38 | [diff] [blame] | 706 | void OnAdjustSelectionByCharacterOffset(int start_adjust, int end_adjust); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 707 | void OnUnselect(); |
christiank | aeed986 | 2014-11-05 10:49:14 | [diff] [blame] | 708 | void OnMoveRangeSelectionExtent(const gfx::Point& point); |
[email protected] | 1f3fc1d | 2014-04-03 14:50:17 | [diff] [blame] | 709 | void OnReplace(const base::string16& text); |
| 710 | void OnReplaceMisspelling(const base::string16& text); |
[email protected] | e31b8ebb | 2014-03-07 17:59:34 | [diff] [blame] | 711 | void OnCSSInsertRequest(const std::string& css); |
peter | 4eb24200 | 2015-06-02 12:45:13 | [diff] [blame] | 712 | void OnAddMessageToConsole(ConsoleMessageLevel level, |
| 713 | const std::string& message); |
[email protected] | f13ab89 | 2014-03-12 06:48:52 | [diff] [blame] | 714 | void OnJavaScriptExecuteRequest(const base::string16& javascript, |
| 715 | int id, |
| 716 | bool notify_result); |
zeeshanq | 3454e9c | 2014-09-04 21:30:28 | [diff] [blame] | 717 | void OnJavaScriptExecuteRequestForTests(const base::string16& javascript, |
| 718 | int id, |
jochen | 2e7d95b | 2015-05-04 15:28:50 | [diff] [blame] | 719 | bool notify_result, |
| 720 | bool has_user_gesture); |
twellington | 376424ad | 2015-05-04 18:57:25 | [diff] [blame] | 721 | void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript, |
| 722 | int id, |
| 723 | bool notify_result, |
| 724 | int world_id); |
igsolla | 1cea67b7 | 2015-02-11 16:25:04 | [diff] [blame] | 725 | void OnVisualStateRequest(uint64 key); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 726 | void OnSetEditableSelectionOffsets(int start, int end); |
[email protected] | e5e438d6 | 2014-03-27 21:47:16 | [diff] [blame] | 727 | void OnSetCompositionFromExistingText( |
| 728 | int start, int end, |
| 729 | const std::vector<blink::WebCompositionUnderline>& underlines); |
sammc | bc9e9933 | 2014-12-18 00:55:24 | [diff] [blame] | 730 | void OnExecuteNoValueEditCommand(const std::string& name); |
[email protected] | e5e438d6 | 2014-03-27 21:47:16 | [diff] [blame] | 731 | void OnExtendSelectionAndDelete(int before, int after); |
[email protected] | 4fed370 | 2014-04-01 09:08:00 | [diff] [blame] | 732 | void OnReload(bool ignore_cache); |
[email protected] | 96bb613 | 2014-06-16 17:22:19 | [diff] [blame] | 733 | void OnTextSurroundingSelectionRequest(size_t max_length); |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 734 | void OnSetAccessibilityMode(AccessibilityMode new_mode); |
dmazzoni | 83ba5c8 | 2015-04-14 07:11:51 | [diff] [blame] | 735 | void OnSnapshotAccessibilityTree(int callback_id); |
alexmos | 9573300 | 2015-08-24 16:38:09 | [diff] [blame] | 736 | void OnUpdateOpener(int opener_routing_id); |
dcheng | 5f60abb | 2015-05-28 01:39:36 | [diff] [blame] | 737 | void OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags); |
lazyboy | 70605c3 | 2015-11-03 01:27:31 | [diff] [blame] | 738 | void OnSetFrameOwnerProperties( |
| 739 | const blink::WebFrameOwnerProperties& frame_owner_properties); |
dspell | e736c9db | 2015-04-03 04:53:16 | [diff] [blame] | 740 | void OnTextTrackSettingsChanged( |
| 741 | const FrameMsg_TextTrackSettings_Params& params); |
alexmos | e7da5a1 | 2015-04-09 02:22:16 | [diff] [blame] | 742 | void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params); |
avi | 485e5fd6 | 2014-08-25 23:26:14 | [diff] [blame] | 743 | #if defined(OS_ANDROID) |
| 744 | void OnSelectPopupMenuItems(bool canceled, |
| 745 | const std::vector<int>& selected_indices); |
| 746 | #elif defined(OS_MACOSX) |
| 747 | void OnSelectPopupMenuItem(int selected_index); |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 748 | void OnCopyToFindPboard(); |
| 749 | #endif |
[email protected] | 9c9343b | 2014-03-08 02:56:07 | [diff] [blame] | 750 | |
davidben | a5496d6 | 2014-10-07 18:52:04 | [diff] [blame] | 751 | void OnCommitNavigation(const ResourceResponseHead& response, |
| 752 | const GURL& stream_url, |
clamy | 9bfeef4 | 2014-09-30 20:50:42 | [diff] [blame] | 753 | const CommonNavigationParams& common_params, |
clamy | 57b4b8e | 2015-03-24 13:32:11 | [diff] [blame] | 754 | const RequestNavigationParams& request_params); |
clamy | 62b271d | 2015-04-16 11:54:57 | [diff] [blame] | 755 | void OnFailedNavigation(const CommonNavigationParams& common_params, |
| 756 | const RequestNavigationParams& request_params, |
| 757 | bool has_stale_copy_in_cache, |
| 758 | int error_code); |
lukasza | 6af746b7 | 2015-09-18 23:37:22 | [diff] [blame] | 759 | void OnGetSavableResourceLinks(); |
lukasza | 2e296c3 | 2015-09-28 23:29:48 | [diff] [blame] | 760 | void OnGetSerializedHtmlWithLocalLinks( |
| 761 | std::vector<GURL> original_urls, |
| 762 | std::vector<base::FilePath> equivalent_local_paths, |
| 763 | base::FilePath local_directory_path); |
clamy | 9bfeef4 | 2014-09-30 20:50:42 | [diff] [blame] | 764 | |
japhet | b0bae9d8 | 2015-10-19 20:43:40 | [diff] [blame] | 765 | void OpenURL(const GURL& url, |
[email protected] | 65920f33 | 2014-03-04 21:14:18 | [diff] [blame] | 766 | const Referrer& referrer, |
japhet | b0bae9d8 | 2015-10-19 20:43:40 | [diff] [blame] | 767 | blink::WebNavigationPolicy policy, |
| 768 | bool should_replace_current_entry); |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 769 | |
clamy | d698303 | 2015-04-29 14:48:12 | [diff] [blame] | 770 | // Performs a navigation in the frame. This provides a unified function for |
| 771 | // the current code path and the browser-side navigation path (in |
| 772 | // development). Currently used by OnNavigate, with all *NavigationParams |
| 773 | // provided by the browser. |stream_params| should be null. |
| 774 | // PlzNavigate: used by OnCommitNavigation, with |common_params| and |
| 775 | // |request_params| received by the browser. |stream_params| should be non |
| 776 | // null and created from the information provided by the browser. |
| 777 | // |start_params| is not used. |
| 778 | void NavigateInternal(const CommonNavigationParams& common_params, |
| 779 | const StartNavigationParams& start_params, |
| 780 | const RequestNavigationParams& request_params, |
| 781 | scoped_ptr<StreamOverrideParameters> stream_params); |
| 782 | |
[email protected] | ef3adfc | 2014-05-11 00:04:54 | [diff] [blame] | 783 | // Update current main frame's encoding and send it to browser window. |
| 784 | // Since we want to let users see the right encoding info from menu |
| 785 | // before finishing loading, we call the UpdateEncoding in |
| 786 | // a) function:DidCommitLoadForFrame. When this function is called, |
| 787 | // that means we have got first data. In here we try to get encoding |
| 788 | // of page if it has been specified in http header. |
| 789 | // b) function:DidReceiveTitle. When this function is called, |
| 790 | // that means we have got specified title. Because in most of webpages, |
| 791 | // title tags will follow meta tags. In here we try to get encoding of |
| 792 | // page if it has been specified in meta tag. |
| 793 | // c) function:DidFinishDocumentLoadForFrame. When this function is |
| 794 | // called, that means we have got whole html page. In here we should |
| 795 | // finally get right encoding of page. |
| 796 | void UpdateEncoding(blink::WebFrame* frame, |
| 797 | const std::string& encoding_name); |
| 798 | |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 799 | // Dispatches the current state of selection on the webpage to the browser if |
| 800 | // it has changed. |
| 801 | // TODO(varunjain): delete this method once we figure out how to keep |
| 802 | // selection handles in sync with the webpage. |
| 803 | void SyncSelectionIfRequired(); |
| 804 | |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 805 | bool RunJavaScriptMessage(JavaScriptMessageType type, |
| 806 | const base::string16& message, |
| 807 | const base::string16& default_value, |
| 808 | const GURL& frame_url, |
| 809 | base::string16* result); |
| 810 | |
[email protected] | 457736d | 2014-04-30 15:54:27 | [diff] [blame] | 811 | // Loads the appropriate error page for the specified failure into the frame. |
| 812 | void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request, |
| 813 | const blink::WebURLError& error, |
| 814 | bool replace); |
| 815 | |
zeeshanq | 3454e9c | 2014-09-04 21:30:28 | [diff] [blame] | 816 | void HandleJavascriptExecutionResult(const base::string16& javascript, |
| 817 | int id, |
| 818 | bool notify_result, |
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 819 | v8::Local<v8::Value> result); |
zeeshanq | 3454e9c | 2014-09-04 21:30:28 | [diff] [blame] | 820 | |
[email protected] | 977db4a4 | 2014-07-17 08:04:32 | [diff] [blame] | 821 | // Initializes |web_user_media_client_|. If this fails, because it wasn't |
| 822 | // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then |
| 823 | // |web_user_media_client_| will remain NULL. |
| 824 | void InitializeUserMediaClient(); |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 825 | |
| 826 | blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream( |
guidou | 9c3cc3e | 2015-10-27 13:38:15 | [diff] [blame] | 827 | blink::WebMediaPlayerClient* client, |
| 828 | const blink::WebString& sink_id, |
| 829 | const blink::WebSecurityOrigin& security_origin); |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 830 | |
[email protected] | ae2477e | 2014-05-27 23:47:08 | [diff] [blame] | 831 | // Creates a factory object used for creating audio and video renderers. |
jochen | 5126513 | 2015-05-28 07:33:45 | [diff] [blame] | 832 | scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory(); |
[email protected] | ae2477e | 2014-05-27 23:47:08 | [diff] [blame] | 833 | |
avi | 5cad491 | 2015-06-19 05:25:44 | [diff] [blame] | 834 | // Does preparation for the navigation to |url|. |
| 835 | void PrepareRenderViewForNavigation( |
clamy | da97e832 | 2014-10-07 21:57:25 | [diff] [blame] | 836 | const GURL& url, |
clamy | 57b4b8e | 2015-03-24 13:32:11 | [diff] [blame] | 837 | const RequestNavigationParams& request_params, |
clamy | da97e832 | 2014-10-07 21:57:25 | [diff] [blame] | 838 | bool* is_reload, |
| 839 | blink::WebURLRequest::CachePolicy* cache_policy); |
| 840 | |
clamy | ece3888 | 2014-11-19 15:00:20 | [diff] [blame] | 841 | // PlzNavigate |
| 842 | // Sends a FrameHostMsg_BeginNavigation to the browser based on the contents |
| 843 | // of the WebURLRequest. |
| 844 | void BeginNavigation(blink::WebURLRequest* request); |
| 845 | |
clamy | 4cc9b820 | 2015-03-02 13:51:36 | [diff] [blame] | 846 | // Loads a data url. |
| 847 | void LoadDataURL(const CommonNavigationParams& params, |
| 848 | blink::WebFrame* frame); |
| 849 | |
creis | 8eb8ef2 | 2015-11-04 22:51:38 | [diff] [blame] | 850 | // Sends the current frame's navigation state to the browser. |
| 851 | void SendUpdateState(); |
| 852 | |
clamy | 62b271d | 2015-04-16 11:54:57 | [diff] [blame] | 853 | // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for |
| 854 | // the failed request |request|. |
| 855 | void SendFailedProvisionalLoad(const blink::WebURLRequest& request, |
| 856 | const blink::WebURLError& error, |
| 857 | blink::WebLocalFrame* frame); |
| 858 | |
| 859 | bool ShouldDisplayErrorPageForFailedLoad(int error_code, |
| 860 | const GURL& unreachable_url); |
| 861 | |
[email protected] | f3a9531 | 2014-06-12 16:46:58 | [diff] [blame] | 862 | // Returns the URL being loaded by the |frame_|'s request. |
| 863 | GURL GetLoadingUrl() const; |
| 864 | |
avi | 0392dbf5 | 2015-03-25 16:55:45 | [diff] [blame] | 865 | // If we initiated a navigation, this function will populate |document_state| |
| 866 | // with the navigation information saved in OnNavigate(). |
| 867 | void PopulateDocumentStateFromPending(DocumentState* document_state); |
| 868 | |
| 869 | // Returns a new NavigationState populated with the navigation information |
| 870 | // saved in OnNavigate(). |
| 871 | NavigationState* CreateNavigationStateFromPending(); |
| 872 | |
csharrison | 1ce0e85 | 2015-11-07 16:45:13 | [diff] [blame] | 873 | // Sets the NavigationState on the DocumentState based on |
| 874 | // the value of |pending_navigation_params_|. |
| 875 | void UpdateNavigationState(DocumentState* document_state); |
| 876 | |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 877 | #if defined(OS_ANDROID) |
[email protected] | 65f3d1aa | 2014-05-29 01:57:00 | [diff] [blame] | 878 | blink::WebMediaPlayer* CreateAndroidWebMediaPlayer( |
jrummell | 65b7d27 | 2014-09-24 20:49:27 | [diff] [blame] | 879 | blink::WebMediaPlayerClient* client, |
srirama.m | 26f864d0 | 2015-07-14 05:21:46 | [diff] [blame] | 880 | blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
dalecurtis | 49f36388 | 2015-08-25 21:05:38 | [diff] [blame] | 881 | const media::WebMediaPlayerParams& params); |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 882 | |
[email protected] | 65f3d1aa | 2014-05-29 01:57:00 | [diff] [blame] | 883 | RendererMediaPlayerManager* GetMediaPlayerManager(); |
[email protected] | 4b556cf | 2014-06-10 23:21:53 | [diff] [blame] | 884 | #endif |
| 885 | |
sandersd | 02d9aea | 2015-05-12 02:29:26 | [diff] [blame] | 886 | bool AreSecureCodecsSupported(); |
xhwang | 33f939e | 2015-06-23 04:33:42 | [diff] [blame] | 887 | |
xhwang | d718083 | 2015-04-03 05:38:15 | [diff] [blame] | 888 | media::MediaPermission* GetMediaPermission(); |
xhwang | 33f939e | 2015-06-23 04:33:42 | [diff] [blame] | 889 | |
xhwang | e70b7ee1 | 2015-06-25 09:17:17 | [diff] [blame] | 890 | #if defined(ENABLE_MOJO_MEDIA) |
xhwang | c0299ae3 | 2015-07-21 23:39:50 | [diff] [blame] | 891 | media::interfaces::ServiceFactory* GetMediaServiceFactory(); |
xhwang | 33f939e | 2015-06-23 04:33:42 | [diff] [blame] | 892 | |
xhwang | c0299ae3 | 2015-07-21 23:39:50 | [diff] [blame] | 893 | // Called when a connection error happened on |media_service_factory_|. |
| 894 | void OnMediaServiceFactoryConnectionError(); |
xhwang | 33f939e | 2015-06-23 04:33:42 | [diff] [blame] | 895 | #endif |
| 896 | |
xhwang | d718083 | 2015-04-03 05:38:15 | [diff] [blame] | 897 | media::CdmFactory* GetCdmFactory(); |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 898 | |
halton.huo | ca2eabd | 2015-07-06 08:17:40 | [diff] [blame] | 899 | void RegisterMojoServices(); |
| 900 | |
rockot | d926098 | 2015-08-21 22:26:30 | [diff] [blame] | 901 | // Connects to a Mojo application and returns a proxy to its exposed |
| 902 | // ServiceProvider. |
| 903 | mojo::ServiceProviderPtr ConnectToApplication(const GURL& url); |
| 904 | |
dalecurtis | a12e606 | 2015-11-10 23:13:14 | [diff] [blame] | 905 | // Returns the media delegate for WebMediaPlayer usage. If |
| 906 | // |media_player_delegate_| is NULL, one is created. |
| 907 | media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate(); |
| 908 | |
creis | cfaa446 | 2015-03-16 19:27:18 | [diff] [blame] | 909 | // Stores the WebLocalFrame we are associated with. This is null from the |
| 910 | // constructor until SetWebFrame is called, and it is null after |
| 911 | // frameDetached is called until destruction (which is asynchronous in the |
| 912 | // case of the main frame, but not subframes). |
[email protected] | 35b2a97 | 2014-04-04 15:50:22 | [diff] [blame] | 913 | blink::WebLocalFrame* frame_; |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 914 | |
dglazkov | 2e140f5 | 2015-09-28 16:10:07 | [diff] [blame] | 915 | // Boolean value indicating whether this RenderFrameImpl object is for the |
| 916 | // main frame or not. It remains accurate during destruction, even when |
| 917 | // |frame_| has been invalidated. |
| 918 | bool is_main_frame_; |
nasko | 8b9d9bd | 2015-05-06 19:23:19 | [diff] [blame] | 919 | |
[email protected] | abc501e | 2014-01-27 19:27:26 | [diff] [blame] | 920 | base::WeakPtr<RenderViewImpl> render_view_; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 921 | int routing_id_; |
[email protected] | 1c2052f | 2013-08-28 08:24:34 | [diff] [blame] | 922 | bool is_swapped_out_; |
nasko | 8b9d9bd | 2015-05-06 19:23:19 | [diff] [blame] | 923 | |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 924 | // RenderFrameProxy exists only when is_swapped_out_ is true. |
| 925 | // TODO(nasko): This can be removed once we don't have a swapped out state on |
| 926 | // RenderFrame. See https://crbug.com/357747. |
| 927 | RenderFrameProxy* render_frame_proxy_; |
[email protected] | 1c2052f | 2013-08-28 08:24:34 | [diff] [blame] | 928 | bool is_detaching_; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 929 | |
japhet | e6adf14 | 2014-10-31 00:01:49 | [diff] [blame] | 930 | // If this frame was created to replace a proxy, this will store the routing |
| 931 | // id of the proxy to replace at commit-time, at which time it will be |
| 932 | // cleared. |
| 933 | // TODO(creis): Remove this after switching to PlzNavigate. |
| 934 | int proxy_routing_id_; |
| 935 | |
dcheng | 3d886b73 | 2015-11-05 19:16:01 | [diff] [blame] | 936 | // Non-null when the RenderFrame is a local root for compositing, input, |
| 937 | // layout, etc. A local frame is also a local root iff it does not have a |
| 938 | // parent that is a local frame. |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 939 | scoped_refptr<RenderWidget> render_widget_; |
| 940 | |
avi | 0392dbf5 | 2015-03-25 16:55:45 | [diff] [blame] | 941 | // Temporarily holds state pertaining to a navigation that has been initiated |
| 942 | // until the NavigationState corresponding to the new navigation is created in |
| 943 | // didCreateDataSource(). |
| 944 | scoped_ptr<NavigationParams> pending_navigation_params_; |
| 945 | |
creis | 8eb8ef2 | 2015-11-04 22:51:38 | [diff] [blame] | 946 | // Stores the current history item for this frame, so that updates to it can |
| 947 | // be reported to the browser process via SendUpdateState. |
| 948 | blink::WebHistoryItem current_history_item_; |
| 949 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 950 | #if defined(ENABLE_PLUGINS) |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 951 | // Current text input composition text. Empty if no composition is in |
| 952 | // progress. |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 953 | base::string16 pepper_composition_text_; |
tommycli | eb25b2a | 2014-11-03 19:45:09 | [diff] [blame] | 954 | |
tommycli | 59bd86c | 2014-12-10 02:09:38 | [diff] [blame] | 955 | PluginPowerSaverHelper* plugin_power_saver_helper_; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 956 | #endif |
| 957 | |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 958 | RendererWebCookieJarImpl cookie_jar_; |
| 959 | |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 960 | // All the registered observers. |
brettw | 236d317 | 2015-06-03 16:31:43 | [diff] [blame] | 961 | base::ObserverList<RenderFrameObserver> observers_; |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 962 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 963 | scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; |
| 964 | |
[email protected] | 4ecee35 | 2014-03-11 21:12:19 | [diff] [blame] | 965 | // The node that the context menu was pressed over. |
| 966 | blink::WebNode context_menu_node_; |
| 967 | |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 968 | // External context menu requests we're waiting for. "Internal" |
| 969 | // (WebKit-originated) context menu events will have an ID of 0 and will not |
| 970 | // be in this map. |
| 971 | // |
| 972 | // We don't want to add internal ones since some of the "special" page |
| 973 | // handlers in the browser process just ignore the context menu requests so |
| 974 | // avoid showing context menus, and so this will cause right clicks to leak |
| 975 | // entries in this map. Most users of the custom context menu (e.g. Pepper |
| 976 | // plugins) are normally only on "regular" pages and the regular pages will |
| 977 | // always respond properly to the request, so we don't have to worry so |
| 978 | // much about leaks. |
| 979 | IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_; |
| 980 | |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 981 | // The text selection the last time DidChangeSelection got called. May contain |
| 982 | // additional characters before and after the selected text, for IMEs. The |
| 983 | // portion of this string that is the actual selected text starts at index |
| 984 | // |selection_range_.GetMin() - selection_text_offset_| and has length |
| 985 | // |selection_range_.length()|. |
| 986 | base::string16 selection_text_; |
| 987 | // The offset corresponding to the start of |selection_text_| in the document. |
| 988 | size_t selection_text_offset_; |
| 989 | // Range over the document corresponding to the actual selected text (which |
| 990 | // could correspond to a substring of |selection_text_|; see above). |
| 991 | gfx::Range selection_range_; |
| 992 | // Used to inform didChangeSelection() when it is called in the context |
| 993 | // of handling a InputMsg_SelectRange IPC. |
| 994 | bool handling_select_range_; |
| 995 | |
[email protected] | 2626d14 | 2014-04-22 17:24:02 | [diff] [blame] | 996 | // The next group of objects all implement RenderFrameObserver, so are deleted |
| 997 | // along with the RenderFrame automatically. This is why we just store weak |
| 998 | // references. |
| 999 | |
[email protected] | 4459599e | 2014-07-29 22:40:09 | [diff] [blame] | 1000 | // Dispatches permission requests for Web Notifications. |
| 1001 | NotificationPermissionDispatcher* notification_permission_dispatcher_; |
| 1002 | |
[email protected] | 977db4a4 | 2014-07-17 08:04:32 | [diff] [blame] | 1003 | // Destroyed via the RenderFrameObserver::OnDestruct() mechanism. |
perkj | 1a2d043 | 2014-09-03 13:52:33 | [diff] [blame] | 1004 | UserMediaClientImpl* web_user_media_client_; |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 1005 | |
jrummell | 109c3a60 | 2014-12-18 01:08:50 | [diff] [blame] | 1006 | // EncryptedMediaClient attached to this frame; lazily initialized. |
xhwang | 430baee | 2015-01-22 05:46:20 | [diff] [blame] | 1007 | scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_; |
jrummell | 109c3a60 | 2014-12-18 01:08:50 | [diff] [blame] | 1008 | |
xhwang | 36b1f3b | 2015-01-27 17:54:01 | [diff] [blame] | 1009 | // The media permission dispatcher attached to this frame, lazily initialized. |
guoweis | f4282b0 | 2015-09-24 23:05:22 | [diff] [blame] | 1010 | MediaPermissionDispatcherImpl* media_permission_dispatcher_; |
xhwang | 36b1f3b | 2015-01-27 17:54:01 | [diff] [blame] | 1011 | |
xhwang | e70b7ee1 | 2015-06-25 09:17:17 | [diff] [blame] | 1012 | #if defined(ENABLE_MOJO_MEDIA) |
xhwang | c0299ae3 | 2015-07-21 23:39:50 | [diff] [blame] | 1013 | // The media factory attached to this frame, lazily initialized. |
| 1014 | media::interfaces::ServiceFactoryPtr media_service_factory_; |
xhwang | 065b54b | 2015-06-03 22:25:55 | [diff] [blame] | 1015 | #endif |
| 1016 | |
[email protected] | 52d3e17 | 2014-06-16 16:57:02 | [diff] [blame] | 1017 | // MidiClient attached to this frame; lazily initialized. |
| 1018 | MidiDispatcher* midi_dispatcher_; |
| 1019 | |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 1020 | #if defined(OS_ANDROID) |
[email protected] | 4b556cf | 2014-06-10 23:21:53 | [diff] [blame] | 1021 | // Manages all media players in this render frame for communicating with the |
| 1022 | // real media player in the browser process. It's okay to use a raw pointer |
| 1023 | // since it's a RenderFrameObserver. |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 1024 | RendererMediaPlayerManager* media_player_manager_; |
[email protected] | 4b556cf | 2014-06-10 23:21:53 | [diff] [blame] | 1025 | #endif |
| 1026 | |
| 1027 | #if defined(ENABLE_BROWSER_CDMS) |
| 1028 | // Manage all CDMs in this render frame for communicating with the real CDM in |
| 1029 | // the browser process. It's okay to use a raw pointer since it's a |
| 1030 | // RenderFrameObserver. |
[email protected] | 65f3d1aa | 2014-05-29 01:57:00 | [diff] [blame] | 1031 | RendererCdmManager* cdm_manager_; |
[email protected] | a017938b | 2014-05-27 21:17:17 | [diff] [blame] | 1032 | #endif |
| 1033 | |
xhwang | d718083 | 2015-04-03 05:38:15 | [diff] [blame] | 1034 | // The CDM factory attached to this frame, lazily initialized. |
xhwang | f2eb532f | 2015-06-25 01:51:19 | [diff] [blame] | 1035 | scoped_ptr<media::CdmFactory> cdm_factory_; |
xhwang | d718083 | 2015-04-03 05:38:15 | [diff] [blame] | 1036 | |
[email protected] | a6e21c37 | 2014-07-12 02:27:21 | [diff] [blame] | 1037 | #if defined(VIDEO_HOLE) |
| 1038 | // Whether or not this RenderFrameImpl contains a media player. Used to |
| 1039 | // register as an observer for video-hole-specific events. |
| 1040 | bool contains_media_player_; |
| 1041 | #endif |
| 1042 | |
dgozman | 358ba32 | 2015-03-26 15:05:30 | [diff] [blame] | 1043 | // The devtools agent for this frame; only created for main frame and |
| 1044 | // local roots. |
| 1045 | DevToolsAgent* devtools_agent_; |
| 1046 | |
alogvinov | f50445a | 2015-10-30 13:00:12 | [diff] [blame] | 1047 | WakeLockDispatcher* wakelock_dispatcher_; |
| 1048 | |
[email protected] | 4592086 | 2014-07-02 12:53:02 | [diff] [blame] | 1049 | // The geolocation dispatcher attached to this frame, lazily initialized. |
[email protected] | 8eae080 | 2014-06-02 21:35:55 | [diff] [blame] | 1050 | GeolocationDispatcher* geolocation_dispatcher_; |
| 1051 | |
[email protected] | 4592086 | 2014-07-02 12:53:02 | [diff] [blame] | 1052 | // The push messaging dispatcher attached to this frame, lazily initialized. |
| 1053 | PushMessagingDispatcher* push_messaging_dispatcher_; |
| 1054 | |
avayvod | bca35fad | 2015-01-29 20:20:57 | [diff] [blame] | 1055 | // The presentation dispatcher implementation attached to this frame, lazily |
| 1056 | // initialized. |
| 1057 | PresentationDispatcher* presentation_dispatcher_; |
| 1058 | |
[email protected] | c52a141 | 2014-06-25 06:09:25 | [diff] [blame] | 1059 | ServiceRegistryImpl service_registry_; |
| 1060 | |
rockot | d926098 | 2015-08-21 22:26:30 | [diff] [blame] | 1061 | // The shell proxy used to connect to Mojo applications. |
| 1062 | mojo::ShellPtr mojo_shell_; |
| 1063 | |
[email protected] | 4592086 | 2014-07-02 12:53:02 | [diff] [blame] | 1064 | // The screen orientation dispatcher attached to the frame, lazily |
| 1065 | // initialized. |
[email protected] | cf78eda | 2014-06-13 16:57:41 | [diff] [blame] | 1066 | ScreenOrientationDispatcher* screen_orientation_dispatcher_; |
| 1067 | |
mlamouri | efdca9d | 2014-09-16 16:55:40 | [diff] [blame] | 1068 | // The Manifest Manager handles the manifest requests from the browser |
| 1069 | // process. |
| 1070 | ManifestManager* manifest_manager_; |
| 1071 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 1072 | // The current accessibility mode. |
| 1073 | AccessibilityMode accessibility_mode_; |
| 1074 | |
| 1075 | // Only valid if |accessibility_mode_| is anything other than |
| 1076 | // AccessibilityModeOff. |
| 1077 | RendererAccessibility* renderer_accessibility_; |
| 1078 | |
mlamouri | c6d31db | 2015-03-28 17:48:14 | [diff] [blame] | 1079 | scoped_ptr<PermissionDispatcher> permission_client_; |
mlamouri | 670a86d | 2015-03-17 16:06:25 | [diff] [blame] | 1080 | |
benwells | 04ab5b96 | 2015-05-06 08:29:40 | [diff] [blame] | 1081 | scoped_ptr<blink::WebAppBannerClient> app_banner_client_; |
| 1082 | |
jyasskin | f89a11b | 2015-07-21 00:27:48 | [diff] [blame] | 1083 | scoped_ptr<blink::WebBluetooth> bluetooth_; |
| 1084 | |
rockot | d926098 | 2015-08-21 22:26:30 | [diff] [blame] | 1085 | scoped_ptr<blink::WebUSBClient> usb_client_; |
| 1086 | |
dalecurtis | a12e606 | 2015-11-10 23:13:14 | [diff] [blame] | 1087 | // Manages play, pause notifications for WebMediaPlayer implementations; its |
| 1088 | // lifetime is tied to the RenderFrame via the RenderFrameObserver interface. |
| 1089 | media::RendererWebMediaPlayerDelegate* media_player_delegate_; |
| 1090 | |
megjablon | d5ac7d5 | 2015-10-22 23:56:12 | [diff] [blame] | 1091 | // Whether or not this RenderFrame is using Lo-Fi mode. |
| 1092 | bool is_using_lofi_; |
| 1093 | |
bajones | 0244353 | 2015-06-22 21:17:40 | [diff] [blame] | 1094 | #if defined(ENABLE_WEBVR) |
| 1095 | // The VR dispatcher attached to the frame, lazily initialized. |
| 1096 | scoped_ptr<VRDispatcher> vr_dispatcher_; |
| 1097 | #endif |
| 1098 | |
avi | 485e5fd6 | 2014-08-25 23:26:14 | [diff] [blame] | 1099 | #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 1100 | // The external popup for the currently showing select popup. |
| 1101 | scoped_ptr<ExternalPopupMenu> external_popup_menu_; |
| 1102 | #endif |
| 1103 | |
[email protected] | 9630731 | 2014-05-04 01:00:19 | [diff] [blame] | 1104 | base::WeakPtrFactory<RenderFrameImpl> weak_factory_; |
| 1105 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 1106 | DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
| 1107 | }; |
| 1108 | |
| 1109 | } // namespace content |
| 1110 | |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 1111 | #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |