1/*
2 * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
17 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25#include "config.h"
26
27#if ENABLE(FULLSCREEN_API)
28
29#include "WebFullScreenManagerProxy.h"
30
31#include "Decoder.h"
32#include "HandleMessage.h"
33#include "WebCoreArgumentCoders.h"
34#include "WebFullScreenManagerProxyMessages.h"
35#include <WebCore/IntRect.h>
36
37namespace Messages {
38
39namespace WebFullScreenManagerProxy {
40
41void SupportsFullScreen::send(std::unique_ptr<IPC::Encoder>&& encoder, IPC::Connection& connection, bool supportsFullScreen)
42{
43 *encoder << supportsFullScreen;
44 connection.sendSyncReply(WTFMove(encoder));
45}
46
47} // namespace WebFullScreenManagerProxy
48
49} // namespace Messages
50
51namespace WebKit {
52
53void WebFullScreenManagerProxy::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
54{
55 if (decoder.messageName() == Messages::WebFullScreenManagerProxy::EnterFullScreen::name()) {
56 IPC::handleMessage<Messages::WebFullScreenManagerProxy::EnterFullScreen>(decoder, this, &WebFullScreenManagerProxy::enterFullScreen);
57 return;
58 }
59 if (decoder.messageName() == Messages::WebFullScreenManagerProxy::ExitFullScreen::name()) {
60 IPC::handleMessage<Messages::WebFullScreenManagerProxy::ExitFullScreen>(decoder, this, &WebFullScreenManagerProxy::exitFullScreen);
61 return;
62 }
63 if (decoder.messageName() == Messages::WebFullScreenManagerProxy::BeganEnterFullScreen::name()) {
64 IPC::handleMessage<Messages::WebFullScreenManagerProxy::BeganEnterFullScreen>(decoder, this, &WebFullScreenManagerProxy::beganEnterFullScreen);
65 return;
66 }
67 if (decoder.messageName() == Messages::WebFullScreenManagerProxy::BeganExitFullScreen::name()) {
68 IPC::handleMessage<Messages::WebFullScreenManagerProxy::BeganExitFullScreen>(decoder, this, &WebFullScreenManagerProxy::beganExitFullScreen);
69 return;
70 }
71 if (decoder.messageName() == Messages::WebFullScreenManagerProxy::Close::name()) {
72 IPC::handleMessage<Messages::WebFullScreenManagerProxy::Close>(decoder, this, &WebFullScreenManagerProxy::close);
73 return;
74 }
75 UNUSED_PARAM(connection);
76 UNUSED_PARAM(decoder);
77 ASSERT_NOT_REACHED();
78}
79
80void WebFullScreenManagerProxy::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder)
81{
82 if (decoder.messageName() == Messages::WebFullScreenManagerProxy::SupportsFullScreen::name()) {
83 IPC::handleMessageSynchronous<Messages::WebFullScreenManagerProxy::SupportsFullScreen>(connection, decoder, replyEncoder, this, &WebFullScreenManagerProxy::supportsFullScreen);
84 return;
85 }
86 UNUSED_PARAM(connection);
87 UNUSED_PARAM(decoder);
88 UNUSED_PARAM(replyEncoder);
89 ASSERT_NOT_REACHED();
90}
91
92} // namespace WebKit
93
94
95#endif // ENABLE(FULLSCREEN_API)
96