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.
4
5#include "config.h"
6#include "web/RemoteFrameClient.h"
7
8#include "platform/weborigin/SecurityOrigin.h"
9#include "web/WebLocalFrameImpl.h"
10#include "web/WebRemoteFrameImpl.h"
11
12namespace blink {
13
14RemoteFrameClient::RemoteFrameClient(WebRemoteFrameImpl* webFrame)
15    : m_webFrame(webFrame)
16{
17}
18
19Frame* RemoteFrameClient::opener() const
20{
21    return toCoreFrame(m_webFrame->opener());
22}
23
24void RemoteFrameClient::setOpener(Frame*)
25{
26    // FIXME: Implement.
27}
28
29Frame* RemoteFrameClient::parent() const
30{
31    return toCoreFrame(m_webFrame->parent());
32}
33
34Frame* RemoteFrameClient::top() const
35{
36    return toCoreFrame(m_webFrame->top());
37}
38
39Frame* RemoteFrameClient::previousSibling() const
40{
41    return toCoreFrame(m_webFrame->previousSibling());
42}
43
44Frame* RemoteFrameClient::nextSibling() const
45{
46    return toCoreFrame(m_webFrame->nextSibling());
47}
48
49Frame* RemoteFrameClient::firstChild() const
50{
51    return toCoreFrame(m_webFrame->firstChild());
52}
53
54Frame* RemoteFrameClient::lastChild() const
55{
56    return toCoreFrame(m_webFrame->lastChild());
57}
58
59bool RemoteFrameClient::willCheckAndDispatchMessageEvent(
60    SecurityOrigin* target, MessageEvent* event, LocalFrame* sourceFrame) const
61{
62    if (m_webFrame->client())
63        m_webFrame->client()->postMessageEvent(WebLocalFrameImpl::fromFrame(sourceFrame), m_webFrame, WebSecurityOrigin(target), WebDOMMessageEvent(event));
64    return true;
65}
66
67} // namespace blink
68