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 | #pragma once |
26 | |
27 | #if ENABLE(FULLSCREEN_API) |
28 | |
29 | #include "ArgumentCoders.h" |
30 | #include "Connection.h" |
31 | #include <wtf/Forward.h> |
32 | #include <wtf/ThreadSafeRefCounted.h> |
33 | |
34 | namespace WebCore { |
35 | class IntRect; |
36 | } |
37 | |
38 | namespace Messages { |
39 | namespace WebFullScreenManagerProxy { |
40 | |
41 | static inline IPC::StringReference messageReceiverName() |
42 | { |
43 | return IPC::StringReference("WebFullScreenManagerProxy" ); |
44 | } |
45 | |
46 | class SupportsFullScreen { |
47 | public: |
48 | typedef std::tuple<bool> Arguments; |
49 | |
50 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
51 | static IPC::StringReference name() { return IPC::StringReference("SupportsFullScreen" ); } |
52 | static const bool isSync = true; |
53 | |
54 | using DelayedReply = CompletionHandler<void(bool supportsFullScreen)>; |
55 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool supportsFullScreen); |
56 | using Reply = std::tuple<bool&>; |
57 | using ReplyArguments = std::tuple<bool>; |
58 | explicit SupportsFullScreen(bool withKeyboard) |
59 | : m_arguments(withKeyboard) |
60 | { |
61 | } |
62 | |
63 | const Arguments& arguments() const |
64 | { |
65 | return m_arguments; |
66 | } |
67 | |
68 | private: |
69 | Arguments m_arguments; |
70 | }; |
71 | |
72 | class EnterFullScreen { |
73 | public: |
74 | typedef std::tuple<> Arguments; |
75 | |
76 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
77 | static IPC::StringReference name() { return IPC::StringReference("EnterFullScreen" ); } |
78 | static const bool isSync = false; |
79 | |
80 | const Arguments& arguments() const |
81 | { |
82 | return m_arguments; |
83 | } |
84 | |
85 | private: |
86 | Arguments m_arguments; |
87 | }; |
88 | |
89 | class ExitFullScreen { |
90 | public: |
91 | typedef std::tuple<> Arguments; |
92 | |
93 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
94 | static IPC::StringReference name() { return IPC::StringReference("ExitFullScreen" ); } |
95 | static const bool isSync = false; |
96 | |
97 | const Arguments& arguments() const |
98 | { |
99 | return m_arguments; |
100 | } |
101 | |
102 | private: |
103 | Arguments m_arguments; |
104 | }; |
105 | |
106 | class BeganEnterFullScreen { |
107 | public: |
108 | typedef std::tuple<const WebCore::IntRect&, const WebCore::IntRect&> Arguments; |
109 | |
110 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
111 | static IPC::StringReference name() { return IPC::StringReference("BeganEnterFullScreen" ); } |
112 | static const bool isSync = false; |
113 | |
114 | BeganEnterFullScreen(const WebCore::IntRect& initialRect, const WebCore::IntRect& finalRect) |
115 | : m_arguments(initialRect, finalRect) |
116 | { |
117 | } |
118 | |
119 | const Arguments& arguments() const |
120 | { |
121 | return m_arguments; |
122 | } |
123 | |
124 | private: |
125 | Arguments m_arguments; |
126 | }; |
127 | |
128 | class BeganExitFullScreen { |
129 | public: |
130 | typedef std::tuple<const WebCore::IntRect&, const WebCore::IntRect&> Arguments; |
131 | |
132 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
133 | static IPC::StringReference name() { return IPC::StringReference("BeganExitFullScreen" ); } |
134 | static const bool isSync = false; |
135 | |
136 | BeganExitFullScreen(const WebCore::IntRect& initialRect, const WebCore::IntRect& finalRect) |
137 | : m_arguments(initialRect, finalRect) |
138 | { |
139 | } |
140 | |
141 | const Arguments& arguments() const |
142 | { |
143 | return m_arguments; |
144 | } |
145 | |
146 | private: |
147 | Arguments m_arguments; |
148 | }; |
149 | |
150 | class Close { |
151 | public: |
152 | typedef std::tuple<> Arguments; |
153 | |
154 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
155 | static IPC::StringReference name() { return IPC::StringReference("Close" ); } |
156 | static const bool isSync = false; |
157 | |
158 | const Arguments& arguments() const |
159 | { |
160 | return m_arguments; |
161 | } |
162 | |
163 | private: |
164 | Arguments m_arguments; |
165 | }; |
166 | |
167 | } // namespace WebFullScreenManagerProxy |
168 | } // namespace Messages |
169 | |
170 | #endif // ENABLE(FULLSCREEN_API) |
171 | |