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; | |
dcheng
2015/01/09 22:46:12
Since this can't change after creation, let's mark
alexmos
2015/01/09 23:12:30
As we just discussed, the flags are mutable, with
| |
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; | |
dcheng
2015/01/10 00:01:00
Nit: just inline this into the declaration.
alexmos
2015/01/10 00:51:54
Done. Inlined setSandboxFlags(), sandboxFlags(),
| |
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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
787 ASSERT_NOT_REACHED(); | 795 ASSERT_NOT_REACHED(); |
788 return false; | 796 return false; |
789 } | 797 } |
790 | 798 |
791 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const | 799 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const |
792 { | 800 { |
793 ASSERT_NOT_REACHED(); | 801 ASSERT_NOT_REACHED(); |
794 return WebString(); | 802 return WebString(); |
795 } | 803 } |
796 | 804 |
805 // FIXME(alexmos): This will go away once the Chromium side is updated to pass s andbox flags. | |
797 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr ameClient* client) | 806 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr ameClient* client) |
798 { | 807 { |
808 return createLocalChild(name, WebSandboxFlags::None, client); | |
809 } | |
810 | |
811 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebSa ndboxFlags sandboxFlags, WebFrameClient* client) | |
812 { | |
799 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client) ); | 813 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client) ); |
800 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu lt = | 814 OwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> owner = RemoteBridgeFrameOwner::c reate(child); |
dcheng
2015/01/10 00:01:00
Nit: it's probably still nicer to pass this in the
alexmos
2015/01/10 00:51:54
Done.
| |
801 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child)); | 815 owner->setSandboxFlags(static_cast<SandboxFlags>(sandboxFlags)); |
816 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu lt = m_ownersForChildren.add(child, owner.release()); | |
802 appendChild(child); | 817 appendChild(child); |
803 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may | 818 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may |
804 // result in the browser observing two navigations to about:blank (one from the initial | 819 // result in the browser observing two navigations to about:blank (one from the initial |
805 // frame creation, and one from swapping it into the remote process). FrameL oader might | 820 // frame creation, and one from swapping it into the remote process). FrameL oader might |
806 // need a special initialization function for this case to avoid that duplic ate navigation. | 821 // need a special initialization function for this case to avoid that duplic ate navigation. |
807 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(), name, nullAtom); | 822 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(), name, nullAtom); |
808 // Partially related with the above FIXME--the init() call may trigger JS di spatch. However, | 823 // Partially related with the above FIXME--the init() call may trigger JS di spatch. However, |
809 // if the parent is remote, it should never be detached synchronously... | 824 // if the parent is remote, it should never be detached synchronously... |
810 ASSERT(child->frame()); | 825 ASSERT(child->frame()); |
811 return child; | 826 return child; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
847 localFrameImpl->frame()->view()->frameRect(), | 862 localFrameImpl->frame()->view()->frameRect(), |
848 localFrameImpl->frame()->view()->visibleContentScaleFactor()); | 863 localFrameImpl->frame()->view()->visibleContentScaleFactor()); |
849 } | 864 } |
850 | 865 |
851 void WebRemoteFrameImpl::setReplicatedOrigin(const WebSecurityOrigin& origin) co nst | 866 void WebRemoteFrameImpl::setReplicatedOrigin(const WebSecurityOrigin& origin) co nst |
852 { | 867 { |
853 ASSERT(frame()); | 868 ASSERT(frame()); |
854 frame()->securityContext()->setReplicatedOrigin(origin); | 869 frame()->securityContext()->setReplicatedOrigin(origin); |
855 } | 870 } |
856 | 871 |
872 void WebRemoteFrameImpl::setReplicatedSandboxFlags(WebSandboxFlags flags) const | |
873 { | |
874 ASSERT(frame()); | |
875 frame()->securityContext()->enforceSandboxFlags(static_cast<SandboxFlags>(fl ags)); | |
876 } | |
877 | |
857 void WebRemoteFrameImpl::didStartLoading() | 878 void WebRemoteFrameImpl::didStartLoading() |
858 { | 879 { |
859 frame()->setIsLoading(true); | 880 frame()->setIsLoading(true); |
860 } | 881 } |
861 | 882 |
862 void WebRemoteFrameImpl::didStopLoading() | 883 void WebRemoteFrameImpl::didStopLoading() |
863 { | 884 { |
864 frame()->setIsLoading(false); | 885 frame()->setIsLoading(false); |
865 if (parent() && parent()->isWebLocalFrame()) { | 886 if (parent() && parent()->isWebLocalFrame()) { |
866 WebLocalFrameImpl* parentFrame = | 887 WebLocalFrameImpl* parentFrame = |
867 toWebLocalFrameImpl(parent()->toWebLocalFrame()); | 888 toWebLocalFrameImpl(parent()->toWebLocalFrame()); |
868 parentFrame->frame()->loader().checkCompleted(); | 889 parentFrame->frame()->loader().checkCompleted(); |
869 } | 890 } |
870 } | 891 } |
871 | 892 |
872 } // namespace blink | 893 } // namespace blink |
OLD | NEW |