Chromium Code Reviews| 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 "public/web/WebFrame.h" | 5 #include "public/web/WebFrame.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/WindowProxyManager.h" | 7 #include "bindings/core/v8/WindowProxyManager.h" |
| 8 #include "core/HTMLNames.h" | |
| 8 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 9 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
| 11 #include "core/frame/RemoteFrame.h" | 12 #include "core/frame/RemoteFrame.h" |
| 12 #include "core/html/HTMLFrameElementBase.h" | 13 #include "core/html/HTMLFrameElementBase.h" |
| 13 #include "core/html/HTMLFrameOwnerElement.h" | 14 #include "core/html/HTMLFrameOwnerElement.h" |
| 14 #include "core/page/Page.h" | 15 #include "core/page/Page.h" |
| 15 #include "platform/UserGestureIndicator.h" | 16 #include "platform/UserGestureIndicator.h" |
| 16 #include "platform/heap/Handle.h" | 17 #include "platform/heap/Handle.h" |
| 17 #include "public/web/WebElement.h" | 18 #include "public/web/WebElement.h" |
| 18 #include "public/web/WebFrameOwnerProperties.h" | 19 #include "public/web/WebFrameOwnerProperties.h" |
| 19 #include "public/web/WebSandboxFlags.h" | 20 #include "public/web/WebSandboxFlags.h" |
| 20 #include "web/OpenedFrameTracker.h" | 21 #include "web/OpenedFrameTracker.h" |
| 21 #include "web/RemoteFrameOwner.h" | 22 #include "web/RemoteFrameOwner.h" |
| 22 #include "web/WebLocalFrameImpl.h" | 23 #include "web/WebLocalFrameImpl.h" |
| 23 #include "web/WebRemoteFrameImpl.h" | 24 #include "web/WebRemoteFrameImpl.h" |
| 24 #include <algorithm> | 25 #include <algorithm> |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| 27 | 28 |
| 29 using namespace HTMLNames; | |
|
alexmos
2016/11/22 19:43:35
Is this necessary, along with the header above?
| |
| 30 | |
| 28 bool WebFrame::swap(WebFrame* frame) { | 31 bool WebFrame::swap(WebFrame* frame) { |
| 29 using std::swap; | 32 using std::swap; |
| 30 Frame* oldFrame = toImplBase()->frame(); | 33 Frame* oldFrame = toImplBase()->frame(); |
| 31 if (oldFrame->isDetaching()) | 34 if (oldFrame->isDetaching()) |
| 32 return false; | 35 return false; |
| 33 | 36 |
| 34 // Unload the current Document in this frame: this calls unload handlers, | 37 // Unload the current Document in this frame: this calls unload handlers, |
| 35 // detaches child frames, etc. Since this runs script, make sure this frame | 38 // detaches child frames, etc. Since this runs script, make sure this frame |
| 36 // wasn't detached before continuing with the swap. | 39 // wasn't detached before continuing with the swap. |
| 37 // FIXME: There is no unit test for this condition, so one needs to be | 40 // FIXME: There is no unit test for this condition, so one needs to be |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 WebInsecureRequestPolicy WebFrame::getInsecureRequestPolicy() const { | 134 WebInsecureRequestPolicy WebFrame::getInsecureRequestPolicy() const { |
| 132 return toImplBase()->frame()->securityContext()->getInsecureRequestPolicy(); | 135 return toImplBase()->frame()->securityContext()->getInsecureRequestPolicy(); |
| 133 } | 136 } |
| 134 | 137 |
| 135 void WebFrame::setFrameOwnerProperties( | 138 void WebFrame::setFrameOwnerProperties( |
| 136 const WebFrameOwnerProperties& properties) { | 139 const WebFrameOwnerProperties& properties) { |
| 137 // At the moment, this is only used to replicate frame owner properties | 140 // At the moment, this is only used to replicate frame owner properties |
| 138 // for frames with a remote owner. | 141 // for frames with a remote owner. |
| 139 RemoteFrameOwner* owner = toRemoteFrameOwner(toImplBase()->frame()->owner()); | 142 RemoteFrameOwner* owner = toRemoteFrameOwner(toImplBase()->frame()->owner()); |
| 140 DCHECK(owner); | 143 DCHECK(owner); |
| 144 | |
| 145 Frame* frame = toImplBase()->frame(); | |
| 146 DCHECK(frame); | |
| 147 | |
| 148 if (frame->isLocalFrame()) { | |
| 149 toLocalFrame(frame)->document()->willChangeFrameOwnerProperties( | |
| 150 properties.marginWidth, properties.marginHeight, | |
| 151 static_cast<ScrollbarMode>(properties.scrollingMode)); | |
| 152 } | |
| 153 | |
| 141 owner->setScrollingMode(properties.scrollingMode); | 154 owner->setScrollingMode(properties.scrollingMode); |
| 142 owner->setMarginWidth(properties.marginWidth); | 155 owner->setMarginWidth(properties.marginWidth); |
| 143 owner->setMarginHeight(properties.marginHeight); | 156 owner->setMarginHeight(properties.marginHeight); |
| 144 owner->setAllowFullscreen(properties.allowFullscreen); | 157 owner->setAllowFullscreen(properties.allowFullscreen); |
| 145 owner->setCsp(properties.requiredCsp); | 158 owner->setCsp(properties.requiredCsp); |
| 146 owner->setDelegatedpermissions(properties.delegatedPermissions); | 159 owner->setDelegatedpermissions(properties.delegatedPermissions); |
| 147 } | 160 } |
| 148 | 161 |
| 149 WebFrame* WebFrame::opener() const { | 162 WebFrame* WebFrame::opener() const { |
| 150 return m_opener; | 163 return m_opener; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { \ | 338 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { \ |
| 326 clearWeakFramesImpl(visitor); \ | 339 clearWeakFramesImpl(visitor); \ |
| 327 } | 340 } |
| 328 | 341 |
| 329 DEFINE_VISITOR_METHOD(Visitor*) | 342 DEFINE_VISITOR_METHOD(Visitor*) |
| 330 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) | 343 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) |
| 331 | 344 |
| 332 #undef DEFINE_VISITOR_METHOD | 345 #undef DEFINE_VISITOR_METHOD |
| 333 | 346 |
| 334 } // namespace blink | 347 } // namespace blink |
| OLD | NEW |