Chromium Code Reviews| Index: Source/web/WebRemoteFrameImpl.h |
| diff --git a/Source/web/WebRemoteFrameImpl.h b/Source/web/WebRemoteFrameImpl.h |
| index 24127ee4963f3c910d5205b7cbc553d7c2069476..359b2ebccf4ec41880847359a3a82cd2f6c6dc42 100644 |
| --- a/Source/web/WebRemoteFrameImpl.h |
| +++ b/Source/web/WebRemoteFrameImpl.h |
| @@ -10,6 +10,7 @@ |
| #include "public/web/WebRemoteFrame.h" |
| #include "public/web/WebRemoteFrameClient.h" |
| #include "web/RemoteFrameClientImpl.h" |
| +#include "web/WebLocalFrameImpl.h" |
| #include "wtf/HashMap.h" |
| #include "wtf/OwnPtr.h" |
| #include "wtf/RefCounted.h" |
| @@ -20,21 +21,44 @@ class FrameHost; |
| class FrameOwner; |
| class RemoteFrame; |
| -// FIXME: This is just a placeholder frame owner to supply to RemoteFrame when |
| -// the parent is also a remote frame. Strictly speaking, this shouldn't be |
| -// necessary, since a remote frame shouldn't ever need to communicate with a |
| -// remote parent (there are no sandbox flags to retrieve in this case, nor can |
| -// the RemoteFrame itself load a document). In most circumstances, the check for |
| -// frame->owner() can be replaced with a check for frame->tree().parent(). Once |
| -// that's done, this class can be removed. |
| -class PlaceholderFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<PlaceholderFrameOwner>, public FrameOwner { |
| - WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PlaceholderFrameOwner); |
| +// Helper class to bridge communication for a frame with a remote parent. |
| +// Currently, it serves two purposes: |
| +// 1. Allows the local frame's loader to retrieve sandbox flags associated with |
| +// its owner element in another process. |
| +// 2. Trigger a load event on its owner element once it finishes a load. |
| +class RemoteBridgeFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<RemoteBridgeFrameOwner>, public FrameOwner { |
|
dcheng
2015/02/11 21:57:24
Perhaps we should move this to a new file? It seem
alexmos
2015/02/11 22:39:45
Done.
|
| + WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner); |
| + |
| public: |
| - virtual bool isLocal() const override; |
| - virtual SandboxFlags sandboxFlags() const override; |
| + static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame, SandboxFlags flags) |
| + { |
| + return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame, flags)); |
| + } |
| + |
| + virtual bool isLocal() const override |
| + { |
| + return false; |
| + } |
| + |
| + virtual SandboxFlags sandboxFlags() const override |
| + { |
| + return m_sandboxFlags; |
| + } |
| + |
| + void setSandboxFlags(SandboxFlags flags) |
| + { |
| + m_sandboxFlags = flags; |
| + } |
| + |
| virtual void dispatchLoad() override; |
| virtual void trace(Visitor*) override; |
| + |
| +private: |
| + explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>, SandboxFlags); |
|
dcheng
2015/02/11 21:57:24
No need for explicit.
alexmos
2015/02/11 22:39:45
Done.
|
| + |
| + RefPtrWillBeMember<WebLocalFrameImpl> m_frame; |
| + SandboxFlags m_sandboxFlags; |
| }; |
| class WebRemoteFrameImpl final : public RefCountedWillBeGarbageCollectedFinalized<WebRemoteFrameImpl>, public WebRemoteFrame { |
| @@ -187,7 +211,9 @@ public: |
| virtual WebString layerTreeAsText(bool showDebugInfo = false) const override; |
| virtual WebLocalFrame* createLocalChild(const WebString& name, WebSandboxFlags, WebFrameClient*) override; |
| + // FIXME(alexmos): remove once Chrome side is updated to use sandbox flags. |
| virtual WebRemoteFrame* createRemoteChild(const WebString& name, WebRemoteFrameClient*) override; |
| + virtual WebRemoteFrame* createRemoteChild(const WebString& name, WebSandboxFlags, WebRemoteFrameClient*) override; |
| void initializeCoreFrame(FrameHost*, FrameOwner*, const AtomicString& name); |