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/RemoteFrame.h" | 8 #include "core/frame/RemoteFrame.h" |
9 #include "public/platform/WebFloatRect.h" | 9 #include "public/platform/WebFloatRect.h" |
10 #include "public/platform/WebRect.h" | 10 #include "public/platform/WebRect.h" |
11 #include "public/web/WebDocument.h" | 11 #include "public/web/WebDocument.h" |
12 #include "public/web/WebPerformance.h" | 12 #include "public/web/WebPerformance.h" |
13 #include "public/web/WebRange.h" | 13 #include "public/web/WebRange.h" |
14 #include "web/WebLocalFrameImpl.h" | |
15 #include "web/WebViewImpl.h" | |
14 #include <v8/include/v8.h> | 16 #include <v8/include/v8.h> |
15 | 17 |
18 using namespace WebCore; | |
19 | |
16 namespace blink { | 20 namespace blink { |
17 | 21 |
22 namespace { | |
23 | |
24 class RemoteBridgeFrameOwner : public FrameOwner { | |
25 public: | |
26 explicit RemoteBridgeFrameOwner(PassRefPtr<WebLocalFrameImpl>); | |
27 | |
28 virtual bool isLocal() const OVERRIDE; | |
29 virtual void setContentFrame(Frame&) OVERRIDE; | |
30 virtual void clearContentFrame() OVERRIDE; | |
31 virtual SandboxFlags sandboxFlags() const OVERRIDE; | |
32 virtual void dispatchLoad() OVERRIDE; | |
33 | |
34 private: | |
35 RefPtr<WebLocalFrameImpl> m_frame; | |
36 }; | |
37 | |
38 RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtr<WebLocalFrameImpl> fra me) | |
39 : m_frame(frame) | |
40 { | |
41 } | |
42 | |
43 bool RemoteBridgeFrameOwner::isLocal() const | |
44 { | |
45 return false; | |
46 } | |
47 | |
48 void RemoteBridgeFrameOwner::setContentFrame(Frame&) | |
49 { | |
50 } | |
51 | |
52 void RemoteBridgeFrameOwner::clearContentFrame() | |
53 { | |
54 delete this; | |
abarth-chromium
2014/06/13 18:06:46
delete this -> :(
Is there really no object that
| |
55 } | |
56 | |
57 SandboxFlags RemoteBridgeFrameOwner::sandboxFlags() const | |
58 { | |
59 // FIXME: Implement. Most likely grab it from m_frame. | |
60 return 0; | |
61 } | |
62 | |
63 void RemoteBridgeFrameOwner::dispatchLoad() | |
64 { | |
65 // FIXME: Implement. Most likely goes through m_frame->client(). | |
66 } | |
67 | |
68 class PlaceholderFrameOwner : public FrameOwner { | |
69 public: | |
70 virtual bool isLocal() const OVERRIDE; | |
71 virtual void setContentFrame(Frame&) OVERRIDE; | |
72 virtual void clearContentFrame() OVERRIDE; | |
73 virtual SandboxFlags sandboxFlags() const OVERRIDE; | |
74 virtual void dispatchLoad() OVERRIDE; | |
75 }; | |
76 | |
77 bool PlaceholderFrameOwner::isLocal() const | |
78 { | |
79 return false; | |
80 } | |
81 | |
82 void PlaceholderFrameOwner::setContentFrame(Frame&) | |
83 { | |
84 } | |
85 | |
86 void PlaceholderFrameOwner::clearContentFrame() | |
87 { | |
88 delete this; | |
abarth-chromium
2014/06/13 18:06:46
ditto
| |
89 } | |
90 | |
91 SandboxFlags PlaceholderFrameOwner::sandboxFlags() const | |
92 { | |
93 ASSERT_NOT_REACHED(); | |
94 return 0; | |
95 } | |
96 | |
97 void PlaceholderFrameOwner::dispatchLoad() | |
98 { | |
99 ASSERT_NOT_REACHED(); | |
100 } | |
101 | |
102 } // namespace | |
103 | |
18 WebRemoteFrame* WebRemoteFrame::create(WebFrameClient*) | 104 WebRemoteFrame* WebRemoteFrame::create(WebFrameClient*) |
19 { | 105 { |
20 return adoptRef(new WebRemoteFrameImpl()).leakRef(); | 106 return adoptRef(new WebRemoteFrameImpl()).leakRef(); |
21 } | 107 } |
22 | 108 |
23 WebRemoteFrameImpl::WebRemoteFrameImpl() | 109 WebRemoteFrameImpl::WebRemoteFrameImpl() |
24 : m_frameClient(this) | 110 : m_frameClient(this) |
25 { | 111 { |
26 } | 112 } |
27 | 113 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 ASSERT_NOT_REACHED(); | 241 ASSERT_NOT_REACHED(); |
156 return false; | 242 return false; |
157 } | 243 } |
158 | 244 |
159 WebView* WebRemoteFrameImpl::view() const | 245 WebView* WebRemoteFrameImpl::view() const |
160 { | 246 { |
161 ASSERT_NOT_REACHED(); | 247 ASSERT_NOT_REACHED(); |
162 return 0; | 248 return 0; |
163 } | 249 } |
164 | 250 |
251 void WebRemoteFrameImpl::initializeAsMainFrame(WebView* view) | |
252 { | |
253 Page* page = toWebViewImpl(view)->page(); | |
254 setWebCoreFrame(RemoteFrame::create(&m_frameClient, &page->frameHost(), 0)); | |
255 } | |
256 | |
165 WebFrame* WebRemoteFrameImpl::traversePrevious(bool wrap) const | 257 WebFrame* WebRemoteFrameImpl::traversePrevious(bool wrap) const |
166 { | 258 { |
167 ASSERT_NOT_REACHED(); | 259 ASSERT_NOT_REACHED(); |
168 return 0; | 260 return 0; |
169 } | 261 } |
170 | 262 |
171 WebFrame* WebRemoteFrameImpl::traverseNext(bool wrap) const | 263 WebFrame* WebRemoteFrameImpl::traverseNext(bool wrap) const |
172 { | 264 { |
173 ASSERT_NOT_REACHED(); | 265 ASSERT_NOT_REACHED(); |
174 return 0; | 266 return 0; |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
715 ASSERT_NOT_REACHED(); | 807 ASSERT_NOT_REACHED(); |
716 return false; | 808 return false; |
717 } | 809 } |
718 | 810 |
719 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const | 811 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const |
720 { | 812 { |
721 ASSERT_NOT_REACHED(); | 813 ASSERT_NOT_REACHED(); |
722 return WebString(); | 814 return WebString(); |
723 } | 815 } |
724 | 816 |
817 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr ameClient* client) | |
818 { | |
819 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client) ); | |
820 appendChild(child); | |
821 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may | |
822 // result in the browser observing two navigations to about:blank (one from the initial | |
823 // frame creation, and one from swapping it into the remote process). FrameL oader might | |
824 // need a special initialization function for this case to avoid that duplic ate navigation. | |
825 child->initializeAsChildFrame(frame()->host(), new RemoteBridgeFrameOwner(ch ild), name, AtomicString()); | |
abarth-chromium
2014/06/13 18:06:46
adoptPtr(new RemoteBridgeFrameOwner(... ?
| |
826 // Partially related with the above FIXME--the init() call may trigger JS di spatch. However, | |
827 // if the parent is remote, it should never be detached synchronously... | |
828 ASSERT(child->frame()); | |
829 return child; | |
830 } | |
831 | |
832 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web FrameClient* client) | |
833 { | |
834 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie nt)); | |
835 appendChild(child); | |
836 RefPtr<RemoteFrame> childFrame = RemoteFrame::create(&child->m_frameClient, frame()->host(), new PlaceholderFrameOwner); | |
837 child->setWebCoreFrame(childFrame); | |
838 childFrame->tree().setName(name, AtomicString()); | |
839 return child; | |
840 } | |
841 | |
842 void WebRemoteFrameImpl::setWebCoreFrame(PassRefPtr<RemoteFrame> frame) | |
843 { | |
844 m_frame = frame; | |
845 } | |
846 | |
725 } // namespace blink | 847 } // namespace blink |
726 | 848 |
OLD | NEW |