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/FrameOwner.h" | 8 #include "core/frame/FrameOwner.h" |
9 #include "core/frame/RemoteFrame.h" | 9 #include "core/frame/RemoteFrame.h" |
| 10 #include "core/html/HTMLFrameOwnerElement.h" |
10 #include "core/page/Page.h" | 11 #include "core/page/Page.h" |
| 12 #include "core/rendering/RenderLayer.h" |
11 #include "public/platform/WebFloatRect.h" | 13 #include "public/platform/WebFloatRect.h" |
| 14 #include "public/platform/WebLayer.h" |
12 #include "public/platform/WebRect.h" | 15 #include "public/platform/WebRect.h" |
13 #include "public/web/WebDocument.h" | 16 #include "public/web/WebDocument.h" |
14 #include "public/web/WebPerformance.h" | 17 #include "public/web/WebPerformance.h" |
15 #include "public/web/WebRange.h" | 18 #include "public/web/WebRange.h" |
16 #include "web/WebLocalFrameImpl.h" | 19 #include "web/WebLocalFrameImpl.h" |
17 #include "web/WebViewImpl.h" | 20 #include "web/WebViewImpl.h" |
18 #include <v8/include/v8.h> | 21 #include <v8/include/v8.h> |
19 | 22 |
20 using namespace WebCore; | 23 using namespace WebCore; |
21 | 24 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 154 } |
152 | 155 |
153 WebVector<WebIconURL> WebRemoteFrameImpl::iconURLs(int iconTypesMask) const | 156 WebVector<WebIconURL> WebRemoteFrameImpl::iconURLs(int iconTypesMask) const |
154 { | 157 { |
155 ASSERT_NOT_REACHED(); | 158 ASSERT_NOT_REACHED(); |
156 return WebVector<WebIconURL>(); | 159 return WebVector<WebIconURL>(); |
157 } | 160 } |
158 | 161 |
159 void WebRemoteFrameImpl::setIsRemote(bool) | 162 void WebRemoteFrameImpl::setIsRemote(bool) |
160 { | 163 { |
| 164 |
161 ASSERT_NOT_REACHED(); | 165 ASSERT_NOT_REACHED(); |
162 } | 166 } |
163 | 167 |
164 void WebRemoteFrameImpl::setRemoteWebLayer(WebLayer*) | 168 void WebRemoteFrameImpl::setRemoteWebLayer(WebLayer* webLayer) |
165 { | 169 { |
166 ASSERT_NOT_REACHED(); | 170 if (!frame()) |
| 171 return; |
| 172 |
| 173 if (frame()->remotePlatformLayer()) |
| 174 GraphicsLayer::unregisterContentsLayer(frame()->remotePlatformLayer()); |
| 175 if (webLayer) |
| 176 GraphicsLayer::registerContentsLayer(webLayer); |
| 177 frame()->setRemotePlatformLayer(webLayer); |
| 178 |
| 179 // FIXME: This should be moved to WebRemoteFrame. |
| 180 frame()->deprecatedLocalOwner()->setNeedsCompositingUpdate(); |
| 181 if (RenderPart* renderer = frame()->ownerRenderer()) |
| 182 renderer->layer()->updateSelfPaintingLayer(); |
167 } | 183 } |
168 | 184 |
169 void WebRemoteFrameImpl::setPermissionClient(WebPermissionClient*) | 185 void WebRemoteFrameImpl::setPermissionClient(WebPermissionClient*) |
170 { | 186 { |
171 ASSERT_NOT_REACHED(); | 187 ASSERT_NOT_REACHED(); |
172 } | 188 } |
173 | 189 |
174 void WebRemoteFrameImpl::setSharedWorkerRepositoryClient(WebSharedWorkerReposito
ryClient*) | 190 void WebRemoteFrameImpl::setSharedWorkerRepositoryClient(WebSharedWorkerReposito
ryClient*) |
175 { | 191 { |
176 ASSERT_NOT_REACHED(); | 192 ASSERT_NOT_REACHED(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 257 } |
242 | 258 |
243 void WebRemoteFrameImpl::removeChild(WebFrame* frame) | 259 void WebRemoteFrameImpl::removeChild(WebFrame* frame) |
244 { | 260 { |
245 WebFrame::removeChild(frame); | 261 WebFrame::removeChild(frame); |
246 m_ownersForChildren.remove(frame); | 262 m_ownersForChildren.remove(frame); |
247 } | 263 } |
248 | 264 |
249 WebDocument WebRemoteFrameImpl::document() const | 265 WebDocument WebRemoteFrameImpl::document() const |
250 { | 266 { |
251 ASSERT_NOT_REACHED(); | 267 //ASSERT_NOT_REACHED(); |
252 return WebDocument(); | 268 return WebDocument(); |
253 } | 269 } |
254 | 270 |
255 WebPerformance WebRemoteFrameImpl::performance() const | 271 WebPerformance WebRemoteFrameImpl::performance() const |
256 { | 272 { |
257 ASSERT_NOT_REACHED(); | 273 ASSERT_NOT_REACHED(); |
258 return WebPerformance(); | 274 return WebPerformance(); |
259 } | 275 } |
260 | 276 |
261 bool WebRemoteFrameImpl::dispatchBeforeUnloadEvent() | 277 bool WebRemoteFrameImpl::dispatchBeforeUnloadEvent() |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 } | 516 } |
501 | 517 |
502 bool WebRemoteFrameImpl::isCommandEnabled(const WebString&) const | 518 bool WebRemoteFrameImpl::isCommandEnabled(const WebString&) const |
503 { | 519 { |
504 ASSERT_NOT_REACHED(); | 520 ASSERT_NOT_REACHED(); |
505 return false; | 521 return false; |
506 } | 522 } |
507 | 523 |
508 void WebRemoteFrameImpl::enableContinuousSpellChecking(bool) | 524 void WebRemoteFrameImpl::enableContinuousSpellChecking(bool) |
509 { | 525 { |
510 ASSERT_NOT_REACHED(); | 526 //ASSERT_NOT_REACHED(); |
511 } | 527 } |
512 | 528 |
513 bool WebRemoteFrameImpl::isContinuousSpellCheckingEnabled() const | 529 bool WebRemoteFrameImpl::isContinuousSpellCheckingEnabled() const |
514 { | 530 { |
515 ASSERT_NOT_REACHED(); | 531 //ASSERT_NOT_REACHED(); |
516 return false; | 532 return false; |
517 } | 533 } |
518 | 534 |
519 void WebRemoteFrameImpl::requestTextChecking(const WebElement&) | 535 void WebRemoteFrameImpl::requestTextChecking(const WebElement&) |
520 { | 536 { |
521 ASSERT_NOT_REACHED(); | 537 ASSERT_NOT_REACHED(); |
522 } | 538 } |
523 | 539 |
524 void WebRemoteFrameImpl::replaceMisspelledRange(const WebString&) | 540 void WebRemoteFrameImpl::replaceMisspelledRange(const WebString&) |
525 { | 541 { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr
ameClient* client) | 802 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr
ameClient* client) |
787 { | 803 { |
788 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client)
); | 804 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client)
); |
789 HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result = | 805 HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result = |
790 m_ownersForChildren.add(child, adoptPtr(new RemoteBridgeFrameOwner(child
))); | 806 m_ownersForChildren.add(child, adoptPtr(new RemoteBridgeFrameOwner(child
))); |
791 appendChild(child); | 807 appendChild(child); |
792 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may | 808 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may |
793 // result in the browser observing two navigations to about:blank (one from
the initial | 809 // result in the browser observing two navigations to about:blank (one from
the initial |
794 // frame creation, and one from swapping it into the remote process). FrameL
oader might | 810 // frame creation, and one from swapping it into the remote process). FrameL
oader might |
795 // need a special initialization function for this case to avoid that duplic
ate navigation. | 811 // need a special initialization function for this case to avoid that duplic
ate navigation. |
796 child->initializeAsChildFrame(frame()->host(), result.storedValue->value.get
(), name, AtomicString()); | 812 child->initializeWebCoreFrame(frame()->host(), result.storedValue->value.get
(), name, nullAtom); |
797 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, | 813 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, |
798 // if the parent is remote, it should never be detached synchronously... | 814 // if the parent is remote, it should never be detached synchronously... |
799 ASSERT(child->frame()); | 815 ASSERT(child->frame()); |
800 return child; | 816 return child; |
801 } | 817 } |
802 | 818 |
803 void WebRemoteFrameImpl::initializeAsMainFrame(Page* page) | 819 void WebRemoteFrameImpl::initializeWebCoreFrame(FrameHost* host, FrameOwner* own
er, const AtomicString& name) |
804 { | 820 { |
805 setWebCoreFrame(RemoteFrame::create(&m_frameClient, &page->frameHost(), 0)); | 821 setWebCoreFrame(RemoteFrame::create(&m_frameClient, host, owner)); |
| 822 m_frame->tree().setName(name, nullAtom); |
806 } | 823 } |
807 | 824 |
808 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web
FrameClient* client) | 825 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web
FrameClient* client) |
809 { | 826 { |
810 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie
nt)); | 827 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie
nt)); |
811 HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result = | 828 HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result = |
812 m_ownersForChildren.add(child, adoptPtr(new PlaceholderFrameOwner)); | 829 m_ownersForChildren.add(child, adoptPtr(new PlaceholderFrameOwner)); |
813 appendChild(child); | 830 appendChild(child); |
814 RefPtr<RemoteFrame> childFrame = RemoteFrame::create(&child->m_frameClient,
frame()->host(), result.storedValue->value.get()); | 831 child->initializeWebCoreFrame(frame()->host(), result.storedValue->value.get
(), name); |
815 child->setWebCoreFrame(childFrame); | |
816 childFrame->tree().setName(name, AtomicString()); | |
817 return child; | 832 return child; |
818 } | 833 } |
819 | 834 |
820 void WebRemoteFrameImpl::setWebCoreFrame(PassRefPtr<RemoteFrame> frame) | 835 void WebRemoteFrameImpl::setWebCoreFrame(PassRefPtr<RemoteFrame> frame) |
821 { | 836 { |
822 m_frame = frame; | 837 m_frame = frame; |
823 } | 838 } |
824 | 839 |
825 WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame) | 840 WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame) |
826 { | 841 { |
827 if (!frame.client()) | 842 if (!frame.client()) |
828 return 0; | 843 return 0; |
829 return static_cast<RemoteFrameClient*>(frame.client())->webFrame(); | 844 return static_cast<RemoteFrameClient*>(frame.client())->webFrame(); |
830 } | 845 } |
831 | 846 |
832 } // namespace blink | 847 } // namespace blink |
833 | 848 |
OLD | NEW |