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
3 // found in the LICENSE file.
6 #include "core/frame/RemoteFrame.h"
8 #include "core/frame/RemoteFrameClient.h"
9 #include "core/frame/RemoteFrameView.h"
10 #include "core/html/HTMLFrameOwnerElement.h"
11 #include "platform/weborigin/SecurityPolicy.h"
15 inline RemoteFrame::RemoteFrame(RemoteFrameClient* client, FrameHost* host, FrameOwner* owner)
16 : Frame(client, host, owner)
20 PassRefPtrWillBeRawPtr<RemoteFrame> RemoteFrame::create(RemoteFrameClient* client, FrameHost* host, FrameOwner* owner)
22 return adoptRefWillBeNoop(new RemoteFrame(client, host, owner));
25 RemoteFrame::~RemoteFrame()
30 void RemoteFrame::trace(Visitor* visitor)
32 visitor->trace(m_view);
33 Frame::trace(visitor);
36 void RemoteFrame::navigate(Document& originDocument, const KURL& url, bool lockBackForwardList)
38 // The process where this frame actually lives won't have sufficient information to determine
39 // correct referrer, since it won't have access to the originDocument. Set it now.
40 ResourceRequest request(url);
41 request.setHTTPReferrer(SecurityPolicy::generateReferrer(originDocument.referrerPolicy(), url, originDocument.outgoingReferrer()));
42 remoteFrameClient()->navigate(request, lockBackForwardList);
45 void RemoteFrame::detach()
53 void RemoteFrame::forwardInputEvent(Event* event)
55 remoteFrameClient()->forwardInputEvent(event);
58 void RemoteFrame::setView(PassRefPtrWillBeRawPtr<RemoteFrameView> view)
60 // Oilpan: as RemoteFrameView performs no finalization actions,
61 // no explicit dispose() of it needed here. (cf. FrameView::dispose().)
65 void RemoteFrame::createView()
67 RefPtrWillBeRawPtr<RemoteFrameView> view = RemoteFrameView::create(this);
70 if (ownerRenderer()) {
71 HTMLFrameOwnerElement* owner = deprecatedLocalOwner();
73 owner->setWidget(view);
77 RemoteFrameClient* RemoteFrame::remoteFrameClient() const
79 return static_cast<RemoteFrameClient*>(client());