| 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 "core/frame/RemoteFrame.h" | 5 #include "core/frame/RemoteFrame.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/WindowProxy.h" | 7 #include "bindings/core/v8/WindowProxy.h" |
| 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/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 dom_window_ = RemoteDOMWindow::Create(*this); | 33 dom_window_ = RemoteDOMWindow::Create(*this); |
| 34 } | 34 } |
| 35 | 35 |
| 36 RemoteFrame* RemoteFrame::Create(RemoteFrameClient* client, | 36 RemoteFrame* RemoteFrame::Create(RemoteFrameClient* client, |
| 37 Page& page, | 37 Page& page, |
| 38 FrameOwner* owner) { | 38 FrameOwner* owner) { |
| 39 return new RemoteFrame(client, page, owner); | 39 return new RemoteFrame(client, page, owner); |
| 40 } | 40 } |
| 41 | 41 |
| 42 RemoteFrame::~RemoteFrame() { | 42 RemoteFrame::~RemoteFrame() { |
| 43 ASSERT(!view_); | 43 DCHECK(!view_); |
| 44 } | 44 } |
| 45 | 45 |
| 46 DEFINE_TRACE(RemoteFrame) { | 46 DEFINE_TRACE(RemoteFrame) { |
| 47 visitor->Trace(view_); | 47 visitor->Trace(view_); |
| 48 visitor->Trace(security_context_); | 48 visitor->Trace(security_context_); |
| 49 Frame::Trace(visitor); | 49 Frame::Trace(visitor); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void RemoteFrame::Navigate(Document& origin_document, | 52 void RemoteFrame::Navigate(Document& origin_document, |
| 53 const KURL& url, | 53 const KURL& url, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) | 126 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) |
| 127 view_ = view; | 127 view_ = view; |
| 128 } | 128 } |
| 129 | 129 |
| 130 void RemoteFrame::CreateView() { | 130 void RemoteFrame::CreateView() { |
| 131 // If the RemoteFrame does not have a LocalFrame parent, there's no need to | 131 // If the RemoteFrame does not have a LocalFrame parent, there's no need to |
| 132 // create a widget for it. | 132 // create a widget for it. |
| 133 if (!DeprecatedLocalOwner()) | 133 if (!DeprecatedLocalOwner()) |
| 134 return; | 134 return; |
| 135 | 135 |
| 136 ASSERT(!DeprecatedLocalOwner()->OwnedWidget()); | 136 DCHECK(!DeprecatedLocalOwner()->OwnedWidget()); |
| 137 | 137 |
| 138 SetView(RemoteFrameView::Create(this)); | 138 SetView(RemoteFrameView::Create(this)); |
| 139 | 139 |
| 140 if (!OwnerLayoutItem().IsNull()) | 140 if (!OwnerLayoutItem().IsNull()) |
| 141 DeprecatedLocalOwner()->SetWidget(view_); | 141 DeprecatedLocalOwner()->SetWidget(view_); |
| 142 } | 142 } |
| 143 | 143 |
| 144 RemoteFrameClient* RemoteFrame::Client() const { | 144 RemoteFrameClient* RemoteFrame::Client() const { |
| 145 return static_cast<RemoteFrameClient*>(Frame::Client()); | 145 return static_cast<RemoteFrameClient*>(Frame::Client()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void RemoteFrame::SetWebLayer(WebLayer* web_layer) { | 148 void RemoteFrame::SetWebLayer(WebLayer* web_layer) { |
| 149 if (web_layer_) | 149 if (web_layer_) |
| 150 GraphicsLayer::UnregisterContentsLayer(web_layer_); | 150 GraphicsLayer::UnregisterContentsLayer(web_layer_); |
| 151 web_layer_ = web_layer; | 151 web_layer_ = web_layer; |
| 152 if (web_layer_) | 152 if (web_layer_) |
| 153 GraphicsLayer::RegisterContentsLayer(web_layer_); | 153 GraphicsLayer::RegisterContentsLayer(web_layer_); |
| 154 | 154 |
| 155 ASSERT(Owner()); | 155 DCHECK(Owner()); |
| 156 ToHTMLFrameOwnerElement(Owner())->SetNeedsCompositingUpdate(); | 156 ToHTMLFrameOwnerElement(Owner())->SetNeedsCompositingUpdate(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void RemoteFrame::AdvanceFocus(WebFocusType type, LocalFrame* source) { | 159 void RemoteFrame::AdvanceFocus(WebFocusType type, LocalFrame* source) { |
| 160 Client()->AdvanceFocus(type, source); | 160 Client()->AdvanceFocus(type, source); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void RemoteFrame::DetachChildren() { | 163 void RemoteFrame::DetachChildren() { |
| 164 using FrameVector = HeapVector<Member<Frame>>; | 164 using FrameVector = HeapVector<Member<Frame>>; |
| 165 FrameVector children_to_detach; | 165 FrameVector children_to_detach; |
| 166 children_to_detach.ReserveCapacity(Tree().ChildCount()); | 166 children_to_detach.ReserveCapacity(Tree().ChildCount()); |
| 167 for (Frame* child = Tree().FirstChild(); child; | 167 for (Frame* child = Tree().FirstChild(); child; |
| 168 child = child->Tree().NextSibling()) | 168 child = child->Tree().NextSibling()) |
| 169 children_to_detach.push_back(child); | 169 children_to_detach.push_back(child); |
| 170 for (const auto& child : children_to_detach) | 170 for (const auto& child : children_to_detach) |
| 171 child->Detach(FrameDetachType::kRemove); | 171 child->Detach(FrameDetachType::kRemove); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |