| 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 "core/frame/RemoteFrame.h" | 6 #include "core/frame/RemoteFrame.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/WindowProxyManager.h" | 8 #include "bindings/core/v8/WindowProxyManager.h" |
| 9 #include "core/dom/RemoteSecurityContext.h" | 9 #include "core/dom/RemoteSecurityContext.h" |
| 10 #include "core/frame/RemoteDOMWindow.h" | 10 #include "core/frame/RemoteDOMWindow.h" |
| 11 #include "core/frame/RemoteFrameClient.h" | 11 #include "core/frame/RemoteFrameClient.h" |
| 12 #include "core/frame/RemoteFrameView.h" | 12 #include "core/frame/RemoteFrameView.h" |
| 13 #include "core/html/HTMLFrameOwnerElement.h" | 13 #include "core/html/HTMLFrameOwnerElement.h" |
| 14 #include "core/layout/Layer.h" |
| 15 #include "core/rendering/RenderPart.h" |
| 16 #include "platform/graphics/GraphicsLayer.h" |
| 14 #include "platform/weborigin/SecurityPolicy.h" | 17 #include "platform/weborigin/SecurityPolicy.h" |
| 18 #include "public/platform/WebLayer.h" |
| 15 | 19 |
| 16 namespace blink { | 20 namespace blink { |
| 17 | 21 |
| 18 inline RemoteFrame::RemoteFrame(RemoteFrameClient* client, FrameHost* host, Fram
eOwner* owner) | 22 inline RemoteFrame::RemoteFrame(RemoteFrameClient* client, FrameHost* host, Fram
eOwner* owner) |
| 19 : Frame(client, host, owner) | 23 : Frame(client, host, owner) |
| 20 , m_securityContext(RemoteSecurityContext::create()) | 24 , m_securityContext(RemoteSecurityContext::create()) |
| 21 , m_domWindow(RemoteDOMWindow::create(*this)) | 25 , m_domWindow(RemoteDOMWindow::create(*this)) |
| 22 , m_windowProxyManager(WindowProxyManager::create(*this)) | 26 , m_windowProxyManager(WindowProxyManager::create(*this)) |
| 27 , m_remotePlatformLayer(nullptr) |
| 23 { | 28 { |
| 24 } | 29 } |
| 25 | 30 |
| 26 PassRefPtrWillBeRawPtr<RemoteFrame> RemoteFrame::create(RemoteFrameClient* clien
t, FrameHost* host, FrameOwner* owner) | 31 PassRefPtrWillBeRawPtr<RemoteFrame> RemoteFrame::create(RemoteFrameClient* clien
t, FrameHost* host, FrameOwner* owner) |
| 27 { | 32 { |
| 28 return adoptRefWillBeNoop(new RemoteFrame(client, host, owner)); | 33 return adoptRefWillBeNoop(new RemoteFrame(client, host, owner)); |
| 29 } | 34 } |
| 30 | 35 |
| 31 RemoteFrame::~RemoteFrame() | 36 RemoteFrame::~RemoteFrame() |
| 32 { | 37 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return; | 77 return; |
| 73 m_windowProxyManager->clearForClose(); | 78 m_windowProxyManager->clearForClose(); |
| 74 Frame::detach(); | 79 Frame::detach(); |
| 75 } | 80 } |
| 76 | 81 |
| 77 RemoteSecurityContext* RemoteFrame::securityContext() const | 82 RemoteSecurityContext* RemoteFrame::securityContext() const |
| 78 { | 83 { |
| 79 return m_securityContext.get(); | 84 return m_securityContext.get(); |
| 80 } | 85 } |
| 81 | 86 |
| 87 void RemoteFrame::disconnectOwnerElement() |
| 88 { |
| 89 // The RemotePlatformLayer needs to be cleared in disconnectOwnerElement() |
| 90 // because it must happen on WebFrame::swap() and Frame::detach(). |
| 91 if (m_remotePlatformLayer) |
| 92 setRemotePlatformLayer(nullptr); |
| 93 |
| 94 Frame::disconnectOwnerElement(); |
| 95 } |
| 96 |
| 82 void RemoteFrame::forwardInputEvent(Event* event) | 97 void RemoteFrame::forwardInputEvent(Event* event) |
| 83 { | 98 { |
| 84 remoteFrameClient()->forwardInputEvent(event); | 99 remoteFrameClient()->forwardInputEvent(event); |
| 85 } | 100 } |
| 86 | 101 |
| 87 void RemoteFrame::setView(PassRefPtrWillBeRawPtr<RemoteFrameView> view) | 102 void RemoteFrame::setView(PassRefPtrWillBeRawPtr<RemoteFrameView> view) |
| 88 { | 103 { |
| 89 // Oilpan: as RemoteFrameView performs no finalization actions, | 104 // Oilpan: as RemoteFrameView performs no finalization actions, |
| 90 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) | 105 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) |
| 91 m_view = view; | 106 m_view = view; |
| 92 } | 107 } |
| 93 | 108 |
| 94 void RemoteFrame::createView() | 109 void RemoteFrame::createView() |
| 95 { | 110 { |
| 96 RefPtrWillBeRawPtr<RemoteFrameView> view = RemoteFrameView::create(this); | 111 RefPtrWillBeRawPtr<RemoteFrameView> view = RemoteFrameView::create(this); |
| 97 setView(view); | 112 setView(view); |
| 98 | 113 |
| 99 if (ownerRenderer()) { | 114 if (ownerRenderer()) { |
| 100 HTMLFrameOwnerElement* owner = deprecatedLocalOwner(); | 115 HTMLFrameOwnerElement* owner = deprecatedLocalOwner(); |
| 101 ASSERT(owner); | 116 ASSERT(owner); |
| 102 owner->setWidget(view); | 117 owner->setWidget(view); |
| 103 } | 118 } |
| 104 } | 119 } |
| 105 | 120 |
| 106 RemoteFrameClient* RemoteFrame::remoteFrameClient() const | 121 RemoteFrameClient* RemoteFrame::remoteFrameClient() const |
| 107 { | 122 { |
| 108 return static_cast<RemoteFrameClient*>(client()); | 123 return static_cast<RemoteFrameClient*>(client()); |
| 109 } | 124 } |
| 110 | 125 |
| 126 void RemoteFrame::setRemotePlatformLayer(WebLayer* layer) |
| 127 { |
| 128 if (m_remotePlatformLayer) |
| 129 GraphicsLayer::unregisterContentsLayer(m_remotePlatformLayer); |
| 130 m_remotePlatformLayer = layer; |
| 131 if (m_remotePlatformLayer) |
| 132 GraphicsLayer::registerContentsLayer(layer); |
| 133 |
| 134 ASSERT(owner()); |
| 135 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); |
| 136 if (RenderPart* renderer = ownerRenderer()) |
| 137 renderer->layer()->updateSelfPaintingLayer(); |
| 138 } |
| 139 |
| 111 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |