| 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 "public/web/WebFrame.h" | 6 #include "public/web/WebFrame.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" |
| 10 #include "core/frame/RemoteFrame.h" | 11 #include "core/frame/RemoteFrame.h" |
| 11 #include "core/html/HTMLFrameOwnerElement.h" | 12 #include "core/html/HTMLFrameOwnerElement.h" |
| 13 #include "core/page/Page.h" |
| 12 #include "platform/UserGestureIndicator.h" | 14 #include "platform/UserGestureIndicator.h" |
| 13 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
| 14 #include "web/OpenedFrameTracker.h" | 16 #include "web/OpenedFrameTracker.h" |
| 15 #include "web/WebLocalFrameImpl.h" | 17 #include "web/WebLocalFrameImpl.h" |
| 16 #include "web/WebRemoteFrameImpl.h" | 18 #include "web/WebRemoteFrameImpl.h" |
| 17 #include <algorithm> | 19 #include <algorithm> |
| 18 | 20 |
| 19 namespace blink { | 21 namespace blink { |
| 20 | 22 |
| 21 Frame* toCoreFrame(const WebFrame* frame) | 23 Frame* toCoreFrame(const WebFrame* frame) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 m_openedFrameTracker->updateOpener(frame); | 76 m_openedFrameTracker->updateOpener(frame); |
| 75 frame->m_openedFrameTracker.reset(m_openedFrameTracker.release()); | 77 frame->m_openedFrameTracker.reset(m_openedFrameTracker.release()); |
| 76 } | 78 } |
| 77 | 79 |
| 78 // Finally, clone the state of the current Frame into one matching | 80 // Finally, clone the state of the current Frame into one matching |
| 79 // the type of the passed in WebFrame. | 81 // the type of the passed in WebFrame. |
| 80 // FIXME: This is a bit clunky; this results in pointless decrements and | 82 // FIXME: This is a bit clunky; this results in pointless decrements and |
| 81 // increments of connected subframes. | 83 // increments of connected subframes. |
| 82 FrameOwner* owner = oldFrame->owner(); | 84 FrameOwner* owner = oldFrame->owner(); |
| 83 oldFrame->disconnectOwnerElement(); | 85 oldFrame->disconnectOwnerElement(); |
| 84 if (Frame* newFrame = toCoreFrame(frame)) { | 86 if (frame->isWebLocalFrame()) { |
| 85 ASSERT(owner == newFrame->owner()); | 87 LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame(); |
| 86 if (owner->isLocal()) { | 88 ASSERT(owner == localFrame.owner()); |
| 89 if (owner && owner->isLocal()) { |
| 87 HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(owner)
; | 90 HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(owner)
; |
| 88 ownerElement->setContentFrame(*newFrame); | 91 ownerElement->setContentFrame(localFrame); |
| 89 if (newFrame->isLocalFrame()) | 92 ownerElement->setWidget(localFrame.view()); |
| 90 ownerElement->setWidget(toLocalFrame(newFrame)->view()); | 93 } else { |
| 94 localFrame.page()->setMainFrame(&localFrame); |
| 91 } | 95 } |
| 92 } else if (frame->isWebLocalFrame()) { | |
| 93 toWebLocalFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner,
oldFrame->tree().name(), nullAtom); | |
| 94 } else { | 96 } else { |
| 95 toWebRemoteFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner
, oldFrame->tree().name()); | 97 toWebRemoteFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner
, oldFrame->tree().name()); |
| 96 } | 98 } |
| 97 | 99 |
| 98 return true; | 100 return true; |
| 99 } | 101 } |
| 100 | 102 |
| 101 void WebFrame::detach() | 103 void WebFrame::detach() |
| 102 { | 104 { |
| 103 toCoreFrame(this)->detach(); | 105 toCoreFrame(this)->detach(); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 bool WebFrame::isFrameAlive(VisitorType visitor, const WebFrame* frame) { re
turn isFrameAliveImpl(visitor, frame); } \ | 300 bool WebFrame::isFrameAlive(VisitorType visitor, const WebFrame* frame) { re
turn isFrameAliveImpl(visitor, frame); } \ |
| 299 void WebFrame::clearWeakFrames(VisitorType visitor) { clearWeakFramesImpl(vi
sitor); } | 301 void WebFrame::clearWeakFrames(VisitorType visitor) { clearWeakFramesImpl(vi
sitor); } |
| 300 | 302 |
| 301 DEFINE_VISITOR_METHOD(Visitor*) | 303 DEFINE_VISITOR_METHOD(Visitor*) |
| 302 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) | 304 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) |
| 303 | 305 |
| 304 #undef DEFINE_VISITOR_METHOD | 306 #undef DEFINE_VISITOR_METHOD |
| 305 #endif | 307 #endif |
| 306 | 308 |
| 307 } // namespace blink | 309 } // namespace blink |
| OLD | NEW |