| 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 "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/html/HTMLFrameOwnerElement.h" | 9 #include "core/html/HTMLFrameOwnerElement.h" |
| 10 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
| 11 #include "core/page/Page.h" | 11 #include "core/page/Page.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "public/platform/WebFloatRect.h" | 13 #include "public/platform/WebFloatRect.h" |
| 14 #include "public/platform/WebRect.h" | 14 #include "public/platform/WebRect.h" |
| 15 #include "public/web/WebDocument.h" | 15 #include "public/web/WebDocument.h" |
| 16 #include "public/web/WebFrameOwnerProperties.h" | 16 #include "public/web/WebFrameOwnerProperties.h" |
| 17 #include "public/web/WebPerformance.h" | 17 #include "public/web/WebPerformance.h" |
| 18 #include "public/web/WebRange.h" | 18 #include "public/web/WebRange.h" |
| 19 #include "public/web/WebTreeScopeType.h" | 19 #include "public/web/WebTreeScopeType.h" |
| 20 #include "web/RemoteBridgeFrameOwner.h" | 20 #include "web/RemoteBridgeFrameOwner.h" |
| 21 #include "web/WebLocalFrameImpl.h" |
| 21 #include "web/WebViewImpl.h" | 22 #include "web/WebViewImpl.h" |
| 22 #include <v8/include/v8.h> | 23 #include <v8/include/v8.h> |
| 23 | 24 |
| 24 namespace blink { | 25 namespace blink { |
| 25 | 26 |
| 26 WebRemoteFrame* WebRemoteFrame::create(WebTreeScopeType scope, WebRemoteFrameCli
ent* client, WebFrame* opener) | 27 WebRemoteFrame* WebRemoteFrame::create(WebTreeScopeType scope, WebRemoteFrameCli
ent* client, WebFrame* opener) |
| 27 { | 28 { |
| 28 return WebRemoteFrameImpl::create(scope, client, opener); | 29 return WebRemoteFrameImpl::create(scope, client, opener); |
| 29 } | 30 } |
| 30 | 31 |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const | 599 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const |
| 599 { | 600 { |
| 600 ASSERT_NOT_REACHED(); | 601 ASSERT_NOT_REACHED(); |
| 601 return WebString(); | 602 return WebString(); |
| 602 } | 603 } |
| 603 | 604 |
| 604 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(WebTreeScopeType scope, cons
t WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags, We
bFrameClient* client, WebFrame* previousSibling, const WebFrameOwnerProperties&
frameOwnerProperties, WebFrame* opener) | 605 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(WebTreeScopeType scope, cons
t WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags, We
bFrameClient* client, WebFrame* previousSibling, const WebFrameOwnerProperties&
frameOwnerProperties, WebFrame* opener) |
| 605 { | 606 { |
| 606 WebLocalFrameImpl* child = WebLocalFrameImpl::create(scope, client, opener); | 607 WebLocalFrameImpl* child = WebLocalFrameImpl::create(scope, client, opener); |
| 607 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | 608 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = |
| 608 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, sta
tic_cast<SandboxFlags>(sandboxFlags), frameOwnerProperties)); | 609 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(static_cas
t<SandboxFlags>(sandboxFlags), frameOwnerProperties)); |
| 609 insertAfter(child, previousSibling); | 610 insertAfter(child, previousSibling); |
| 610 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may | 611 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may |
| 611 // result in the browser observing two navigations to about:blank (one from
the initial | 612 // result in the browser observing two navigations to about:blank (one from
the initial |
| 612 // frame creation, and one from swapping it into the remote process). FrameL
oader might | 613 // frame creation, and one from swapping it into the remote process). FrameL
oader might |
| 613 // need a special initialization function for this case to avoid that duplic
ate navigation. | 614 // need a special initialization function for this case to avoid that duplic
ate navigation. |
| 614 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); | 615 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); |
| 615 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, | 616 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, |
| 616 // if the parent is remote, it should never be detached synchronously... | 617 // if the parent is remote, it should never be detached synchronously... |
| 617 ASSERT(child->frame()); | 618 ASSERT(child->frame()); |
| 618 return child; | 619 return child; |
| 619 } | 620 } |
| 620 | 621 |
| 621 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) | 622 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) |
| 622 { | 623 { |
| 623 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); | 624 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); |
| 624 frame()->createView(); | 625 frame()->createView(); |
| 625 m_frame->tree().setPrecalculatedName(name, uniqueName); | 626 m_frame->tree().setPrecalculatedName(name, uniqueName); |
| 626 } | 627 } |
| 627 | 628 |
| 628 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(WebTreeScopeType scope, co
nst WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags,
WebRemoteFrameClient* client, WebFrame* opener) | 629 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(WebTreeScopeType scope, co
nst WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags,
WebRemoteFrameClient* client, WebFrame* opener) |
| 629 { | 630 { |
| 630 WebRemoteFrameImpl* child = WebRemoteFrameImpl::create(scope, client, opener
); | 631 WebRemoteFrameImpl* child = WebRemoteFrameImpl::create(scope, client, opener
); |
| 631 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | 632 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = |
| 632 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(nullptr, s
tatic_cast<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties())); | 633 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(static_cas
t<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties())); |
| 633 appendChild(child); | 634 appendChild(child); |
| 634 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); | 635 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); |
| 635 return child; | 636 return child; |
| 636 } | 637 } |
| 637 | 638 |
| 638 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) | 639 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) |
| 639 { | 640 { |
| 640 m_frame = frame; | 641 m_frame = frame; |
| 641 } | 642 } |
| 642 | 643 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 : WebRemoteFrame(scope) | 729 : WebRemoteFrame(scope) |
| 729 , m_frameClient(RemoteFrameClientImpl::create(this)) | 730 , m_frameClient(RemoteFrameClientImpl::create(this)) |
| 730 , m_client(client) | 731 , m_client(client) |
| 731 #if ENABLE(OILPAN) | 732 #if ENABLE(OILPAN) |
| 732 , m_selfKeepAlive(this) | 733 , m_selfKeepAlive(this) |
| 733 #endif | 734 #endif |
| 734 { | 735 { |
| 735 } | 736 } |
| 736 | 737 |
| 737 } // namespace blink | 738 } // namespace blink |
| OLD | NEW |