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/WebViewImpl.h" | 21 #include "web/WebViewImpl.h" |
22 #include <v8/include/v8.h> | 22 #include <v8/include/v8.h> |
23 | 23 |
24 namespace blink { | 24 namespace blink { |
25 | 25 |
26 WebRemoteFrame* WebRemoteFrame::create(WebTreeScopeType scope, WebRemoteFrameCli
ent* client) | 26 WebRemoteFrame* WebRemoteFrame::create(WebTreeScopeType scope, WebRemoteFrameCli
ent* client, WebFrame* opener) |
27 { | 27 { |
28 return WebRemoteFrameImpl::create(scope, client); | 28 return WebRemoteFrameImpl::create(scope, client, opener); |
29 } | 29 } |
30 | 30 |
31 WebRemoteFrameImpl* WebRemoteFrameImpl::create(WebTreeScopeType scope, WebRemote
FrameClient* client) | 31 WebRemoteFrameImpl* WebRemoteFrameImpl::create(WebTreeScopeType scope, WebRemote
FrameClient* client, WebFrame* opener) |
32 { | 32 { |
33 WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(scope, client); | 33 WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(scope, client); |
| 34 frame->setOpener(opener); |
34 #if ENABLE(OILPAN) | 35 #if ENABLE(OILPAN) |
35 return frame; | 36 return frame; |
36 #else | 37 #else |
37 return adoptRef(frame).leakRef(); | 38 return adoptRef(frame).leakRef(); |
38 #endif | 39 #endif |
39 } | 40 } |
40 | 41 |
41 WebRemoteFrameImpl::~WebRemoteFrameImpl() | 42 WebRemoteFrameImpl::~WebRemoteFrameImpl() |
42 { | 43 { |
43 } | 44 } |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 ASSERT_NOT_REACHED(); | 601 ASSERT_NOT_REACHED(); |
601 return false; | 602 return false; |
602 } | 603 } |
603 | 604 |
604 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const | 605 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const |
605 { | 606 { |
606 ASSERT_NOT_REACHED(); | 607 ASSERT_NOT_REACHED(); |
607 return WebString(); | 608 return WebString(); |
608 } | 609 } |
609 | 610 |
610 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(WebTreeScopeType scope, cons
t WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags, We
bFrameClient* client, WebFrame* previousSibling, const WebFrameOwnerProperties&
frameOwnerProperties) | 611 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(WebTreeScopeType scope, cons
t WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags, We
bFrameClient* client, WebFrame* previousSibling, const WebFrameOwnerProperties&
frameOwnerProperties, WebFrame* opener) |
611 { | 612 { |
612 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(scope,
client)); | 613 WebLocalFrameImpl* child = WebLocalFrameImpl::create(scope, client, opener); |
613 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | 614 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = |
614 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, sta
tic_cast<SandboxFlags>(sandboxFlags), frameOwnerProperties)); | 615 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, sta
tic_cast<SandboxFlags>(sandboxFlags), frameOwnerProperties)); |
615 insertAfter(child, previousSibling); | 616 insertAfter(child, previousSibling); |
616 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may | 617 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may |
617 // result in the browser observing two navigations to about:blank (one from
the initial | 618 // result in the browser observing two navigations to about:blank (one from
the initial |
618 // frame creation, and one from swapping it into the remote process). FrameL
oader might | 619 // frame creation, and one from swapping it into the remote process). FrameL
oader might |
619 // need a special initialization function for this case to avoid that duplic
ate navigation. | 620 // need a special initialization function for this case to avoid that duplic
ate navigation. |
620 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); | 621 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); |
621 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, | 622 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, |
622 // if the parent is remote, it should never be detached synchronously... | 623 // if the parent is remote, it should never be detached synchronously... |
623 ASSERT(child->frame()); | 624 ASSERT(child->frame()); |
624 return child; | 625 return child; |
625 } | 626 } |
626 | 627 |
627 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) | 628 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) |
628 { | 629 { |
629 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); | 630 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); |
630 frame()->createView(); | 631 frame()->createView(); |
631 m_frame->tree().setPrecalculatedName(name, uniqueName); | 632 m_frame->tree().setPrecalculatedName(name, uniqueName); |
632 } | 633 } |
633 | 634 |
634 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(WebTreeScopeType scope, co
nst WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags,
WebRemoteFrameClient* client) | 635 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(WebTreeScopeType scope, co
nst WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags,
WebRemoteFrameClient* client, WebFrame* opener) |
635 { | 636 { |
636 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(scop
e, client)); | 637 WebRemoteFrameImpl* child = WebRemoteFrameImpl::create(scope, client, opener
); |
637 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | 638 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = |
638 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(nullptr, s
tatic_cast<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties())); | 639 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(nullptr, s
tatic_cast<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties())); |
639 appendChild(child); | 640 appendChild(child); |
640 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); | 641 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); |
641 return child; | 642 return child; |
642 } | 643 } |
643 | 644 |
644 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) | 645 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) |
645 { | 646 { |
646 m_frame = frame; | 647 m_frame = frame; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 : WebRemoteFrame(scope) | 735 : WebRemoteFrame(scope) |
735 , m_frameClient(RemoteFrameClientImpl::create(this)) | 736 , m_frameClient(RemoteFrameClientImpl::create(this)) |
736 , m_client(client) | 737 , m_client(client) |
737 #if ENABLE(OILPAN) | 738 #if ENABLE(OILPAN) |
738 , m_selfKeepAlive(this) | 739 , m_selfKeepAlive(this) |
739 #endif | 740 #endif |
740 { | 741 { |
741 } | 742 } |
742 | 743 |
743 } // namespace blink | 744 } // namespace blink |
OLD | NEW |