Chromium Code Reviews| 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 "config.h" | 5 #include "config.h" |
| 6 #include "web/WebRemoteFrameImpl.h" | 6 #include "web/WebRemoteFrameImpl.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/RemoteFrame.h" | 9 #include "core/frame/RemoteFrame.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 public: | 33 public: |
| 34 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillB eRawPtr<WebLocalFrameImpl> frame) | 34 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillB eRawPtr<WebLocalFrameImpl> frame) |
| 35 { | 35 { |
| 36 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame)); | 36 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual bool isLocal() const override; | 39 virtual bool isLocal() const override; |
| 40 virtual SandboxFlags sandboxFlags() const override; | 40 virtual SandboxFlags sandboxFlags() const override; |
| 41 virtual void dispatchLoad() override; | 41 virtual void dispatchLoad() override; |
| 42 | 42 |
| 43 void setSandboxFlags(SandboxFlags); | |
| 44 | |
| 43 virtual void trace(Visitor*); | 45 virtual void trace(Visitor*); |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>); | 48 explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>); |
| 47 | 49 |
| 48 RefPtrWillBeMember<WebLocalFrameImpl> m_frame; | 50 RefPtrWillBeMember<WebLocalFrameImpl> m_frame; |
| 51 SandboxFlags m_sandboxFlags; | |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFr ameImpl> frame) | 54 RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFr ameImpl> frame) |
| 52 : m_frame(frame) | 55 : m_frame(frame) |
| 56 , m_sandboxFlags(0) | |
| 53 { | 57 { |
| 54 } | 58 } |
| 55 | 59 |
| 56 void RemoteBridgeFrameOwner::trace(Visitor* visitor) | 60 void RemoteBridgeFrameOwner::trace(Visitor* visitor) |
| 57 { | 61 { |
| 58 visitor->trace(m_frame); | 62 visitor->trace(m_frame); |
| 59 FrameOwner::trace(visitor); | 63 FrameOwner::trace(visitor); |
| 60 } | 64 } |
| 61 | 65 |
| 62 bool RemoteBridgeFrameOwner::isLocal() const | 66 bool RemoteBridgeFrameOwner::isLocal() const |
| 63 { | 67 { |
| 64 return false; | 68 return false; |
| 65 } | 69 } |
| 66 | 70 |
| 67 SandboxFlags RemoteBridgeFrameOwner::sandboxFlags() const | 71 SandboxFlags RemoteBridgeFrameOwner::sandboxFlags() const |
| 68 { | 72 { |
| 69 // FIXME: Implement. Most likely grab it from m_frame. | 73 return m_sandboxFlags; |
| 70 return 0; | 74 } |
| 75 | |
| 76 void RemoteBridgeFrameOwner::setSandboxFlags(SandboxFlags flags) | |
| 77 { | |
| 78 m_sandboxFlags = flags; | |
| 71 } | 79 } |
| 72 | 80 |
| 73 void RemoteBridgeFrameOwner::dispatchLoad() | 81 void RemoteBridgeFrameOwner::dispatchLoad() |
| 74 { | 82 { |
| 75 // FIXME: Implement. Most likely goes through m_frame->client(). | 83 // FIXME: Implement. Most likely goes through m_frame->client(). |
| 76 } | 84 } |
| 77 | 85 |
| 78 } // namespace | 86 } // namespace |
| 79 | 87 |
| 80 bool PlaceholderFrameOwner::isLocal() const | 88 bool PlaceholderFrameOwner::isLocal() const |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 782 ASSERT_NOT_REACHED(); | 790 ASSERT_NOT_REACHED(); |
| 783 return false; | 791 return false; |
| 784 } | 792 } |
| 785 | 793 |
| 786 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const | 794 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const |
| 787 { | 795 { |
| 788 ASSERT_NOT_REACHED(); | 796 ASSERT_NOT_REACHED(); |
| 789 return WebString(); | 797 return WebString(); |
| 790 } | 798 } |
| 791 | 799 |
| 800 // FIXME(alexmos): This will go away once the Chromium side is updated to pass s andbox flags. | |
| 792 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr ameClient* client) | 801 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr ameClient* client) |
| 793 { | 802 { |
| 803 return createLocalChild(name, WebSandboxNone, client); | |
| 804 } | |
| 805 | |
| 806 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebSa ndboxFlags sandboxFlags, WebFrameClient* client) | |
| 807 { | |
| 794 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client) ); | 808 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client) ); |
| 795 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner> >::AddResult res ult = | 809 OwnPtr<RemoteBridgeFrameOwner> owner = RemoteBridgeFrameOwner::create(child) ; |
|
dcheng
2015/01/08 22:50:45
OwnPtrWillBeRawPtr
alexmos
2015/01/09 19:49:56
Done.
| |
| 796 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child)); | 810 owner->setSandboxFlags(static_cast<SandboxFlags>(sandboxFlags)); |
| 811 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner> >::AddResult res ult = m_ownersForChildren.add(child, owner.release()); | |
| 797 appendChild(child); | 812 appendChild(child); |
| 798 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may | 813 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may |
| 799 // result in the browser observing two navigations to about:blank (one from the initial | 814 // result in the browser observing two navigations to about:blank (one from the initial |
| 800 // frame creation, and one from swapping it into the remote process). FrameL oader might | 815 // frame creation, and one from swapping it into the remote process). FrameL oader might |
| 801 // need a special initialization function for this case to avoid that duplic ate navigation. | 816 // need a special initialization function for this case to avoid that duplic ate navigation. |
| 802 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(), name, nullAtom); | 817 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(), name, nullAtom); |
| 803 // Partially related with the above FIXME--the init() call may trigger JS di spatch. However, | 818 // Partially related with the above FIXME--the init() call may trigger JS di spatch. However, |
| 804 // if the parent is remote, it should never be detached synchronously... | 819 // if the parent is remote, it should never be detached synchronously... |
| 805 ASSERT(child->frame()); | 820 ASSERT(child->frame()); |
| 806 return child; | 821 return child; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 842 localFrameImpl->frame()->view()->frameRect(), | 857 localFrameImpl->frame()->view()->frameRect(), |
| 843 localFrameImpl->frame()->view()->visibleContentScaleFactor()); | 858 localFrameImpl->frame()->view()->visibleContentScaleFactor()); |
| 844 } | 859 } |
| 845 | 860 |
| 846 void WebRemoteFrameImpl::setReplicatedOrigin(const WebSecurityOrigin& origin) co nst | 861 void WebRemoteFrameImpl::setReplicatedOrigin(const WebSecurityOrigin& origin) co nst |
| 847 { | 862 { |
| 848 ASSERT(frame()); | 863 ASSERT(frame()); |
| 849 frame()->securityContext()->setReplicatedOrigin(origin); | 864 frame()->securityContext()->setReplicatedOrigin(origin); |
| 850 } | 865 } |
| 851 | 866 |
| 867 void WebRemoteFrameImpl::setReplicatedSandboxFlags(WebSandboxFlags flags) const | |
| 868 { | |
| 869 ASSERT(frame()); | |
| 870 frame()->securityContext()->enforceSandboxFlags(static_cast<SandboxFlags>(fl ags)); | |
| 871 } | |
| 872 | |
| 852 void WebRemoteFrameImpl::didStartLoading() | 873 void WebRemoteFrameImpl::didStartLoading() |
| 853 { | 874 { |
| 854 frame()->setIsLoading(true); | 875 frame()->setIsLoading(true); |
| 855 } | 876 } |
| 856 | 877 |
| 857 void WebRemoteFrameImpl::didStopLoading() | 878 void WebRemoteFrameImpl::didStopLoading() |
| 858 { | 879 { |
| 859 frame()->setIsLoading(false); | 880 frame()->setIsLoading(false); |
| 860 if (parent() && parent()->isWebLocalFrame()) { | 881 if (parent() && parent()->isWebLocalFrame()) { |
| 861 WebLocalFrameImpl* parentFrame = | 882 WebLocalFrameImpl* parentFrame = |
| 862 toWebLocalFrameImpl(parent()->toWebLocalFrame()); | 883 toWebLocalFrameImpl(parent()->toWebLocalFrame()); |
| 863 parentFrame->frame()->loader().checkCompleted(); | 884 parentFrame->frame()->loader().checkCompleted(); |
| 864 } | 885 } |
| 865 } | 886 } |
| 866 | 887 |
| 867 } // namespace blink | 888 } // namespace blink |
| OLD | NEW |