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#include "ArgumentCoders.h"
28#include "Connection.h"
29#include <WebCore/FloatRect.h>
30#include <wtf/Forward.h>
31#include <wtf/MachSendRight.h>
32#include <wtf/Optional.h>
33#include <wtf/ThreadSafeRefCounted.h>
34#include <wtf/text/WTFString.h>
35
36namespace WebCore {
37class FloatPoint;
38class IntSize;
39}
40
41namespace WebKit {
42struct ColorSpaceData;
43class CallbackID;
44}
45
46namespace Messages {
47namespace DrawingArea {
48
49static inline IPC::StringReference messageReceiverName()
50{
51 return IPC::StringReference("DrawingArea");
52}
53
54class UpdateBackingStoreState {
55public:
56 typedef std::tuple<uint64_t, bool, float, const WebCore::IntSize&, const WebCore::IntSize&> Arguments;
57
58 static IPC::StringReference receiverName() { return messageReceiverName(); }
59 static IPC::StringReference name() { return IPC::StringReference("UpdateBackingStoreState"); }
60 static const bool isSync = false;
61
62 UpdateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset)
63 : m_arguments(backingStoreStateID, respondImmediately, deviceScaleFactor, size, scrollOffset)
64 {
65 }
66
67 const Arguments& arguments() const
68 {
69 return m_arguments;
70 }
71
72private:
73 Arguments m_arguments;
74};
75
76class DidUpdate {
77public:
78 typedef std::tuple<> Arguments;
79
80 static IPC::StringReference receiverName() { return messageReceiverName(); }
81 static IPC::StringReference name() { return IPC::StringReference("DidUpdate"); }
82 static const bool isSync = false;
83
84 const Arguments& arguments() const
85 {
86 return m_arguments;
87 }
88
89private:
90 Arguments m_arguments;
91};
92
93#if PLATFORM(COCOA)
94class UpdateGeometry {
95public:
96 typedef std::tuple<const WebCore::IntSize&, bool, const MachSendRight&> Arguments;
97
98 static IPC::StringReference receiverName() { return messageReceiverName(); }
99 static IPC::StringReference name() { return IPC::StringReference("UpdateGeometry"); }
100 static const bool isSync = false;
101
102 UpdateGeometry(const WebCore::IntSize& viewSize, bool flushSynchronously, const MachSendRight& fencePort)
103 : m_arguments(viewSize, flushSynchronously, fencePort)
104 {
105 }
106
107 const Arguments& arguments() const
108 {
109 return m_arguments;
110 }
111
112private:
113 Arguments m_arguments;
114};
115#endif
116
117#if PLATFORM(COCOA)
118class SetDeviceScaleFactor {
119public:
120 typedef std::tuple<float> Arguments;
121
122 static IPC::StringReference receiverName() { return messageReceiverName(); }
123 static IPC::StringReference name() { return IPC::StringReference("SetDeviceScaleFactor"); }
124 static const bool isSync = false;
125
126 explicit SetDeviceScaleFactor(float deviceScaleFactor)
127 : m_arguments(deviceScaleFactor)
128 {
129 }
130
131 const Arguments& arguments() const
132 {
133 return m_arguments;
134 }
135
136private:
137 Arguments m_arguments;
138};
139#endif
140
141#if PLATFORM(COCOA)
142class SetColorSpace {
143public:
144 typedef std::tuple<const WebKit::ColorSpaceData&> Arguments;
145
146 static IPC::StringReference receiverName() { return messageReceiverName(); }
147 static IPC::StringReference name() { return IPC::StringReference("SetColorSpace"); }
148 static const bool isSync = false;
149
150 explicit SetColorSpace(const WebKit::ColorSpaceData& colorSpace)
151 : m_arguments(colorSpace)
152 {
153 }
154
155 const Arguments& arguments() const
156 {
157 return m_arguments;
158 }
159
160private:
161 Arguments m_arguments;
162};
163#endif
164
165#if PLATFORM(COCOA)
166class SetViewExposedRect {
167public:
168 typedef std::tuple<const Optional<WebCore::FloatRect>&> Arguments;
169
170 static IPC::StringReference receiverName() { return messageReceiverName(); }
171 static IPC::StringReference name() { return IPC::StringReference("SetViewExposedRect"); }
172 static const bool isSync = false;
173
174 explicit SetViewExposedRect(const Optional<WebCore::FloatRect>& viewExposedRect)
175 : m_arguments(viewExposedRect)
176 {
177 }
178
179 const Arguments& arguments() const
180 {
181 return m_arguments;
182 }
183
184private:
185 Arguments m_arguments;
186};
187#endif
188
189#if PLATFORM(COCOA)
190class AdjustTransientZoom {
191public:
192 typedef std::tuple<double, const WebCore::FloatPoint&> Arguments;
193
194 static IPC::StringReference receiverName() { return messageReceiverName(); }
195 static IPC::StringReference name() { return IPC::StringReference("AdjustTransientZoom"); }
196 static const bool isSync = false;
197
198 AdjustTransientZoom(double scale, const WebCore::FloatPoint& origin)
199 : m_arguments(scale, origin)
200 {
201 }
202
203 const Arguments& arguments() const
204 {
205 return m_arguments;
206 }
207
208private:
209 Arguments m_arguments;
210};
211#endif
212
213#if PLATFORM(COCOA)
214class CommitTransientZoom {
215public:
216 typedef std::tuple<double, const WebCore::FloatPoint&> Arguments;
217
218 static IPC::StringReference receiverName() { return messageReceiverName(); }
219 static IPC::StringReference name() { return IPC::StringReference("CommitTransientZoom"); }
220 static const bool isSync = false;
221
222 CommitTransientZoom(double scale, const WebCore::FloatPoint& origin)
223 : m_arguments(scale, origin)
224 {
225 }
226
227 const Arguments& arguments() const
228 {
229 return m_arguments;
230 }
231
232private:
233 Arguments m_arguments;
234};
235#endif
236
237#if PLATFORM(COCOA)
238class AcceleratedAnimationDidStart {
239public:
240 typedef std::tuple<uint64_t, const String&, const MonotonicTime&> Arguments;
241
242 static IPC::StringReference receiverName() { return messageReceiverName(); }
243 static IPC::StringReference name() { return IPC::StringReference("AcceleratedAnimationDidStart"); }
244 static const bool isSync = false;
245
246 AcceleratedAnimationDidStart(uint64_t layerID, const String& key, const MonotonicTime& startTime)
247 : m_arguments(layerID, key, startTime)
248 {
249 }
250
251 const Arguments& arguments() const
252 {
253 return m_arguments;
254 }
255
256private:
257 Arguments m_arguments;
258};
259#endif
260
261#if PLATFORM(COCOA)
262class AcceleratedAnimationDidEnd {
263public:
264 typedef std::tuple<uint64_t, const String&> Arguments;
265
266 static IPC::StringReference receiverName() { return messageReceiverName(); }
267 static IPC::StringReference name() { return IPC::StringReference("AcceleratedAnimationDidEnd"); }
268 static const bool isSync = false;
269
270 AcceleratedAnimationDidEnd(uint64_t layerID, const String& key)
271 : m_arguments(layerID, key)
272 {
273 }
274
275 const Arguments& arguments() const
276 {
277 return m_arguments;
278 }
279
280private:
281 Arguments m_arguments;
282};
283#endif
284
285#if PLATFORM(COCOA)
286class AddTransactionCallbackID {
287public:
288 typedef std::tuple<const WebKit::CallbackID&> Arguments;
289
290 static IPC::StringReference receiverName() { return messageReceiverName(); }
291 static IPC::StringReference name() { return IPC::StringReference("AddTransactionCallbackID"); }
292 static const bool isSync = false;
293
294 explicit AddTransactionCallbackID(const WebKit::CallbackID& callbackID)
295 : m_arguments(callbackID)
296 {
297 }
298
299 const Arguments& arguments() const
300 {
301 return m_arguments;
302 }
303
304private:
305 Arguments m_arguments;
306};
307#endif
308
309} // namespace DrawingArea
310} // namespace Messages
311