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 #ifndef WebRemoteFrameImpl_h | 5 #ifndef WebRemoteFrameImpl_h |
6 #define WebRemoteFrameImpl_h | 6 #define WebRemoteFrameImpl_h |
7 | 7 |
8 #include "core/frame/FrameOwner.h" | 8 #include "core/frame/FrameOwner.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "public/web/WebRemoteFrame.h" | 10 #include "public/web/WebRemoteFrame.h" |
11 #include "public/web/WebRemoteFrameClient.h" | 11 #include "public/web/WebRemoteFrameClient.h" |
12 #include "web/RemoteFrameClientImpl.h" | 12 #include "web/RemoteFrameClientImpl.h" |
13 #include "web/WebLocalFrameImpl.h" | |
13 #include "wtf/HashMap.h" | 14 #include "wtf/HashMap.h" |
14 #include "wtf/OwnPtr.h" | 15 #include "wtf/OwnPtr.h" |
15 #include "wtf/RefCounted.h" | 16 #include "wtf/RefCounted.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 class FrameHost; | 20 class FrameHost; |
20 class FrameOwner; | 21 class FrameOwner; |
21 class RemoteFrame; | 22 class RemoteFrame; |
22 | 23 |
23 // FIXME: This is just a placeholder frame owner to supply to RemoteFrame when | 24 // Helper class to bridge communication for a frame with a remote parent. |
24 // the parent is also a remote frame. Strictly speaking, this shouldn't be | 25 // Currently, it serves two purposes: |
25 // necessary, since a remote frame shouldn't ever need to communicate with a | 26 // 1. Allows the local frame's loader to retrieve sandbox flags associated with |
26 // remote parent (there are no sandbox flags to retrieve in this case, nor can | 27 // its owner element in another process. |
27 // the RemoteFrame itself load a document). In most circumstances, the check for | 28 // 2. Trigger a load event on its owner element once it finishes a load. |
28 // frame->owner() can be replaced with a check for frame->tree().parent(). Once | 29 class RemoteBridgeFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<Remo teBridgeFrameOwner>, 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.
| |
29 // that's done, this class can be removed. | 30 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner); |
30 class PlaceholderFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<Place holderFrameOwner>, public FrameOwner { | 31 |
31 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PlaceholderFrameOwner); | |
32 public: | 32 public: |
33 virtual bool isLocal() const override; | 33 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillB eRawPtr<WebLocalFrameImpl> frame, SandboxFlags flags) |
34 virtual SandboxFlags sandboxFlags() const override; | 34 { |
35 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame, flags)); | |
36 } | |
37 | |
38 virtual bool isLocal() const override | |
39 { | |
40 return false; | |
41 } | |
42 | |
43 virtual SandboxFlags sandboxFlags() const override | |
44 { | |
45 return m_sandboxFlags; | |
46 } | |
47 | |
48 void setSandboxFlags(SandboxFlags flags) | |
49 { | |
50 m_sandboxFlags = flags; | |
51 } | |
52 | |
35 virtual void dispatchLoad() override; | 53 virtual void dispatchLoad() override; |
36 | 54 |
37 virtual void trace(Visitor*) override; | 55 virtual void trace(Visitor*) override; |
56 | |
57 private: | |
58 explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>, S andboxFlags); | |
dcheng
2015/02/11 21:57:24
No need for explicit.
alexmos
2015/02/11 22:39:45
Done.
| |
59 | |
60 RefPtrWillBeMember<WebLocalFrameImpl> m_frame; | |
61 SandboxFlags m_sandboxFlags; | |
38 }; | 62 }; |
39 | 63 |
40 class WebRemoteFrameImpl final : public RefCountedWillBeGarbageCollectedFinalize d<WebRemoteFrameImpl>, public WebRemoteFrame { | 64 class WebRemoteFrameImpl final : public RefCountedWillBeGarbageCollectedFinalize d<WebRemoteFrameImpl>, public WebRemoteFrame { |
41 public: | 65 public: |
42 explicit WebRemoteFrameImpl(WebRemoteFrameClient*); | 66 explicit WebRemoteFrameImpl(WebRemoteFrameClient*); |
43 virtual ~WebRemoteFrameImpl(); | 67 virtual ~WebRemoteFrameImpl(); |
44 | 68 |
45 // WebRemoteFrame methods. | 69 // WebRemoteFrame methods. |
46 virtual bool isWebLocalFrame() const override; | 70 virtual bool isWebLocalFrame() const override; |
47 virtual WebLocalFrame* toWebLocalFrame() override; | 71 virtual WebLocalFrame* toWebLocalFrame() override; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 virtual WebString contentAsText(size_t maxChars) const override; | 204 virtual WebString contentAsText(size_t maxChars) const override; |
181 virtual WebString contentAsMarkup() const override; | 205 virtual WebString contentAsMarkup() const override; |
182 virtual WebString layoutTreeAsText(LayoutAsTextControls toShow = LayoutAsTex tNormal) const override; | 206 virtual WebString layoutTreeAsText(LayoutAsTextControls toShow = LayoutAsTex tNormal) const override; |
183 virtual WebString markerTextForListItem(const WebElement&) const override; | 207 virtual WebString markerTextForListItem(const WebElement&) const override; |
184 virtual WebRect selectionBoundsRect() const override; | 208 virtual WebRect selectionBoundsRect() const override; |
185 | 209 |
186 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const override; | 210 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const override; |
187 virtual WebString layerTreeAsText(bool showDebugInfo = false) const override ; | 211 virtual WebString layerTreeAsText(bool showDebugInfo = false) const override ; |
188 | 212 |
189 virtual WebLocalFrame* createLocalChild(const WebString& name, WebSandboxFla gs, WebFrameClient*) override; | 213 virtual WebLocalFrame* createLocalChild(const WebString& name, WebSandboxFla gs, WebFrameClient*) override; |
214 // FIXME(alexmos): remove once Chrome side is updated to use sandbox flags. | |
190 virtual WebRemoteFrame* createRemoteChild(const WebString& name, WebRemoteFr ameClient*) override; | 215 virtual WebRemoteFrame* createRemoteChild(const WebString& name, WebRemoteFr ameClient*) override; |
216 virtual WebRemoteFrame* createRemoteChild(const WebString& name, WebSandboxF lags, WebRemoteFrameClient*) override; | |
191 | 217 |
192 void initializeCoreFrame(FrameHost*, FrameOwner*, const AtomicString& name); | 218 void initializeCoreFrame(FrameHost*, FrameOwner*, const AtomicString& name); |
193 | 219 |
194 void setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame>); | 220 void setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame>); |
195 RemoteFrame* frame() const { return m_frame.get(); } | 221 RemoteFrame* frame() const { return m_frame.get(); } |
196 | 222 |
197 WebRemoteFrameClient* client() const { return m_client; } | 223 WebRemoteFrameClient* client() const { return m_client; } |
198 | 224 |
199 static WebRemoteFrameImpl* fromFrame(RemoteFrame&); | 225 static WebRemoteFrameImpl* fromFrame(RemoteFrame&); |
200 | 226 |
(...skipping 27 matching lines...) Expand all Loading... | |
228 GC_PLUGIN_IGNORE("340522") | 254 GC_PLUGIN_IGNORE("340522") |
229 Persistent<WebRemoteFrameImpl> m_selfKeepAlive; | 255 Persistent<WebRemoteFrameImpl> m_selfKeepAlive; |
230 #endif | 256 #endif |
231 }; | 257 }; |
232 | 258 |
233 DEFINE_TYPE_CASTS(WebRemoteFrameImpl, WebFrame, frame, frame->isWebRemoteFrame() , frame.isWebRemoteFrame()); | 259 DEFINE_TYPE_CASTS(WebRemoteFrameImpl, WebFrame, frame, frame->isWebRemoteFrame() , frame.isWebRemoteFrame()); |
234 | 260 |
235 } // namespace blink | 261 } // namespace blink |
236 | 262 |
237 #endif // WebRemoteFrameImpl_h | 263 #endif // WebRemoteFrameImpl_h |
OLD | NEW |