| 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" |
| 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/WebPerformance.h" | 16 #include "public/web/WebPerformance.h" |
| 17 #include "public/web/WebRange.h" | 17 #include "public/web/WebRange.h" |
| 18 #include "web/WebLocalFrameImpl.h" | 18 #include "web/RemoteBridgeFrameOwner.h" |
| 19 #include "web/WebViewImpl.h" | 19 #include "web/WebViewImpl.h" |
| 20 #include <v8/include/v8.h> | 20 #include <v8/include/v8.h> |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 23 | 23 |
| 24 namespace { | |
| 25 | |
| 26 // Helper class to bridge communication for a local frame with a remote parent. | |
| 27 // Currently, it serves two purposes: | |
| 28 // 1. Allows the local frame's loader to retrieve sandbox flags associated with | |
| 29 // its owner element in another process. | |
| 30 // 2. Trigger a load event on its owner element once it finishes a load. | |
| 31 class RemoteBridgeFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<Remo
teBridgeFrameOwner>, public FrameOwner { | |
| 32 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner); | |
| 33 public: | |
| 34 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillB
eRawPtr<WebLocalFrameImpl> frame, SandboxFlags flags) | |
| 35 { | |
| 36 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame, flags)); | |
| 37 } | |
| 38 | |
| 39 virtual bool isLocal() const override | |
| 40 { | |
| 41 return false; | |
| 42 } | |
| 43 | |
| 44 virtual SandboxFlags sandboxFlags() const override | |
| 45 { | |
| 46 return m_sandboxFlags; | |
| 47 } | |
| 48 | |
| 49 void setSandboxFlags(SandboxFlags flags) | |
| 50 { | |
| 51 m_sandboxFlags = flags; | |
| 52 } | |
| 53 | |
| 54 virtual void dispatchLoad() override; | |
| 55 | |
| 56 virtual void trace(Visitor*); | |
| 57 | |
| 58 private: | |
| 59 explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>, S
andboxFlags); | |
| 60 | |
| 61 RefPtrWillBeMember<WebLocalFrameImpl> m_frame; | |
| 62 SandboxFlags m_sandboxFlags; | |
| 63 }; | |
| 64 | |
| 65 RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFr
ameImpl> frame, SandboxFlags flags) | |
| 66 : m_frame(frame) | |
| 67 , m_sandboxFlags(flags) | |
| 68 { | |
| 69 } | |
| 70 | |
| 71 void RemoteBridgeFrameOwner::trace(Visitor* visitor) | |
| 72 { | |
| 73 visitor->trace(m_frame); | |
| 74 FrameOwner::trace(visitor); | |
| 75 } | |
| 76 | |
| 77 void RemoteBridgeFrameOwner::dispatchLoad() | |
| 78 { | |
| 79 // FIXME: Implement. Most likely goes through m_frame->client(). | |
| 80 } | |
| 81 | |
| 82 } // namespace | |
| 83 | |
| 84 bool PlaceholderFrameOwner::isLocal() const | |
| 85 { | |
| 86 return false; | |
| 87 } | |
| 88 | |
| 89 SandboxFlags PlaceholderFrameOwner::sandboxFlags() const | |
| 90 { | |
| 91 return 0; | |
| 92 } | |
| 93 | |
| 94 void PlaceholderFrameOwner::dispatchLoad() | |
| 95 { | |
| 96 } | |
| 97 | |
| 98 void PlaceholderFrameOwner::trace(Visitor* visitor) | |
| 99 { | |
| 100 FrameOwner::trace(visitor); | |
| 101 } | |
| 102 | |
| 103 WebRemoteFrame* WebRemoteFrame::create(WebRemoteFrameClient* client) | 24 WebRemoteFrame* WebRemoteFrame::create(WebRemoteFrameClient* client) |
| 104 { | 25 { |
| 105 WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(client); | 26 WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(client); |
| 106 #if ENABLE(OILPAN) | 27 #if ENABLE(OILPAN) |
| 107 return frame; | 28 return frame; |
| 108 #else | 29 #else |
| 109 return adoptRef(frame).leakRef(); | 30 return adoptRef(frame).leakRef(); |
| 110 #endif | 31 #endif |
| 111 } | 32 } |
| 112 | 33 |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 ASSERT(child->frame()); | 735 ASSERT(child->frame()); |
| 815 return child; | 736 return child; |
| 816 } | 737 } |
| 817 | 738 |
| 818 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name) | 739 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name) |
| 819 { | 740 { |
| 820 setCoreFrame(RemoteFrame::create(&m_frameClient, host, owner)); | 741 setCoreFrame(RemoteFrame::create(&m_frameClient, host, owner)); |
| 821 m_frame->tree().setName(name, nullAtom); | 742 m_frame->tree().setName(name, nullAtom); |
| 822 } | 743 } |
| 823 | 744 |
| 745 // FIXME(alexmos): remove once Chrome side is updated to use sandbox flags. |
| 824 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web
RemoteFrameClient* client) | 746 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web
RemoteFrameClient* client) |
| 825 { | 747 { |
| 748 return createRemoteChild(name, WebSandboxFlags::None, client); |
| 749 } |
| 750 |
| 751 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web
SandboxFlags sandboxFlags, WebRemoteFrameClient* client) |
| 752 { |
| 826 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie
nt)); | 753 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie
nt)); |
| 827 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | 754 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = |
| 828 m_ownersForChildren.add(child, adoptPtrWillBeNoop(new PlaceholderFrameOw
ner)); | 755 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(nullptr, s
tatic_cast<SandboxFlags>(sandboxFlags))); |
| 829 appendChild(child); | 756 appendChild(child); |
| 830 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name); | 757 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name); |
| 831 return child; | 758 return child; |
| 832 } | 759 } |
| 833 | 760 |
| 834 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) | 761 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) |
| 835 { | 762 { |
| 836 m_frame = frame; | 763 m_frame = frame; |
| 837 } | 764 } |
| 838 | 765 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 { | 806 { |
| 880 frame()->setIsLoading(false); | 807 frame()->setIsLoading(false); |
| 881 if (parent() && parent()->isWebLocalFrame()) { | 808 if (parent() && parent()->isWebLocalFrame()) { |
| 882 WebLocalFrameImpl* parentFrame = | 809 WebLocalFrameImpl* parentFrame = |
| 883 toWebLocalFrameImpl(parent()->toWebLocalFrame()); | 810 toWebLocalFrameImpl(parent()->toWebLocalFrame()); |
| 884 parentFrame->frame()->loader().checkCompleted(); | 811 parentFrame->frame()->loader().checkCompleted(); |
| 885 } | 812 } |
| 886 } | 813 } |
| 887 | 814 |
| 888 } // namespace blink | 815 } // namespace blink |
| OLD | NEW |