| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "web/WebRemoteFrameImpl.h" | 5 #include "web/WebRemoteFrameImpl.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/DOMWrapperWorld.h" | 7 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 8 #include "bindings/core/v8/WindowProxy.h" | 8 #include "bindings/core/v8/WindowProxy.h" |
| 9 #include "core/dom/Fullscreen.h" | 9 #include "core/dom/Fullscreen.h" |
| 10 #include "core/dom/RemoteSecurityContext.h" | 10 #include "core/dom/RemoteSecurityContext.h" |
| 11 #include "core/dom/SecurityContext.h" | 11 #include "core/dom/SecurityContext.h" |
| 12 #include "core/frame/FrameHost.h" | |
| 13 #include "core/frame/FrameView.h" | 12 #include "core/frame/FrameView.h" |
| 14 #include "core/frame/Settings.h" | 13 #include "core/frame/Settings.h" |
| 15 #include "core/frame/csp/ContentSecurityPolicy.h" | 14 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 16 #include "core/html/HTMLFrameOwnerElement.h" | 15 #include "core/html/HTMLFrameOwnerElement.h" |
| 17 #include "core/layout/LayoutObject.h" | 16 #include "core/layout/LayoutObject.h" |
| 18 #include "core/page/Page.h" | 17 #include "core/page/Page.h" |
| 19 #include "platform/feature_policy/FeaturePolicy.h" | 18 #include "platform/feature_policy/FeaturePolicy.h" |
| 20 #include "platform/heap/Handle.h" | 19 #include "platform/heap/Handle.h" |
| 21 #include "public/platform/WebFeaturePolicy.h" | 20 #include "public/platform/WebFeaturePolicy.h" |
| 22 #include "public/platform/WebFloatRect.h" | 21 #include "public/platform/WebFloatRect.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 WebLocalFrameImpl* child = WebLocalFrameImpl::create( | 329 WebLocalFrameImpl* child = WebLocalFrameImpl::create( |
| 331 scope, client, interfaceProvider, interfaceRegistry, opener); | 330 scope, client, interfaceProvider, interfaceRegistry, opener); |
| 332 insertAfter(child, previousSibling); | 331 insertAfter(child, previousSibling); |
| 333 RemoteFrameOwner* owner = RemoteFrameOwner::create( | 332 RemoteFrameOwner* owner = RemoteFrameOwner::create( |
| 334 static_cast<SandboxFlags>(sandboxFlags), frameOwnerProperties); | 333 static_cast<SandboxFlags>(sandboxFlags), frameOwnerProperties); |
| 335 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, | 334 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, |
| 336 // which may result in the browser observing two navigations to about:blank | 335 // which may result in the browser observing two navigations to about:blank |
| 337 // (one from the initial frame creation, and one from swapping it into the | 336 // (one from the initial frame creation, and one from swapping it into the |
| 338 // remote process). FrameLoader might need a special initialization function | 337 // remote process). FrameLoader might need a special initialization function |
| 339 // for this case to avoid that duplicate navigation. | 338 // for this case to avoid that duplicate navigation. |
| 340 child->initializeCoreFrame(frame()->host(), owner, name); | 339 child->initializeCoreFrame(*frame()->page(), owner, name); |
| 341 // Partially related with the above FIXME--the init() call may trigger JS | 340 // Partially related with the above FIXME--the init() call may trigger JS |
| 342 // dispatch. However, | 341 // dispatch. However, |
| 343 // if the parent is remote, it should never be detached synchronously... | 342 // if the parent is remote, it should never be detached synchronously... |
| 344 DCHECK(child->frame()); | 343 DCHECK(child->frame()); |
| 345 return child; | 344 return child; |
| 346 } | 345 } |
| 347 | 346 |
| 348 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, | 347 void WebRemoteFrameImpl::initializeCoreFrame(Page& page, |
| 349 FrameOwner* owner, | 348 FrameOwner* owner, |
| 350 const AtomicString& name) { | 349 const AtomicString& name) { |
| 351 setCoreFrame(RemoteFrame::create(m_frameClient.get(), | 350 setCoreFrame(RemoteFrame::create(m_frameClient.get(), &page, owner)); |
| 352 host ? &host->page() : nullptr, owner)); | |
| 353 frame()->createView(); | 351 frame()->createView(); |
| 354 m_frame->tree().setName(name); | 352 m_frame->tree().setName(name); |
| 355 } | 353 } |
| 356 | 354 |
| 357 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild( | 355 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild( |
| 358 WebTreeScopeType scope, | 356 WebTreeScopeType scope, |
| 359 const WebString& name, | 357 const WebString& name, |
| 360 WebSandboxFlags sandboxFlags, | 358 WebSandboxFlags sandboxFlags, |
| 361 WebRemoteFrameClient* client, | 359 WebRemoteFrameClient* client, |
| 362 WebFrame* opener) { | 360 WebFrame* opener) { |
| 363 WebRemoteFrameImpl* child = WebRemoteFrameImpl::create(scope, client, opener); | 361 WebRemoteFrameImpl* child = WebRemoteFrameImpl::create(scope, client, opener); |
| 364 appendChild(child); | 362 appendChild(child); |
| 365 RemoteFrameOwner* owner = RemoteFrameOwner::create( | 363 RemoteFrameOwner* owner = RemoteFrameOwner::create( |
| 366 static_cast<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties()); | 364 static_cast<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties()); |
| 367 child->initializeCoreFrame(frame()->host(), owner, name); | 365 child->initializeCoreFrame(*frame()->page(), owner, name); |
| 368 return child; | 366 return child; |
| 369 } | 367 } |
| 370 | 368 |
| 371 void WebRemoteFrameImpl::setWebLayer(WebLayer* layer) { | 369 void WebRemoteFrameImpl::setWebLayer(WebLayer* layer) { |
| 372 if (!frame()) | 370 if (!frame()) |
| 373 return; | 371 return; |
| 374 | 372 |
| 375 frame()->setWebLayer(layer); | 373 frame()->setWebLayer(layer); |
| 376 } | 374 } |
| 377 | 375 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 } | 527 } |
| 530 | 528 |
| 531 WebRemoteFrameImpl::WebRemoteFrameImpl(WebTreeScopeType scope, | 529 WebRemoteFrameImpl::WebRemoteFrameImpl(WebTreeScopeType scope, |
| 532 WebRemoteFrameClient* client) | 530 WebRemoteFrameClient* client) |
| 533 : WebRemoteFrame(scope), | 531 : WebRemoteFrame(scope), |
| 534 m_frameClient(RemoteFrameClientImpl::create(this)), | 532 m_frameClient(RemoteFrameClientImpl::create(this)), |
| 535 m_client(client), | 533 m_client(client), |
| 536 m_selfKeepAlive(this) {} | 534 m_selfKeepAlive(this) {} |
| 537 | 535 |
| 538 } // namespace blink | 536 } // namespace blink |
| OLD | NEW |