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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 ASSERT_NOT_REACHED(); | 594 ASSERT_NOT_REACHED(); |
594 return false; | 595 return false; |
595 } | 596 } |
596 | 597 |
597 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const | 598 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const |
598 { | 599 { |
599 ASSERT_NOT_REACHED(); | 600 ASSERT_NOT_REACHED(); |
600 return WebString(); | 601 return WebString(); |
601 } | 602 } |
602 | 603 |
603 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(WebTreeScopeType scope, cons
t WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags, We
bFrameClient* client, WebFrame* previousSibling, const WebFrameOwnerProperties&
frameOwnerProperties) | 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) |
604 { | 605 { |
605 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(scope,
client)); | 606 WebLocalFrameImpl* child = WebLocalFrameImpl::create(scope, client, opener); |
606 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | 607 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = |
607 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, sta
tic_cast<SandboxFlags>(sandboxFlags), frameOwnerProperties)); | 608 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, sta
tic_cast<SandboxFlags>(sandboxFlags), frameOwnerProperties)); |
608 insertAfter(child, previousSibling); | 609 insertAfter(child, previousSibling); |
609 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may | 610 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may |
610 // result in the browser observing two navigations to about:blank (one from
the initial | 611 // result in the browser observing two navigations to about:blank (one from
the initial |
611 // frame creation, and one from swapping it into the remote process). FrameL
oader might | 612 // frame creation, and one from swapping it into the remote process). FrameL
oader might |
612 // need a special initialization function for this case to avoid that duplic
ate navigation. | 613 // need a special initialization function for this case to avoid that duplic
ate navigation. |
613 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); | 614 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); |
614 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, | 615 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, |
615 // if the parent is remote, it should never be detached synchronously... | 616 // if the parent is remote, it should never be detached synchronously... |
616 ASSERT(child->frame()); | 617 ASSERT(child->frame()); |
617 return child; | 618 return child; |
618 } | 619 } |
619 | 620 |
620 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) | 621 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) |
621 { | 622 { |
622 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); | 623 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); |
623 frame()->createView(); | 624 frame()->createView(); |
624 m_frame->tree().setPrecalculatedName(name, uniqueName); | 625 m_frame->tree().setPrecalculatedName(name, uniqueName); |
625 } | 626 } |
626 | 627 |
627 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(WebTreeScopeType scope, co
nst WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags,
WebRemoteFrameClient* client) | 628 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(WebTreeScopeType scope, co
nst WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags,
WebRemoteFrameClient* client, WebFrame* opener) |
628 { | 629 { |
629 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(scop
e, client)); | 630 WebRemoteFrameImpl* child = WebRemoteFrameImpl::create(scope, client, opener
); |
630 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | 631 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = |
631 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(nullptr, s
tatic_cast<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties())); | 632 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(nullptr, s
tatic_cast<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties())); |
632 appendChild(child); | 633 appendChild(child); |
633 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); | 634 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); |
634 return child; | 635 return child; |
635 } | 636 } |
636 | 637 |
637 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) | 638 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) |
638 { | 639 { |
639 m_frame = frame; | 640 m_frame = frame; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 : WebRemoteFrame(scope) | 728 : WebRemoteFrame(scope) |
728 , m_frameClient(RemoteFrameClientImpl::create(this)) | 729 , m_frameClient(RemoteFrameClientImpl::create(this)) |
729 , m_client(client) | 730 , m_client(client) |
730 #if ENABLE(OILPAN) | 731 #if ENABLE(OILPAN) |
731 , m_selfKeepAlive(this) | 732 , m_selfKeepAlive(this) |
732 #endif | 733 #endif |
733 { | 734 { |
734 } | 735 } |
735 | 736 |
736 } // namespace blink | 737 } // namespace blink |
OLD | NEW |