| 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" |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 WebLocalFrameImpl* child = WebLocalFrameImpl::create(scope, client, opener); | 584 WebLocalFrameImpl* child = WebLocalFrameImpl::create(scope, client, opener); |
| 585 insertAfter(child, previousSibling); | 585 insertAfter(child, previousSibling); |
| 586 RawPtr<RemoteFrameOwner> owner = RemoteFrameOwner::create(static_cast<Sandbo
xFlags>(sandboxFlags), frameOwnerProperties); | 586 RawPtr<RemoteFrameOwner> owner = RemoteFrameOwner::create(static_cast<Sandbo
xFlags>(sandboxFlags), frameOwnerProperties); |
| 587 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may | 587 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may |
| 588 // result in the browser observing two navigations to about:blank (one from
the initial | 588 // result in the browser observing two navigations to about:blank (one from
the initial |
| 589 // frame creation, and one from swapping it into the remote process). FrameL
oader might | 589 // frame creation, and one from swapping it into the remote process). FrameL
oader might |
| 590 // need a special initialization function for this case to avoid that duplic
ate navigation. | 590 // need a special initialization function for this case to avoid that duplic
ate navigation. |
| 591 child->initializeCoreFrame(frame()->host(), owner.get(), name, uniqueName); | 591 child->initializeCoreFrame(frame()->host(), owner.get(), name, uniqueName); |
| 592 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, | 592 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, |
| 593 // if the parent is remote, it should never be detached synchronously... | 593 // if the parent is remote, it should never be detached synchronously... |
| 594 ASSERT(child->frame()); | 594 DCHECK(child->frame()); |
| 595 return child; | 595 return child; |
| 596 } | 596 } |
| 597 | 597 |
| 598 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) | 598 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) |
| 599 { | 599 { |
| 600 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); | 600 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); |
| 601 frame()->createView(); | 601 frame()->createView(); |
| 602 m_frame->tree().setPrecalculatedName(name, uniqueName); | 602 m_frame->tree().setPrecalculatedName(name, uniqueName); |
| 603 } | 603 } |
| 604 | 604 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 618 | 618 |
| 619 WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame) | 619 WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame) |
| 620 { | 620 { |
| 621 if (!frame.client()) | 621 if (!frame.client()) |
| 622 return nullptr; | 622 return nullptr; |
| 623 return static_cast<RemoteFrameClientImpl*>(frame.client())->webFrame(); | 623 return static_cast<RemoteFrameClientImpl*>(frame.client())->webFrame(); |
| 624 } | 624 } |
| 625 | 625 |
| 626 void WebRemoteFrameImpl::initializeFromFrame(WebLocalFrame* source) const | 626 void WebRemoteFrameImpl::initializeFromFrame(WebLocalFrame* source) const |
| 627 { | 627 { |
| 628 ASSERT(source); | 628 DCHECK(source); |
| 629 WebLocalFrameImpl* localFrameImpl = toWebLocalFrameImpl(source); | 629 WebLocalFrameImpl* localFrameImpl = toWebLocalFrameImpl(source); |
| 630 | 630 |
| 631 client()->initializeChildFrame( | 631 client()->initializeChildFrame( |
| 632 localFrameImpl->frame()->view()->frameRect(), | 632 localFrameImpl->frame()->view()->frameRect(), |
| 633 localFrameImpl->frame()->page()->deviceScaleFactor()); | 633 localFrameImpl->frame()->page()->deviceScaleFactor()); |
| 634 } | 634 } |
| 635 | 635 |
| 636 void WebRemoteFrameImpl::setReplicatedOrigin(const WebSecurityOrigin& origin) co
nst | 636 void WebRemoteFrameImpl::setReplicatedOrigin(const WebSecurityOrigin& origin) co
nst |
| 637 { | 637 { |
| 638 ASSERT(frame()); | 638 DCHECK(frame()); |
| 639 frame()->securityContext()->setReplicatedOrigin(origin); | 639 frame()->securityContext()->setReplicatedOrigin(origin); |
| 640 | 640 |
| 641 // If the origin of a remote frame changed, the accessibility object for the
owner | 641 // If the origin of a remote frame changed, the accessibility object for the
owner |
| 642 // element now points to a different child. | 642 // element now points to a different child. |
| 643 // | 643 // |
| 644 // TODO(dmazzoni, dcheng): there's probably a better way to solve this. | 644 // TODO(dmazzoni, dcheng): there's probably a better way to solve this. |
| 645 // Run SitePerProcessAccessibilityBrowserTest.TwoCrossSiteNavigations to | 645 // Run SitePerProcessAccessibilityBrowserTest.TwoCrossSiteNavigations to |
| 646 // ensure an alternate fix works. http://crbug.com/566222 | 646 // ensure an alternate fix works. http://crbug.com/566222 |
| 647 FrameOwner* owner = frame()->owner(); | 647 FrameOwner* owner = frame()->owner(); |
| 648 if (owner && owner->isLocal()) { | 648 if (owner && owner->isLocal()) { |
| 649 HTMLElement* ownerElement = toHTMLFrameOwnerElement(owner); | 649 HTMLElement* ownerElement = toHTMLFrameOwnerElement(owner); |
| 650 AXObjectCache* cache = ownerElement->document().existingAXObjectCache(); | 650 AXObjectCache* cache = ownerElement->document().existingAXObjectCache(); |
| 651 if (cache) | 651 if (cache) |
| 652 cache->childrenChanged(ownerElement); | 652 cache->childrenChanged(ownerElement); |
| 653 } | 653 } |
| 654 } | 654 } |
| 655 | 655 |
| 656 void WebRemoteFrameImpl::setReplicatedSandboxFlags(WebSandboxFlags flags) const | 656 void WebRemoteFrameImpl::setReplicatedSandboxFlags(WebSandboxFlags flags) const |
| 657 { | 657 { |
| 658 ASSERT(frame()); | 658 DCHECK(frame()); |
| 659 frame()->securityContext()->enforceSandboxFlags(static_cast<SandboxFlags>(fl
ags)); | 659 frame()->securityContext()->enforceSandboxFlags(static_cast<SandboxFlags>(fl
ags)); |
| 660 } | 660 } |
| 661 | 661 |
| 662 void WebRemoteFrameImpl::setReplicatedName(const WebString& name, const WebStrin
g& uniqueName) const | 662 void WebRemoteFrameImpl::setReplicatedName(const WebString& name, const WebStrin
g& uniqueName) const |
| 663 { | 663 { |
| 664 ASSERT(frame()); | 664 DCHECK(frame()); |
| 665 frame()->tree().setPrecalculatedName(name, uniqueName); | 665 frame()->tree().setPrecalculatedName(name, uniqueName); |
| 666 } | 666 } |
| 667 | 667 |
| 668 void WebRemoteFrameImpl::setReplicatedShouldEnforceStrictMixedContentChecking(bo
ol shouldEnforce) const | 668 void WebRemoteFrameImpl::setReplicatedShouldEnforceStrictMixedContentChecking(bo
ol shouldEnforce) const |
| 669 { | 669 { |
| 670 ASSERT(frame()); | 670 DCHECK(frame()); |
| 671 frame()->securityContext()->setShouldEnforceStrictMixedContentChecking(shoul
dEnforce); | 671 frame()->securityContext()->setShouldEnforceStrictMixedContentChecking(shoul
dEnforce); |
| 672 } | 672 } |
| 673 | 673 |
| 674 void WebRemoteFrameImpl::setReplicatedPotentiallyTrustworthyUniqueOrigin(bool is
UniqueOriginPotentiallyTrustworthy) const | 674 void WebRemoteFrameImpl::setReplicatedPotentiallyTrustworthyUniqueOrigin(bool is
UniqueOriginPotentiallyTrustworthy) const |
| 675 { | 675 { |
| 676 ASSERT(frame()); | 676 DCHECK(frame()); |
| 677 // If |isUniqueOriginPotentiallyTrustworthy| is true, then the origin must b
e unique. | 677 // If |isUniqueOriginPotentiallyTrustworthy| is true, then the origin must b
e unique. |
| 678 ASSERT(!isUniqueOriginPotentiallyTrustworthy || frame()->securityContext()->
getSecurityOrigin()->isUnique()); | 678 DCHECK(!isUniqueOriginPotentiallyTrustworthy || frame()->securityContext()->
getSecurityOrigin()->isUnique()); |
| 679 frame()->securityContext()->getSecurityOrigin()->setUniqueOriginIsPotentiall
yTrustworthy(isUniqueOriginPotentiallyTrustworthy); | 679 frame()->securityContext()->getSecurityOrigin()->setUniqueOriginIsPotentiall
yTrustworthy(isUniqueOriginPotentiallyTrustworthy); |
| 680 } | 680 } |
| 681 | 681 |
| 682 void WebRemoteFrameImpl::DispatchLoadEventForFrameOwner() const | 682 void WebRemoteFrameImpl::DispatchLoadEventForFrameOwner() const |
| 683 { | 683 { |
| 684 ASSERT(frame()->owner()->isLocal()); | 684 DCHECK(frame()->owner()->isLocal()); |
| 685 frame()->owner()->dispatchLoad(); | 685 frame()->owner()->dispatchLoad(); |
| 686 } | 686 } |
| 687 | 687 |
| 688 void WebRemoteFrameImpl::didStartLoading() | 688 void WebRemoteFrameImpl::didStartLoading() |
| 689 { | 689 { |
| 690 frame()->setIsLoading(true); | 690 frame()->setIsLoading(true); |
| 691 } | 691 } |
| 692 | 692 |
| 693 void WebRemoteFrameImpl::didStopLoading() | 693 void WebRemoteFrameImpl::didStopLoading() |
| 694 { | 694 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 712 : WebRemoteFrame(scope) | 712 : WebRemoteFrame(scope) |
| 713 , m_frameClient(RemoteFrameClientImpl::create(this)) | 713 , m_frameClient(RemoteFrameClientImpl::create(this)) |
| 714 , m_client(client) | 714 , m_client(client) |
| 715 #if ENABLE(OILPAN) | 715 #if ENABLE(OILPAN) |
| 716 , m_selfKeepAlive(this) | 716 , m_selfKeepAlive(this) |
| 717 #endif | 717 #endif |
| 718 { | 718 { |
| 719 } | 719 } |
| 720 | 720 |
| 721 } // namespace blink | 721 } // namespace blink |
| OLD | NEW |