blob: a8a14dda742f367d8aecf454bb6e91824857b344 [file] [log] [blame]
[email protected]5a7100d2014-05-19 01:29:041// Copyright 2014 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#include "content/renderer/render_frame_proxy.h"
6
avi1023d012015-12-25 02:39:147#include <stdint.h>
[email protected]5a7100d2014-05-19 01:29:048#include <map>
dcheng07945f632015-12-26 07:59:329#include <utility>
[email protected]5a7100d2014-05-19 01:29:0410
nasko4c0feb62015-06-05 18:37:0611#include "base/command_line.h"
[email protected]5a7100d2014-05-19 01:29:0412#include "base/lazy_instance.h"
Fady Samuel343a74952017-11-30 14:19:2013#include "components/viz/common/features.h"
lfg1f9011c2016-08-17 21:18:4214#include "content/common/content_switches_internal.h"
[email protected]5a7100d2014-05-19 01:29:0415#include "content/common/frame_messages.h"
raymesbba82b32016-07-19 00:41:3816#include "content/common/frame_owner_properties.h"
alexmosbc7eafa2014-12-06 01:38:0917#include "content/common/frame_replication_state.h"
alexmos3fcd0ca2015-10-23 18:18:3318#include "content/common/input_messages.h"
lfgdb5c4ed2016-03-04 23:09:0719#include "content/common/page_messages.h"
Charlie Reisa2e1ab52017-12-06 00:03:1320#include "content/common/site_isolation_policy.h"
[email protected]5a7100d2014-05-19 01:29:0421#include "content/common/swapped_out_messages.h"
japhet4dad341e2014-09-09 21:11:1122#include "content/common/view_messages.h"
Fady Samuel3ff277d2017-08-29 17:55:5223#include "content/public/common/content_switches.h"
Fady Samuel85a1bf72017-10-27 14:30:2024#include "content/public/common/screen_info.h"
[email protected]e3244ed2014-06-20 20:04:2725#include "content/renderer/child_frame_compositing_helper.h"
scottmgaacca53a2017-02-10 20:41:0026#include "content/renderer/frame_owner_properties.h"
John Abd-El-Malek6b56ef712017-10-21 22:52:4627#include "content/renderer/loader/web_url_request_util.h"
Scott Violet1098538e2017-10-05 19:23:3328#include "content/renderer/mash_util.h"
[email protected]5a7100d2014-05-19 01:29:0429#include "content/renderer/render_frame_impl.h"
30#include "content/renderer/render_thread_impl.h"
31#include "content/renderer/render_view_impl.h"
lfgd64bb292016-01-18 23:57:3132#include "content/renderer/render_widget.h"
lfgdb5c4ed2016-03-04 23:09:0733#include "ipc/ipc_message_macros.h"
Luna Lu2e713992017-11-07 01:45:5834#include "third_party/WebKit/common/feature_policy/feature_policy.h"
Luna Luc3fdacdf2017-11-08 04:48:5335#include "third_party/WebKit/common/frame_policy.h"
brettwdfbcc3b2016-01-20 01:49:1736#include "third_party/WebKit/public/platform/URLConversion.h"
kenrbea731792017-01-13 15:10:4837#include "third_party/WebKit/public/platform/WebRect.h"
alexmosbc7eafa2014-12-06 01:38:0938#include "third_party/WebKit/public/platform/WebString.h"
japhet4dad341e2014-09-09 21:11:1139#include "third_party/WebKit/public/web/WebLocalFrame.h"
Charles Harrisonbd8675982017-06-20 22:13:4940#include "third_party/WebKit/public/web/WebTriggeringEventInfo.h"
japhet70ea1342014-09-30 21:56:3941#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
[email protected]e3244ed2014-06-20 20:04:2742#include "third_party/WebKit/public/web/WebView.h"
Scott Violet30daff62017-12-01 07:04:5243#include "ui/base/ui_base_switches_util.h"
[email protected]5a7100d2014-05-19 01:29:0444
Scott Violet1098538e2017-10-05 19:23:3345#if defined(USE_AURA)
Scott Violetf1291942017-10-20 22:38:2746#include "content/renderer/mus/mus_embedded_frame.h"
Scott Violet1098538e2017-10-05 19:23:3347#include "content/renderer/mus/renderer_window_tree_client.h"
48#endif
49
[email protected]5a7100d2014-05-19 01:29:0450namespace content {
51
52namespace {
53
[email protected]c092f5c2014-07-18 01:34:3354// Facilitates lookup of RenderFrameProxy by routing_id.
[email protected]5a7100d2014-05-19 01:29:0455typedef std::map<int, RenderFrameProxy*> RoutingIDProxyMap;
scottmg5e65e3a2017-03-08 08:48:4656static base::LazyInstance<RoutingIDProxyMap>::DestructorAtExit
57 g_routing_id_proxy_map = LAZY_INSTANCE_INITIALIZER;
[email protected]5a7100d2014-05-19 01:29:0458
Daniel Cheng0edfa562017-06-05 19:13:1859// Facilitates lookup of RenderFrameProxy by WebRemoteFrame.
60typedef std::map<blink::WebRemoteFrame*, RenderFrameProxy*> FrameMap;
scottmg5e65e3a2017-03-08 08:48:4661base::LazyInstance<FrameMap>::DestructorAtExit g_frame_map =
62 LAZY_INSTANCE_INITIALIZER;
[email protected]c092f5c2014-07-18 01:34:3363
[email protected]5a7100d2014-05-19 01:29:0464} // namespace
65
66// static
[email protected]c092f5c2014-07-18 01:34:3367RenderFrameProxy* RenderFrameProxy::CreateProxyToReplaceFrame(
68 RenderFrameImpl* frame_to_replace,
dcheng860817a2015-05-22 03:16:5669 int routing_id,
70 blink::WebTreeScopeType scope) {
[email protected]c092f5c2014-07-18 01:34:3371 CHECK_NE(routing_id, MSG_ROUTING_NONE);
72
alexmosf076d912017-01-23 22:27:5773 std::unique_ptr<RenderFrameProxy> proxy(new RenderFrameProxy(routing_id));
Daniel Cheng999698bd2017-03-22 04:56:3774 proxy->unique_name_ = frame_to_replace->unique_name();
[email protected]82307f6b2014-08-07 03:30:1275
Nasko Oskov85f60222014-08-28 22:53:3076 // When a RenderFrame is replaced by a RenderProxy, the WebRemoteFrame should
77 // always come from WebRemoteFrame::create and a call to WebFrame::swap must
78 // follow later.
dcheng860817a2015-05-22 03:16:5679 blink::WebRemoteFrame* web_frame =
Blink Reformat1c4d759e2017-04-09 16:34:5480 blink::WebRemoteFrame::Create(scope, proxy.get());
kenrb77618cd52016-02-18 19:13:3881
82 // If frame_to_replace has a RenderFrameProxy parent, then its
83 // RenderWidget will be destroyed along with it, so the new
84 // RenderFrameProxy uses its parent's RenderWidget.
85 RenderWidget* widget =
Blink Reformat1c4d759e2017-04-09 16:34:5486 (!frame_to_replace->GetWebFrame()->Parent() ||
87 frame_to_replace->GetWebFrame()->Parent()->IsWebLocalFrame())
kenrb77618cd52016-02-18 19:13:3888 ? frame_to_replace->GetRenderWidget()
89 : RenderFrameProxy::FromWebFrame(
Daniel Cheng0edfa562017-06-05 19:13:1890 frame_to_replace->GetWebFrame()->Parent()->ToWebRemoteFrame())
kenrb77618cd52016-02-18 19:13:3891 ->render_widget();
92 proxy->Init(web_frame, frame_to_replace->render_view(), widget);
[email protected]c092f5c2014-07-18 01:34:3393 return proxy.release();
94}
95
96RenderFrameProxy* RenderFrameProxy::CreateFrameProxy(
97 int routing_id,
alexmosbc7eafa2014-12-06 01:38:0998 int render_view_routing_id,
nick3b5a21f2016-11-22 23:07:1199 blink::WebFrame* opener,
alexmosa181efc2015-09-03 00:39:04100 int parent_routing_id,
alexmosbc7eafa2014-12-06 01:38:09101 const FrameReplicationState& replicated_state) {
alexmose846e412015-12-18 07:46:45102 RenderFrameProxy* parent = nullptr;
103 if (parent_routing_id != MSG_ROUTING_NONE) {
104 parent = RenderFrameProxy::FromRoutingID(parent_routing_id);
105 // It is possible that the parent proxy has been detached in this renderer
106 // process, just as the parent's real frame was creating this child frame.
107 // In this case, do not create the proxy. See https://crbug.com/568670.
108 if (!parent)
109 return nullptr;
110 }
111
alexmosf076d912017-01-23 22:27:57112 std::unique_ptr<RenderFrameProxy> proxy(new RenderFrameProxy(routing_id));
lfgd64bb292016-01-18 23:57:31113 RenderViewImpl* render_view = nullptr;
114 RenderWidget* render_widget = nullptr;
115 blink::WebRemoteFrame* web_frame = nullptr;
alexmose846e412015-12-18 07:46:45116
117 if (!parent) {
nasko4c0feb62015-06-05 18:37:06118 // Create a top level WebRemoteFrame.
[email protected]c092f5c2014-07-18 01:34:33119 render_view = RenderViewImpl::FromRoutingID(render_view_routing_id);
Daniel Chengd5e56ff2017-06-24 07:44:02120 web_frame = blink::WebRemoteFrame::CreateMainFrame(
121 render_view->GetWebView(), proxy.get(), opener);
avi8a45c1092016-03-01 16:12:34122 render_widget = render_view->GetWidget();
alexmos78c9c0d2016-10-14 18:57:03123
124 // If the RenderView is reused by this proxy after having been used for a
125 // pending RenderFrame that was discarded, its swapped out state needs to
126 // be updated, as the OnSwapOut flow which normally does this won't happen
127 // in that case. See https://crbug.com/653746 and
128 // https://crbug.com/651980.
129 if (!render_view->is_swapped_out())
130 render_view->SetSwappedOut(true);
[email protected]c092f5c2014-07-18 01:34:33131 } else {
[email protected]82307f6b2014-08-07 03:30:12132 // Create a frame under an existing parent. The parent is always expected
133 // to be a RenderFrameProxy, because navigations initiated by local frames
[email protected]c092f5c2014-07-18 01:34:33134 // should not wind up here.
alexmose846e412015-12-18 07:46:45135
Blink Reformat1c4d759e2017-04-09 16:34:54136 web_frame = parent->web_frame()->CreateRemoteChild(
dcheng860817a2015-05-22 03:16:56137 replicated_state.scope,
Blink Reformat1c4d759e2017-04-09 16:34:54138 blink::WebString::FromUTF8(replicated_state.name),
Ian Clellandcdc4f312017-10-13 22:24:12139 replicated_state.frame_policy.sandbox_flags,
Luna Lu2e713992017-11-07 01:45:58140 replicated_state.frame_policy.container_policy, proxy.get(), opener);
Daniel Cheng999698bd2017-03-22 04:56:37141 proxy->unique_name_ = replicated_state.unique_name;
[email protected]c092f5c2014-07-18 01:34:33142 render_view = parent->render_view();
lfgd64bb292016-01-18 23:57:31143 render_widget = parent->render_widget();
[email protected]c092f5c2014-07-18 01:34:33144 }
145
lfgd64bb292016-01-18 23:57:31146 proxy->Init(web_frame, render_view, render_widget);
[email protected]c092f5c2014-07-18 01:34:33147
alexmosbc7eafa2014-12-06 01:38:09148 // Initialize proxy's WebRemoteFrame with the security origin and other
149 // replicated information.
dcheng860817a2015-05-22 03:16:56150 // TODO(dcheng): Calling this when parent_routing_id != MSG_ROUTING_NONE is
151 // mostly redundant, since we already pass the name and sandbox flags in
152 // createLocalChild(). We should update the Blink interface so it also takes
153 // the origin. Then it will be clear that the replication call is only needed
154 // for the case of setting up a main frame proxy.
alexmosbc7eafa2014-12-06 01:38:09155 proxy->SetReplicatedState(replicated_state);
156
[email protected]c092f5c2014-07-18 01:34:33157 return proxy.release();
[email protected]5a7100d2014-05-19 01:29:04158}
159
160// static
avi1023d012015-12-25 02:39:14161RenderFrameProxy* RenderFrameProxy::FromRoutingID(int32_t routing_id) {
[email protected]5a7100d2014-05-19 01:29:04162 RoutingIDProxyMap* proxies = g_routing_id_proxy_map.Pointer();
163 RoutingIDProxyMap::iterator it = proxies->find(routing_id);
164 return it == proxies->end() ? NULL : it->second;
165}
166
[email protected]c092f5c2014-07-18 01:34:33167// static
Daniel Cheng0edfa562017-06-05 19:13:18168RenderFrameProxy* RenderFrameProxy::FromWebFrame(
169 blink::WebRemoteFrame* web_frame) {
170 // TODO(dcheng): Turn this into a DCHECK() if it doesn't crash on canary.
171 CHECK(web_frame);
[email protected]c092f5c2014-07-18 01:34:33172 FrameMap::iterator iter = g_frame_map.Get().find(web_frame);
173 if (iter != g_frame_map.Get().end()) {
174 RenderFrameProxy* proxy = iter->second;
175 DCHECK_EQ(web_frame, proxy->web_frame());
176 return proxy;
177 }
Daniel Cheng0edfa562017-06-05 19:13:18178 // Reaching this is not expected: this implies that the |web_frame| in
179 // question is not managed by the content API, or the associated
180 // RenderFrameProxy is already deleted--in which case, it's not safe to touch
181 // |web_frame|.
182 NOTREACHED();
Ivan Kotenkov2c0d2bb32017-11-01 15:41:28183 return nullptr;
[email protected]c092f5c2014-07-18 01:34:33184}
185
alexmosf076d912017-01-23 22:27:57186RenderFrameProxy::RenderFrameProxy(int routing_id)
[email protected]5a7100d2014-05-19 01:29:04187 : routing_id_(routing_id),
alexmosf076d912017-01-23 22:27:57188 provisional_frame_routing_id_(MSG_ROUTING_NONE),
lfgd64bb292016-01-18 23:57:31189 web_frame_(nullptr),
190 render_view_(nullptr),
191 render_widget_(nullptr) {
[email protected]5a7100d2014-05-19 01:29:04192 std::pair<RoutingIDProxyMap::iterator, bool> result =
[email protected]c092f5c2014-07-18 01:34:33193 g_routing_id_proxy_map.Get().insert(std::make_pair(routing_id_, this));
[email protected]5a7100d2014-05-19 01:29:04194 CHECK(result.second) << "Inserting a duplicate item.";
195 RenderThread::Get()->AddRoute(routing_id_, this);
[email protected]5a7100d2014-05-19 01:29:04196}
197
198RenderFrameProxy::~RenderFrameProxy() {
lfgd64bb292016-01-18 23:57:31199 render_widget_->UnregisterRenderFrameProxy(this);
[email protected]c092f5c2014-07-18 01:34:33200
naskoef4c1122015-05-08 01:17:43201 CHECK(!web_frame_);
[email protected]5a7100d2014-05-19 01:29:04202 RenderThread::Get()->RemoveRoute(routing_id_);
203 g_routing_id_proxy_map.Get().erase(routing_id_);
204}
205
[email protected]82307f6b2014-08-07 03:30:12206void RenderFrameProxy::Init(blink::WebRemoteFrame* web_frame,
lfgd64bb292016-01-18 23:57:31207 RenderViewImpl* render_view,
208 RenderWidget* render_widget) {
[email protected]c092f5c2014-07-18 01:34:33209 CHECK(web_frame);
210 CHECK(render_view);
lfgd64bb292016-01-18 23:57:31211 CHECK(render_widget);
[email protected]c092f5c2014-07-18 01:34:33212
213 web_frame_ = web_frame;
214 render_view_ = render_view;
lfgd64bb292016-01-18 23:57:31215 render_widget_ = render_widget;
[email protected]c092f5c2014-07-18 01:34:33216
lfgd64bb292016-01-18 23:57:31217 render_widget_->RegisterRenderFrameProxy(this);
[email protected]c092f5c2014-07-18 01:34:33218
219 std::pair<FrameMap::iterator, bool> result =
220 g_frame_map.Get().insert(std::make_pair(web_frame_, this));
221 CHECK(result.second) << "Inserted a duplicate item.";
Fady Samuel3ff277d2017-08-29 17:55:52222
Fady Samuel343a74952017-11-30 14:19:20223 enable_surface_synchronization_ = features::IsSurfaceSynchronizationEnabled();
Scott Violet1098538e2017-10-05 19:23:33224
Fady Samuelea0d99e2017-09-28 02:21:07225 compositing_helper_.reset(
226 ChildFrameCompositingHelper::CreateForRenderFrameProxy(this));
Scott Violet1098538e2017-10-05 19:23:33227
Fady Samuel85a1bf72017-10-27 14:30:20228 pending_resize_params_.screen_info = render_widget_->screen_info();
229
Scott Violet1098538e2017-10-05 19:23:33230#if defined(USE_AURA)
Sadrul Habib Chowdhury1dbe3b42017-11-18 02:27:43231 if (IsRunningWithMus()) {
Scott Violet1098538e2017-10-05 19:23:33232 RendererWindowTreeClient* renderer_window_tree_client =
233 RendererWindowTreeClient::Get(render_widget_->routing_id());
234 // It's possible a MusEmbeddedFrame has already been scheduled for creation
235 // (that is, RendererWindowTreeClient::Embed() was called). Call to
236 // OnRenderFrameProxyCreated() to potentially get the MusEmbeddedFrame.
237 // OnRenderFrameProxyCreated() returns null if Embed() was not called.
238 mus_embedded_frame_ =
239 renderer_window_tree_client->OnRenderFrameProxyCreated(this);
240 }
241#endif
[email protected]e3244ed2014-06-20 20:04:27242}
243
Fady Samuel85a1bf72017-10-27 14:30:20244void RenderFrameProxy::ResendResizeParams() {
245 // Reset |sent_resize_params_| in order to allocate a new viz::LocalSurfaceId.
246 sent_resize_params_ = base::nullopt;
247 WasResized();
Fady Samuel0c7ffb12017-08-28 19:08:39248}
249
lfge6119aac2016-01-27 02:14:31250void RenderFrameProxy::WillBeginCompositorFrame() {
Fady Samuelea0d99e2017-09-28 02:21:07251 if (compositing_helper_->surface_id().is_valid()) {
lfge6119aac2016-01-27 02:14:31252 FrameHostMsg_HittestData_Params params;
253 params.surface_id = compositing_helper_->surface_id();
Blink Reformat1c4d759e2017-04-09 16:34:54254 params.ignored_for_hittest = web_frame_->IsIgnoredForHitTest();
lfge6119aac2016-01-27 02:14:31255 render_widget_->QueueMessage(
256 new FrameHostMsg_HittestData(render_widget_->routing_id(), params),
257 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE);
258 }
259}
260
[email protected]e3244ed2014-06-20 20:04:27261void RenderFrameProxy::DidCommitCompositorFrame() {
[email protected]e3244ed2014-06-20 20:04:27262}
263
Fady Samuel85a1bf72017-10-27 14:30:20264void RenderFrameProxy::OnScreenInfoChanged(const ScreenInfo& screen_info) {
265 pending_resize_params_.screen_info = screen_info;
266 WasResized();
267}
268
alexmosbc7eafa2014-12-06 01:38:09269void RenderFrameProxy::SetReplicatedState(const FrameReplicationState& state) {
270 DCHECK(web_frame_);
Hiroshige Hayashizaki50133ff2017-12-02 02:36:45271
272 web_frame_->SetReplicatedOrigin(
273 state.origin, state.has_potentially_trustworthy_unique_origin);
274
275#if DCHECK_IS_ON()
276 blink::WebSecurityOrigin security_origin_before_sandbox_flags =
277 web_frame_->GetSecurityOrigin();
278#endif
279
Ian Clelland5cbaaf82017-11-27 22:00:03280 web_frame_->SetReplicatedSandboxFlags(state.active_sandbox_flags);
Hiroshige Hayashizaki50133ff2017-12-02 02:36:45281
282#if DCHECK_IS_ON()
283 // If |state.has_potentially_trustworthy_unique_origin| is set,
284 // - |state.origin| should be unique (this is checked in
285 // blink::SecurityOrigin::SetUniqueOriginIsPotentiallyTrustworthy() in
286 // SetReplicatedOrigin()), and thus
287 // - The security origin is not updated by SetReplicatedSandboxFlags() and
288 // thus we don't have to apply |has_potentially_trustworthy_unique_origin|
289 // flag after SetReplicatedSandboxFlags().
290 if (state.has_potentially_trustworthy_unique_origin)
291 DCHECK(security_origin_before_sandbox_flags ==
292 web_frame_->GetSecurityOrigin());
293#endif
294
Blink Reformat1c4d759e2017-04-09 16:34:54295 web_frame_->SetReplicatedName(blink::WebString::FromUTF8(state.name));
296 web_frame_->SetReplicatedInsecureRequestPolicy(state.insecure_request_policy);
Luna Lu2e713992017-11-07 01:45:58297 web_frame_->SetReplicatedFeaturePolicyHeader(state.feature_policy_header);
japhet61835ae12017-01-20 01:25:39298 if (state.has_received_user_gesture)
Blink Reformat1c4d759e2017-04-09 16:34:54299 web_frame_->SetHasReceivedUserGesture();
lukasza8e1c02e42016-05-17 20:05:10300
Blink Reformat1c4d759e2017-04-09 16:34:54301 web_frame_->ResetReplicatedContentSecurityPolicy();
arthursonzogni662aa652017-03-28 11:09:50302 OnAddContentSecurityPolicies(state.accumulated_csp_headers);
alexmosbc7eafa2014-12-06 01:38:09303}
304
Ian Clelland5cbaaf82017-11-27 22:00:03305// Update the proxy's FrameOwner with new sandbox flags and container policy
306// that were set by its parent in another process.
alexmos6b294562015-03-05 19:24:10307//
308// Normally, when a frame's sandbox attribute is changed dynamically, the
309// frame's FrameOwner is updated with the new sandbox flags right away, while
310// the frame's SecurityContext is updated when the frame is navigated and the
311// new sandbox flags take effect.
312//
313// Currently, there is no use case for a proxy's pending FrameOwner sandbox
314// flags, so there's no message sent to proxies when the sandbox attribute is
Ian Clelland5cbaaf82017-11-27 22:00:03315// first updated. Instead, the active flags are updated when they take effect,
316// by OnDidSetActiveSandboxFlags. The proxy's FrameOwner flags are updated here
317// with the caveat that the FrameOwner won't learn about updates to its flags
318// until they take effect.
Luna Luc3fdacdf2017-11-08 04:48:53319void RenderFrameProxy::OnDidUpdateFramePolicy(
320 const blink::FramePolicy& frame_policy) {
Ian Clelland5cbaaf82017-11-27 22:00:03321 DCHECK(web_frame()->Parent());
Luna Lu2e713992017-11-07 01:45:58322 web_frame_->SetFrameOwnerPolicy(frame_policy.sandbox_flags,
323 frame_policy.container_policy);
alexmos6b294562015-03-05 19:24:10324}
325
Ian Clelland5cbaaf82017-11-27 22:00:03326// Update the proxy's SecurityContext with new sandbox flags that were set
327// during navigation. Unlike changes to the FrameOwner, which are handled by
328// OnDidUpdateFramePolicy, these flags should be considered effective
329// immediately.
330//
331// These flags are needed on the remote frame's SecurityContext to ensure that
332// sandbox flags are inherited properly if this proxy ever parents a local
333// frame.
334void RenderFrameProxy::OnDidSetActiveSandboxFlags(
335 blink::WebSandboxFlags active_sandbox_flags) {
336 web_frame_->SetReplicatedSandboxFlags(active_sandbox_flags);
337}
338
Scott Violetf1291942017-10-20 22:38:27339void RenderFrameProxy::SetChildFrameSurface(
340 const viz::SurfaceInfo& surface_info,
341 const viz::SurfaceSequence& sequence) {
342 // If this WebFrame has already been detached, its parent will be null. This
343 // can happen when swapping a WebRemoteFrame with a WebLocalFrame, where this
344 // message may arrive after the frame was removed from the frame tree, but
345 // before the frame has been destroyed. http://crbug.com/446575.
346 if (!web_frame()->Parent())
347 return;
348
Fady Samuel1cc05222017-11-17 10:42:26349 if (!enable_surface_synchronization_) {
350 compositing_helper_->SetPrimarySurfaceId(surface_info.id(),
351 frame_rect().size());
352 }
353 compositing_helper_->SetFallbackSurfaceId(surface_info.id(),
354 frame_rect().size(), sequence);
Scott Violetf1291942017-10-20 22:38:27355}
356
[email protected]5a7100d2014-05-19 01:29:04357bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) {
lfgdb5c4ed2016-03-04 23:09:07358 // Forward Page IPCs to the RenderView.
359 if ((IPC_MESSAGE_CLASS(msg) == PageMsgStart)) {
360 if (render_view())
361 return render_view()->OnMessageReceived(msg);
362
363 return false;
364 }
365
[email protected]5a7100d2014-05-19 01:29:04366 bool handled = true;
367 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxy, msg)
368 IPC_MESSAGE_HANDLER(FrameMsg_DeleteProxy, OnDeleteProxy)
[email protected]e3244ed2014-06-20 20:04:27369 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone)
kenrbfc7c02c92015-05-29 22:20:58370 IPC_MESSAGE_HANDLER(FrameMsg_SetChildFrameSurface, OnSetChildFrameSurface)
alexmos95733002015-08-24 16:38:09371 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener)
Fady Samuel0c7ffb12017-08-28 19:08:39372 IPC_MESSAGE_HANDLER(FrameMsg_ViewChanged, OnViewChanged)
nasko3e8c20e2014-12-18 06:54:56373 IPC_MESSAGE_HANDLER(FrameMsg_DidStartLoading, OnDidStartLoading)
374 IPC_MESSAGE_HANDLER(FrameMsg_DidStopLoading, OnDidStopLoading)
iclelland92f8c0b2017-04-19 12:43:05375 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateFramePolicy, OnDidUpdateFramePolicy)
Ian Clelland5cbaaf82017-11-27 22:00:03376 IPC_MESSAGE_HANDLER(FrameMsg_DidSetActiveSandboxFlags,
377 OnDidSetActiveSandboxFlags)
alexmosf40ce5b02015-02-25 20:19:56378 IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad)
engedy6e2e0992017-05-25 18:58:42379 IPC_MESSAGE_HANDLER(FrameMsg_Collapse, OnCollapse)
alexmosbe2f4c32015-03-10 02:30:23380 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName)
arthursonzogni662aa652017-03-28 11:09:50381 IPC_MESSAGE_HANDLER(FrameMsg_AddContentSecurityPolicies,
382 OnAddContentSecurityPolicies)
lukasza8e1c02e42016-05-17 20:05:10383 IPC_MESSAGE_HANDLER(FrameMsg_ResetContentSecurityPolicy,
384 OnResetContentSecurityPolicy)
mkwstf672e7ef2016-06-09 20:51:07385 IPC_MESSAGE_HANDLER(FrameMsg_EnforceInsecureRequestPolicy,
386 OnEnforceInsecureRequestPolicy)
alexmos788f45b32016-05-24 00:57:02387 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
388 OnSetFrameOwnerProperties)
alexmosa7a4ff822015-04-27 17:59:56389 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateOrigin, OnDidUpdateOrigin)
alexmos3fcd0ca2015-10-23 18:18:33390 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetPageFocus)
Fady Samueld10aadd82017-11-03 18:23:57391 IPC_MESSAGE_HANDLER(FrameMsg_ResizeDueToAutoResize, OnResizeDueToAutoResize)
alexmosb1dc2162015-11-05 00:59:20392 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame)
alexmos1f7eac4a2016-05-25 23:04:55393 IPC_MESSAGE_HANDLER(FrameMsg_WillEnterFullscreen, OnWillEnterFullscreen)
japhet61835ae12017-01-20 01:25:39394 IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture,
395 OnSetHasReceivedUserGesture)
Ehsan Karamadf152db882017-10-23 17:41:25396 IPC_MESSAGE_HANDLER(FrameMsg_ScrollRectToVisible, OnScrollRectToVisible)
[email protected]5a7100d2014-05-19 01:29:04397 IPC_MESSAGE_UNHANDLED(handled = false)
398 IPC_END_MESSAGE_MAP()
399
creis77643d12014-11-21 20:49:59400 // Note: If |handled| is true, |this| may have been deleted.
401 return handled;
[email protected]5a7100d2014-05-19 01:29:04402}
403
404bool RenderFrameProxy::Send(IPC::Message* message) {
[email protected]5a7100d2014-05-19 01:29:04405 return RenderThread::Get()->Send(message);
406}
407
408void RenderFrameProxy::OnDeleteProxy() {
dchenga24aeee2016-02-16 22:12:59409 DCHECK(web_frame_);
Blink Reformat1c4d759e2017-04-09 16:34:54410 web_frame_->Detach();
[email protected]5a7100d2014-05-19 01:29:04411}
412
[email protected]e3244ed2014-06-20 20:04:27413void RenderFrameProxy::OnChildFrameProcessGone() {
Fady Samuelea0d99e2017-09-28 02:21:07414 compositing_helper_->ChildFrameGone();
[email protected]e3244ed2014-06-20 20:04:27415}
416
kenrbfc7c02c92015-05-29 22:20:58417void RenderFrameProxy::OnSetChildFrameSurface(
Fady Samuel1a21156e2017-07-13 04:57:29418 const viz::SurfaceInfo& surface_info,
Fady Samueldbd4b022017-07-14 02:06:48419 const viz::SurfaceSequence& sequence) {
Scott Violete4488e202017-10-16 17:46:31420 SetChildFrameSurface(surface_info, sequence);
kenrbfc7c02c92015-05-29 22:20:58421}
422
alexmos95733002015-08-24 16:38:09423void RenderFrameProxy::OnUpdateOpener(int opener_routing_id) {
nick3b5a21f2016-11-22 23:07:11424 blink::WebFrame* opener = RenderFrameImpl::ResolveOpener(opener_routing_id);
Blink Reformat1c4d759e2017-04-09 16:34:54425 web_frame_->SetOpener(opener);
creisbbbeb062014-08-25 18:20:31426}
427
nasko3e8c20e2014-12-18 06:54:56428void RenderFrameProxy::OnDidStartLoading() {
Blink Reformat1c4d759e2017-04-09 16:34:54429 web_frame_->DidStartLoading();
nasko3e8c20e2014-12-18 06:54:56430}
431
Fady Samuel3ff277d2017-08-29 17:55:52432void RenderFrameProxy::OnViewChanged(const viz::FrameSinkId& frame_sink_id) {
Scott Violetc1942462017-10-12 22:45:37433 // In mash the FrameSinkId comes from RendererWindowTreeClient.
Scott Violet30daff62017-12-01 07:04:52434 if (!switches::IsMusHostingViz())
Scott Violetc1942462017-10-12 22:45:37435 frame_sink_id_ = frame_sink_id;
Scott Violet1098538e2017-10-05 19:23:33436
Fady Samuel0c7ffb12017-08-28 19:08:39437 // Resend the FrameRects and allocate a new viz::LocalSurfaceId when the view
438 // changes.
Fady Samuel85a1bf72017-10-27 14:30:20439 ResendResizeParams();
Fady Samuel0c7ffb12017-08-28 19:08:39440}
441
nasko3e8c20e2014-12-18 06:54:56442void RenderFrameProxy::OnDidStopLoading() {
Blink Reformat1c4d759e2017-04-09 16:34:54443 web_frame_->DidStopLoading();
nasko3e8c20e2014-12-18 06:54:56444}
445
alexmosf40ce5b02015-02-25 20:19:56446void RenderFrameProxy::OnDispatchLoad() {
Blink Reformat1c4d759e2017-04-09 16:34:54447 web_frame_->DispatchLoadEventOnFrameOwner();
alexmosf40ce5b02015-02-25 20:19:56448}
449
engedy6e2e0992017-05-25 18:58:42450void RenderFrameProxy::OnCollapse(bool collapsed) {
451 web_frame_->Collapse(collapsed);
452}
453
lukasza464d8692016-02-22 19:26:32454void RenderFrameProxy::OnDidUpdateName(const std::string& name,
455 const std::string& unique_name) {
Blink Reformat1c4d759e2017-04-09 16:34:54456 web_frame_->SetReplicatedName(blink::WebString::FromUTF8(name));
Daniel Cheng999698bd2017-03-22 04:56:37457 unique_name_ = unique_name;
alexmosbe2f4c32015-03-10 02:30:23458}
459
arthursonzogni662aa652017-03-28 11:09:50460void RenderFrameProxy::OnAddContentSecurityPolicies(
461 const std::vector<ContentSecurityPolicyHeader>& headers) {
462 for (const auto& header : headers) {
Blink Reformat1c4d759e2017-04-09 16:34:54463 web_frame_->AddReplicatedContentSecurityPolicyHeader(
464 blink::WebString::FromUTF8(header.header_value), header.type,
arthursonzogni662aa652017-03-28 11:09:50465 header.source);
466 }
lukasza8e1c02e42016-05-17 20:05:10467}
468
469void RenderFrameProxy::OnResetContentSecurityPolicy() {
Blink Reformat1c4d759e2017-04-09 16:34:54470 web_frame_->ResetReplicatedContentSecurityPolicy();
lukasza8e1c02e42016-05-17 20:05:10471}
472
mkwstf672e7ef2016-06-09 20:51:07473void RenderFrameProxy::OnEnforceInsecureRequestPolicy(
474 blink::WebInsecureRequestPolicy policy) {
Blink Reformat1c4d759e2017-04-09 16:34:54475 web_frame_->SetReplicatedInsecureRequestPolicy(policy);
estarka886b8d2015-12-18 21:53:08476}
477
alexmos788f45b32016-05-24 00:57:02478void RenderFrameProxy::OnSetFrameOwnerProperties(
raymesbba82b32016-07-19 00:41:38479 const FrameOwnerProperties& properties) {
Blink Reformat1c4d759e2017-04-09 16:34:54480 web_frame_->SetFrameOwnerProperties(
scottmgaacca53a2017-02-10 20:41:00481 ConvertFrameOwnerPropertiesToWebFrameOwnerProperties(properties));
alexmos788f45b32016-05-24 00:57:02482}
483
estarkbd8e26f2016-03-16 23:30:37484void RenderFrameProxy::OnDidUpdateOrigin(
485 const url::Origin& origin,
486 bool is_potentially_trustworthy_unique_origin) {
Hiroshige Hayashizaki50133ff2017-12-02 02:36:45487 web_frame_->SetReplicatedOrigin(origin,
488 is_potentially_trustworthy_unique_origin);
alexmosa7a4ff822015-04-27 17:59:56489}
490
alexmos3fcd0ca2015-10-23 18:18:33491void RenderFrameProxy::OnSetPageFocus(bool is_focused) {
492 render_view_->SetFocus(is_focused);
493}
494
alexmosb1dc2162015-11-05 00:59:20495void RenderFrameProxy::OnSetFocusedFrame() {
496 // This uses focusDocumentView rather than setFocusedFrame so that blur
497 // events are properly dispatched on any currently focused elements.
Blink Reformat1c4d759e2017-04-09 16:34:54498 render_view_->webview()->FocusDocumentView(web_frame_);
alexmosb1dc2162015-11-05 00:59:20499}
500
alexmos1f7eac4a2016-05-25 23:04:55501void RenderFrameProxy::OnWillEnterFullscreen() {
Blink Reformat1c4d759e2017-04-09 16:34:54502 web_frame_->WillEnterFullscreen();
alexmos1f7eac4a2016-05-25 23:04:55503}
504
japhet61835ae12017-01-20 01:25:39505void RenderFrameProxy::OnSetHasReceivedUserGesture() {
Blink Reformat1c4d759e2017-04-09 16:34:54506 web_frame_->SetHasReceivedUserGesture();
japhet61835ae12017-01-20 01:25:39507}
508
Ehsan Karamadf152db882017-10-23 17:41:25509void RenderFrameProxy::OnScrollRectToVisible(
510 const gfx::Rect& rect_to_scroll,
511 const blink::WebRemoteScrollProperties& properties) {
512 web_frame_->ScrollRectToVisible(rect_to_scroll, properties);
513}
514
Fady Samueld10aadd82017-11-03 18:23:57515void RenderFrameProxy::OnResizeDueToAutoResize(uint64_t sequence_number) {
516 pending_resize_params_.sequence_number = sequence_number;
517 WasResized();
518}
519
Scott Violet1098538e2017-10-05 19:23:33520#if defined(USE_AURA)
Scott Violet1098538e2017-10-05 19:23:33521void RenderFrameProxy::SetMusEmbeddedFrame(
522 std::unique_ptr<MusEmbeddedFrame> mus_embedded_frame) {
523 mus_embedded_frame_ = std::move(mus_embedded_frame);
524}
525#endif
526
Fady Samuel85a1bf72017-10-27 14:30:20527void RenderFrameProxy::WasResized() {
Fady Samuel1cc05222017-11-17 10:42:26528 if (!frame_sink_id_.is_valid())
529 return;
530
Fady Samuel85a1bf72017-10-27 14:30:20531 bool synchronized_params_changed =
532 !sent_resize_params_ ||
533 sent_resize_params_->frame_rect.size() !=
534 pending_resize_params_.frame_rect.size() ||
Fady Samueld10aadd82017-11-03 18:23:57535 sent_resize_params_->screen_info != pending_resize_params_.screen_info ||
536 sent_resize_params_->sequence_number !=
537 pending_resize_params_.sequence_number;
Fady Samuel85a1bf72017-10-27 14:30:20538
539 if (synchronized_params_changed)
Chris Blumeefd8f242017-12-08 00:24:27540 local_surface_id_ = parent_local_surface_id_allocator_.GenerateId();
Fady Samuel85a1bf72017-10-27 14:30:20541
Jonathan9e66f6a2017-11-15 20:08:53542 viz::SurfaceId surface_id(frame_sink_id_, local_surface_id_);
Fady Samuel1cc05222017-11-17 10:42:26543 if (enable_surface_synchronization_)
544 compositing_helper_->SetPrimarySurfaceId(surface_id, frame_rect().size());
Fady Samuel85a1bf72017-10-27 14:30:20545
546 bool rect_changed =
547 !sent_resize_params_ ||
548 sent_resize_params_->frame_rect != pending_resize_params_.frame_rect;
549 bool resize_params_changed = synchronized_params_changed || rect_changed;
550
Fady Samuel85a1bf72017-10-27 14:30:20551#if defined(USE_AURA)
552 if (rect_changed && mus_embedded_frame_)
Fady Samuel486b66072017-10-27 18:42:07553 mus_embedded_frame_->SetWindowBounds(local_surface_id_, frame_rect());
Fady Samuel85a1bf72017-10-27 14:30:20554#endif
555
Fady Samuel85a1bf72017-10-27 14:30:20556 if (resize_params_changed) {
557 // Let the browser know about the updated view rect.
Fady Samueld10aadd82017-11-03 18:23:57558 Send(new FrameHostMsg_UpdateResizeParams(
559 routing_id_, frame_rect(), screen_info(), auto_size_sequence_number(),
Jonathan9e66f6a2017-11-15 20:08:53560 surface_id));
Fady Samuel85a1bf72017-10-27 14:30:20561 sent_resize_params_ = pending_resize_params_;
562 }
563}
564
Blink Reformat1c4d759e2017-04-09 16:34:54565void RenderFrameProxy::FrameDetached(DetachType type) {
Scott Violet1098538e2017-10-05 19:23:33566#if defined(USE_AURA)
567 mus_embedded_frame_.reset();
568#endif
569
Blink Reformat1c4d759e2017-04-09 16:34:54570 if (type == DetachType::kRemove && web_frame_->Parent()) {
creis0f6edddc2015-04-08 00:20:52571 // Let the browser process know this subframe is removed, so that it is
572 // destroyed in its current process.
573 Send(new FrameHostMsg_Detach(routing_id_));
574 }
575
Blink Reformat1c4d759e2017-04-09 16:34:54576 web_frame_->Close();
naskoef4c1122015-05-08 01:17:43577
alexmosf076d912017-01-23 22:27:57578 // If this proxy was associated with a provisional RenderFrame, and we're not
579 // in the process of swapping with it, clean it up as well.
Blink Reformat1c4d759e2017-04-09 16:34:54580 if (type == DetachType::kRemove &&
alexmosf076d912017-01-23 22:27:57581 provisional_frame_routing_id_ != MSG_ROUTING_NONE) {
582 RenderFrameImpl* provisional_frame =
583 RenderFrameImpl::FromRoutingID(provisional_frame_routing_id_);
584 // |provisional_frame| should always exist. If it was deleted via
585 // FrameMsg_Delete right before this proxy was removed,
586 // RenderFrameImpl::frameDetached would've cleared this proxy's
587 // |provisional_frame_routing_id_| and we wouldn't get here.
588 CHECK(provisional_frame);
Blink Reformat1c4d759e2017-04-09 16:34:54589 provisional_frame->GetWebFrame()->Detach();
alexmosf076d912017-01-23 22:27:57590 }
591
naskoef4c1122015-05-08 01:17:43592 // Remove the entry in the WebFrame->RenderFrameProxy map, as the |web_frame_|
593 // is no longer valid.
594 FrameMap::iterator it = g_frame_map.Get().find(web_frame_);
595 CHECK(it != g_frame_map.Get().end());
596 CHECK_EQ(it->second, this);
597 g_frame_map.Get().erase(it);
598
599 web_frame_ = nullptr;
600
nasko6e5f5512014-10-17 04:06:00601 delete this;
602}
603
Blink Reformat1c4d759e2017-04-09 16:34:54604void RenderFrameProxy::ForwardPostMessage(
japhet4dad341e2014-09-09 21:11:11605 blink::WebLocalFrame* source_frame,
606 blink::WebRemoteFrame* target_frame,
607 blink::WebSecurityOrigin target_origin,
608 blink::WebDOMMessageEvent event) {
609 DCHECK(!web_frame_ || web_frame_ == target_frame);
610
alexmose7da5a12015-04-09 02:22:16611 FrameMsg_PostMessage_Params params;
japhet4dad341e2014-09-09 21:11:11612 params.is_data_raw_string = false;
Blink Reformat1c4d759e2017-04-09 16:34:54613 params.data = event.Data().ToString().Utf16();
614 params.source_origin = event.Origin().Utf16();
615 if (!target_origin.IsNull())
616 params.target_origin = target_origin.ToString().Utf16();
japhet4dad341e2014-09-09 21:11:11617
Marijn Kruisselbrink6dc8a882017-10-04 02:33:23618 params.message_ports = event.ReleaseChannels().ReleaseVector();
japhet4dad341e2014-09-09 21:11:11619
620 // Include the routing ID for the source frame (if one exists), which the
621 // browser process will translate into the routing ID for the equivalent
622 // frame in the target process.
623 params.source_routing_id = MSG_ROUTING_NONE;
624 if (source_frame) {
alexmose7da5a12015-04-09 02:22:16625 RenderFrameImpl* source_render_frame =
626 RenderFrameImpl::FromWebFrame(source_frame);
627 if (source_render_frame)
628 params.source_routing_id = source_render_frame->GetRoutingID();
japhet4dad341e2014-09-09 21:11:11629 }
630
alexmose7da5a12015-04-09 02:22:16631 Send(new FrameHostMsg_RouteMessageEvent(routing_id_, params));
japhet4dad341e2014-09-09 21:11:11632}
633
Blink Reformat1c4d759e2017-04-09 16:34:54634void RenderFrameProxy::Navigate(const blink::WebURLRequest& request,
japhet70ea1342014-09-30 21:56:39635 bool should_replace_current_entry) {
636 FrameHostMsg_OpenURL_Params params;
Blink Reformat1c4d759e2017-04-09 16:34:54637 params.url = request.Url();
638 params.uses_post = request.HttpMethod().Utf8() == "POST";
lukaszabb2101b82016-06-17 16:52:25639 params.resource_request_body = GetRequestBodyForWebURLRequest(request);
Kinuko Yasuda5acc0a02017-09-01 13:57:35640 params.extra_headers = GetWebURLRequestHeadersAsString(request);
Blink Reformat1c4d759e2017-04-09 16:34:54641 params.referrer = Referrer(blink::WebStringToGURL(request.HttpHeaderField(
642 blink::WebString::FromUTF8("Referer"))),
643 request.GetReferrerPolicy());
nick3b04f322016-08-31 19:29:19644 params.disposition = WindowOpenDisposition::CURRENT_TAB;
japhet70ea1342014-09-30 21:56:39645 params.should_replace_current_entry = should_replace_current_entry;
Blink Reformat1c4d759e2017-04-09 16:34:54646 params.user_gesture = request.HasUserGesture();
Charles Harrisonbd8675982017-06-20 22:13:49647 params.triggering_event_info = blink::WebTriggeringEventInfo::kUnknown;
japhet70ea1342014-09-30 21:56:39648 Send(new FrameHostMsg_OpenURL(routing_id_, params));
649}
650
Blink Reformat1c4d759e2017-04-09 16:34:54651void RenderFrameProxy::FrameRectsChanged(const blink::WebRect& frame_rect) {
Fady Samuel85a1bf72017-10-27 14:30:20652 pending_resize_params_.frame_rect = gfx::Rect(frame_rect);
Fady Samuelc342f9972017-11-15 23:51:43653 pending_resize_params_.screen_info = render_widget_->screen_info();
Fady Samuel85a1bf72017-10-27 14:30:20654 WasResized();
lazyboy0882dfce2015-08-16 05:47:38655}
656
Blink Reformat1c4d759e2017-04-09 16:34:54657void RenderFrameProxy::UpdateRemoteViewportIntersection(
kenrbea731792017-01-13 15:10:48658 const blink::WebRect& viewportIntersection) {
659 Send(new FrameHostMsg_UpdateViewportIntersection(
660 routing_id_, gfx::Rect(viewportIntersection)));
661}
662
Blink Reformat1c4d759e2017-04-09 16:34:54663void RenderFrameProxy::VisibilityChanged(bool visible) {
ekaramadbabb9bf2016-01-12 15:17:02664 Send(new FrameHostMsg_VisibilityChanged(routing_id_, visible));
665}
666
kenrb04323782017-06-23 01:23:32667void RenderFrameProxy::SetIsInert(bool inert) {
668 Send(new FrameHostMsg_SetIsInert(routing_id_, inert));
669}
670
Ken Buchanan8a319fb2017-11-15 18:37:12671void RenderFrameProxy::UpdateRenderThrottlingStatus(bool is_throttled,
672 bool subtree_throttled) {
673 Send(new FrameHostMsg_UpdateRenderThrottlingStatus(routing_id_, is_throttled,
674 subtree_throttled));
675}
676
Blink Reformat1c4d759e2017-04-09 16:34:54677void RenderFrameProxy::DidChangeOpener(blink::WebFrame* opener) {
alexmos95733002015-08-24 16:38:09678 // A proxy shouldn't normally be disowning its opener. It is possible to get
679 // here when a proxy that is being detached clears its opener, in which case
680 // there is no need to notify the browser process.
681 if (!opener)
682 return;
683
684 // Only a LocalFrame (i.e., the caller of window.open) should be able to
685 // update another frame's opener.
Blink Reformat1c4d759e2017-04-09 16:34:54686 DCHECK(opener->IsWebLocalFrame());
alexmos95733002015-08-24 16:38:09687
688 int opener_routing_id =
Blink Reformat1c4d759e2017-04-09 16:34:54689 RenderFrameImpl::FromWebFrame(opener->ToWebLocalFrame())->GetRoutingID();
alexmos95733002015-08-24 16:38:09690 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id));
691}
692
Blink Reformat1c4d759e2017-04-09 16:34:54693void RenderFrameProxy::AdvanceFocus(blink::WebFocusType type,
alexmos401f0aba2015-12-06 10:07:39694 blink::WebLocalFrame* source) {
695 int source_routing_id = RenderFrameImpl::FromWebFrame(source)->GetRoutingID();
696 Send(new FrameHostMsg_AdvanceFocus(routing_id_, type, source_routing_id));
697}
698
Blink Reformat1c4d759e2017-04-09 16:34:54699void RenderFrameProxy::FrameFocused() {
alexmos5357efb2015-12-16 21:44:00700 Send(new FrameHostMsg_FrameFocused(routing_id_));
701}
702
Scott Violetf1291942017-10-20 22:38:27703#if defined(USE_AURA)
704void RenderFrameProxy::OnMusEmbeddedFrameSurfaceChanged(
705 const viz::SurfaceInfo& surface_info) {
706 SetChildFrameSurface(surface_info, viz::SurfaceSequence());
707}
708
709void RenderFrameProxy::OnMusEmbeddedFrameSinkIdAllocated(
710 const viz::FrameSinkId& frame_sink_id) {
Scott Violetb8e9ba132017-12-09 02:13:25711 // RendererWindowTreeClient should only call this when mus is hosting viz.
712 DCHECK(switches::IsMusHostingViz());
Scott Violetf1291942017-10-20 22:38:27713 frame_sink_id_ = frame_sink_id;
Scott Violetf1291942017-10-20 22:38:27714 // Resend the FrameRects and allocate a new viz::LocalSurfaceId when the view
715 // changes.
Fady Samuel85a1bf72017-10-27 14:30:20716 ResendResizeParams();
Scott Violetf1291942017-10-20 22:38:27717}
718#endif
719
Charlie Reisa2e1ab52017-12-06 00:03:13720} // namespace