[Attachment Support] Add a way to write blob data to a file URL from the UI process
[WebKit-https.git] / Source / WebKit / Shared / WebCoreArgumentCoders.h
1 /*
2  * Copyright (C) 2010-2017 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''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #pragma once
27
28 #include "ArgumentCoders.h"
29 #include <WebCore/AutoplayEvent.h>
30 #include <WebCore/CacheStorageConnection.h>
31 #include <WebCore/ColorSpace.h>
32 #include <WebCore/DiagnosticLoggingClient.h>
33 #include <WebCore/FrameLoaderTypes.h>
34 #include <WebCore/IndexedDB.h>
35 #include <WebCore/MediaSelectionOption.h>
36 #include <WebCore/NetworkLoadMetrics.h>
37 #include <WebCore/NotificationDirection.h>
38 #include <WebCore/PaymentHeaders.h>
39 #include <WebCore/RealtimeMediaSource.h>
40 #include <WebCore/ScrollSnapOffsetsInfo.h>
41 #include <WebCore/ServiceWorkerTypes.h>
42 #include <WebCore/StoredCredentialsPolicy.h>
43 #include <WebCore/WorkerType.h>
44
45 namespace WTF {
46 class MonotonicTime;
47 class Seconds;
48 }
49
50 namespace WebCore {
51 class AffineTransform;
52 class AuthenticationChallenge;
53 class BlobPart;
54 class CertificateInfo;
55 class Color;
56 class Credential;
57 class CubicBezierTimingFunction;
58 class Cursor;
59 class DatabaseDetails;
60 class DragData;
61 class FilterOperation;
62 class FilterOperations;
63 class FloatPoint;
64 class FloatPoint3D;
65 class FloatRect;
66 class FloatRoundedRect;
67 class FloatSize;
68 class FixedPositionViewportConstraints;
69 class HTTPHeaderMap;
70 class IntPoint;
71 class IntRect;
72 class IntSize;
73 class KeyframeValueList;
74 class LayoutSize;
75 class LayoutPoint;
76 class LinearTimingFunction;
77 class Notification;
78 class Path;
79 class ProtectionSpace;
80 class Region;
81 class ResourceError;
82 class ResourceRequest;
83 class ResourceResponse;
84 class SpringTimingFunction;
85 class StepsTimingFunction;
86 class StickyPositionViewportConstraints;
87 class TextCheckingRequestData;
88 class TransformationMatrix;
89 class UserStyleSheet;
90 class URL;
91
92 struct CacheQueryOptions;
93 struct CompositionUnderline;
94 struct DictationAlternative;
95 struct DictionaryPopupInfo;
96 struct EventTrackingRegions;
97 struct ExceptionDetails;
98 struct FileChooserSettings;
99 struct Length;
100 struct GrammarDetail;
101 struct MimeClassInfo;
102 struct PasteboardImage;
103 struct PasteboardCustomData;
104 struct PasteboardURL;
105 struct PluginInfo;
106 struct PromisedBlobInfo;
107 struct RecentSearch;
108 struct ResourceLoadStatistics;
109 struct ScrollableAreaParameters;
110 struct TextCheckingResult;
111 struct TextIndicatorData;
112 struct ViewportAttributes;
113 struct WindowFeatures;
114     
115 template <typename> class RectEdges;
116 using FloatBoxExtent = RectEdges<float>;
117
118 #if PLATFORM(COCOA)
119 class MachSendRight;
120 struct KeypressCommand;
121 #endif
122
123 #if PLATFORM(IOS)
124 class FloatQuad;
125 class SelectionRect;
126 struct Highlight;
127 struct PasteboardImage;
128 struct PasteboardWebContent;
129 struct ViewportArguments;
130 #endif
131
132 #if USE(SOUP)
133 struct SoupNetworkProxySettings;
134 #endif
135
136 #if PLATFORM(WPE)
137 struct PasteboardWebContent;
138 #endif
139
140 #if ENABLE(CONTENT_FILTERING)
141 class ContentFilterUnblockHandler;
142 #endif
143
144 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
145 class MediaPlaybackTargetContext;
146 #endif
147
148 #if ENABLE(MEDIA_SESSION)
149 class MediaSessionMetadata;
150 #endif
151
152 #if ENABLE(MEDIA_STREAM)
153 struct MediaConstraints;
154 #endif
155
156 #if ENABLE(INDEXED_DATABASE)
157 using IDBKeyPath = Variant<String, Vector<String>>;
158 #endif
159 }
160
161 namespace IPC {
162
163 template<> struct ArgumentCoder<WTF::MonotonicTime> {
164     static void encode(Encoder&, const WTF::MonotonicTime&);
165     static bool decode(Decoder&, WTF::MonotonicTime&);
166 };
167
168 template<> struct ArgumentCoder<WTF::Seconds> {
169     static void encode(Encoder&, const WTF::Seconds&);
170     static bool decode(Decoder&, WTF::Seconds&);
171 };
172
173 template<> struct ArgumentCoder<WebCore::AffineTransform> {
174     static void encode(Encoder&, const WebCore::AffineTransform&);
175     static bool decode(Decoder&, WebCore::AffineTransform&);
176 };
177
178 template<> struct ArgumentCoder<WebCore::CacheQueryOptions> {
179     static void encode(Encoder&, const WebCore::CacheQueryOptions&);
180     static bool decode(Decoder&, WebCore::CacheQueryOptions&);
181 };
182
183 template<> struct ArgumentCoder<WebCore::DOMCacheEngine::CacheInfo> {
184     static void encode(Encoder&, const WebCore::DOMCacheEngine::CacheInfo&);
185     static std::optional<WebCore::DOMCacheEngine::CacheInfo> decode(Decoder&);
186 };
187
188 template<> struct ArgumentCoder<WebCore::DOMCacheEngine::Record> {
189     static void encode(Encoder&, const WebCore::DOMCacheEngine::Record&);
190     static std::optional<WebCore::DOMCacheEngine::Record> decode(Decoder&);
191 };
192
193 template<> struct ArgumentCoder<WebCore::EventTrackingRegions> {
194     static void encode(Encoder&, const WebCore::EventTrackingRegions&);
195     static bool decode(Decoder&, WebCore::EventTrackingRegions&);
196 };
197
198 template<> struct ArgumentCoder<WebCore::TransformationMatrix> {
199     static void encode(Encoder&, const WebCore::TransformationMatrix&);
200     static bool decode(Decoder&, WebCore::TransformationMatrix&);
201 };
202
203 template<> struct ArgumentCoder<WebCore::LinearTimingFunction> {
204     static void encode(Encoder&, const WebCore::LinearTimingFunction&);
205     static bool decode(Decoder&, WebCore::LinearTimingFunction&);
206 };
207
208 template<> struct ArgumentCoder<WebCore::CubicBezierTimingFunction> {
209     static void encode(Encoder&, const WebCore::CubicBezierTimingFunction&);
210     static bool decode(Decoder&, WebCore::CubicBezierTimingFunction&);
211 };
212
213 template<> struct ArgumentCoder<WebCore::StepsTimingFunction> {
214     static void encode(Encoder&, const WebCore::StepsTimingFunction&);
215     static bool decode(Decoder&, WebCore::StepsTimingFunction&);
216 };
217
218 template<> struct ArgumentCoder<WebCore::SpringTimingFunction> {
219     static void encode(Encoder&, const WebCore::SpringTimingFunction&);
220     static bool decode(Decoder&, WebCore::SpringTimingFunction&);
221 };
222
223 template<> struct ArgumentCoder<WebCore::CertificateInfo> {
224     static void encode(Encoder&, const WebCore::CertificateInfo&);
225     static bool decode(Decoder&, WebCore::CertificateInfo&);
226 };
227
228 template<> struct ArgumentCoder<WebCore::FloatPoint> {
229     static void encode(Encoder&, const WebCore::FloatPoint&);
230     static bool decode(Decoder&, WebCore::FloatPoint&);
231     static std::optional<WebCore::FloatPoint> decode(Decoder&);
232 };
233
234 template<> struct ArgumentCoder<WebCore::FloatPoint3D> {
235     static void encode(Encoder&, const WebCore::FloatPoint3D&);
236     static bool decode(Decoder&, WebCore::FloatPoint3D&);
237 };
238
239 template<> struct ArgumentCoder<WebCore::FloatRect> {
240     static void encode(Encoder&, const WebCore::FloatRect&);
241     static bool decode(Decoder&, WebCore::FloatRect&);
242     static std::optional<WebCore::FloatRect> decode(Decoder&);
243 };
244     
245 template<> struct ArgumentCoder<WebCore::FloatBoxExtent> {
246     static void encode(Encoder&, const WebCore::FloatBoxExtent&);
247     static bool decode(Decoder&, WebCore::FloatBoxExtent&);
248 };
249
250 template<> struct ArgumentCoder<WebCore::FloatSize> {
251     static void encode(Encoder&, const WebCore::FloatSize&);
252     static bool decode(Decoder&, WebCore::FloatSize&);
253 };
254
255 template<> struct ArgumentCoder<WebCore::FloatRoundedRect> {
256     static void encode(Encoder&, const WebCore::FloatRoundedRect&);
257     static bool decode(Decoder&, WebCore::FloatRoundedRect&);
258 };
259
260 #if PLATFORM(IOS)
261 template<> struct ArgumentCoder<WebCore::FloatQuad> {
262     static void encode(Encoder&, const WebCore::FloatQuad&);
263     static std::optional<WebCore::FloatQuad> decode(Decoder&);
264 };
265
266 template<> struct ArgumentCoder<WebCore::ViewportArguments> {
267     static void encode(Encoder&, const WebCore::ViewportArguments&);
268     static bool decode(Decoder&, WebCore::ViewportArguments&);
269 };
270 #endif // PLATFORM(IOS)
271
272 template<> struct ArgumentCoder<WebCore::IntPoint> {
273     static void encode(Encoder&, const WebCore::IntPoint&);
274     static bool decode(Decoder&, WebCore::IntPoint&);
275     static std::optional<WebCore::IntPoint> decode(Decoder&);
276 };
277
278 template<> struct ArgumentCoder<WebCore::IntRect> {
279     static void encode(Encoder&, const WebCore::IntRect&);
280     static bool decode(Decoder&, WebCore::IntRect&);
281     static std::optional<WebCore::IntRect> decode(Decoder&);
282 };
283
284 template<> struct ArgumentCoder<WebCore::IntSize> {
285     static void encode(Encoder&, const WebCore::IntSize&);
286     static bool decode(Decoder&, WebCore::IntSize&);
287     static std::optional<WebCore::IntSize> decode(Decoder&);
288 };
289
290 template<> struct ArgumentCoder<WebCore::LayoutSize> {
291     static void encode(Encoder&, const WebCore::LayoutSize&);
292     static bool decode(Decoder&, WebCore::LayoutSize&);
293 };
294
295 template<> struct ArgumentCoder<WebCore::LayoutPoint> {
296     static void encode(Encoder&, const WebCore::LayoutPoint&);
297     static bool decode(Decoder&, WebCore::LayoutPoint&);
298 };
299
300 template<> struct ArgumentCoder<WebCore::Path> {
301     static void encode(Encoder&, const WebCore::Path&);
302     static bool decode(Decoder&, WebCore::Path&);
303 };
304
305 template<> struct ArgumentCoder<WebCore::Region> {
306     static void encode(Encoder&, const WebCore::Region&);
307     static bool decode(Decoder&, WebCore::Region&);
308 };
309
310 template<> struct ArgumentCoder<WebCore::Length> {
311     static void encode(Encoder&, const WebCore::Length&);
312     static bool decode(Decoder&, WebCore::Length&);
313 };
314
315 template<> struct ArgumentCoder<WebCore::ViewportAttributes> {
316     static void encode(Encoder&, const WebCore::ViewportAttributes&);
317     static bool decode(Decoder&, WebCore::ViewportAttributes&);
318 };
319
320 template<> struct ArgumentCoder<WebCore::MimeClassInfo> {
321     static void encode(Encoder&, const WebCore::MimeClassInfo&);
322     static std::optional<WebCore::MimeClassInfo> decode(Decoder&);
323 };
324
325 template<> struct ArgumentCoder<WebCore::PluginInfo> {
326     static void encode(Encoder&, const WebCore::PluginInfo&);
327     static std::optional<WebCore::PluginInfo> decode(Decoder&);
328 };
329
330 template<> struct ArgumentCoder<WebCore::AuthenticationChallenge> {
331     static void encode(Encoder&, const WebCore::AuthenticationChallenge&);
332     static bool decode(Decoder&, WebCore::AuthenticationChallenge&);
333 };
334
335 template<> struct ArgumentCoder<WebCore::ProtectionSpace> {
336     static void encode(Encoder&, const WebCore::ProtectionSpace&);
337     static bool decode(Decoder&, WebCore::ProtectionSpace&);
338     static void encodePlatformData(Encoder&, const WebCore::ProtectionSpace&);
339     static bool decodePlatformData(Decoder&, WebCore::ProtectionSpace&);
340 };
341
342 template<> struct ArgumentCoder<WebCore::Credential> {
343     static void encode(Encoder&, const WebCore::Credential&);
344     static bool decode(Decoder&, WebCore::Credential&);
345     static void encodePlatformData(Encoder&, const WebCore::Credential&);
346     static bool decodePlatformData(Decoder&, WebCore::Credential&);
347 };
348
349 template<> struct ArgumentCoder<WebCore::Cursor> {
350     static void encode(Encoder&, const WebCore::Cursor&);
351     static bool decode(Decoder&, WebCore::Cursor&);
352 };
353
354 template<> struct ArgumentCoder<WebCore::ResourceRequest> {
355     static void encode(Encoder&, const WebCore::ResourceRequest&);
356     static bool decode(Decoder&, WebCore::ResourceRequest&);
357     static void encodePlatformData(Encoder&, const WebCore::ResourceRequest&);
358     static bool decodePlatformData(Decoder&, WebCore::ResourceRequest&);
359 };
360
361 template<> struct ArgumentCoder<WebCore::ResourceError> {
362     static void encode(Encoder&, const WebCore::ResourceError&);
363     static bool decode(Decoder&, WebCore::ResourceError&);
364     static void encodePlatformData(Encoder&, const WebCore::ResourceError&);
365     static bool decodePlatformData(Decoder&, WebCore::ResourceError&);
366 };
367
368 template<> struct ArgumentCoder<WebCore::WindowFeatures> {
369     static void encode(Encoder&, const WebCore::WindowFeatures&);
370     static bool decode(Decoder&, WebCore::WindowFeatures&);
371 };
372
373 template<> struct ArgumentCoder<WebCore::Color> {
374     static void encode(Encoder&, const WebCore::Color&);
375     static bool decode(Decoder&, WebCore::Color&);
376 };
377
378 #if ENABLE(DRAG_SUPPORT)
379 template<> struct ArgumentCoder<WebCore::DragData> {
380     static void encode(Encoder&, const WebCore::DragData&);
381     static bool decode(Decoder&, WebCore::DragData&);
382 };
383 #endif
384
385 #if PLATFORM(COCOA)
386 template<> struct ArgumentCoder<WebCore::MachSendRight> {
387     static void encode(Encoder&, const WebCore::MachSendRight&);
388     static void encode(Encoder&, WebCore::MachSendRight&&);
389     static bool decode(Decoder&, WebCore::MachSendRight&);
390 };
391
392 template<> struct ArgumentCoder<WebCore::KeypressCommand> {
393     static void encode(Encoder&, const WebCore::KeypressCommand&);
394     static std::optional<WebCore::KeypressCommand> decode(Decoder&);
395 };
396 #endif
397
398 #if PLATFORM(IOS)
399 template<> struct ArgumentCoder<WebCore::SelectionRect> {
400     static void encode(Encoder&, const WebCore::SelectionRect&);
401     static std::optional<WebCore::SelectionRect> decode(Decoder&);
402 };
403
404 template<> struct ArgumentCoder<WebCore::Highlight> {
405     static void encode(Encoder&, const WebCore::Highlight&);
406     static bool decode(Decoder&, WebCore::Highlight&);
407 };
408
409 template<> struct ArgumentCoder<WebCore::PasteboardWebContent> {
410     static void encode(Encoder&, const WebCore::PasteboardWebContent&);
411     static bool decode(Decoder&, WebCore::PasteboardWebContent&);
412 };
413
414 template<> struct ArgumentCoder<WebCore::PasteboardURL> {
415     static void encode(Encoder&, const WebCore::PasteboardURL&);
416     static bool decode(Decoder&, WebCore::PasteboardURL&);
417 };
418
419 template<> struct ArgumentCoder<WebCore::PasteboardImage> {
420     static void encode(Encoder&, const WebCore::PasteboardImage&);
421     static bool decode(Decoder&, WebCore::PasteboardImage&);
422 };
423 #endif
424
425 template<> struct ArgumentCoder<WebCore::PasteboardCustomData> {
426     static void encode(Encoder&, const WebCore::PasteboardCustomData&);
427     static bool decode(Decoder&, WebCore::PasteboardCustomData&);
428 };
429
430 #if USE(SOUP)
431 template<> struct ArgumentCoder<WebCore::SoupNetworkProxySettings> {
432     static void encode(Encoder&, const WebCore::SoupNetworkProxySettings&);
433     static bool decode(Decoder&, WebCore::SoupNetworkProxySettings&);
434 };
435 #endif
436
437 #if PLATFORM(WPE)
438 template<> struct ArgumentCoder<WebCore::PasteboardWebContent> {
439     static void encode(Encoder&, const WebCore::PasteboardWebContent&);
440     static bool decode(Decoder&, WebCore::PasteboardWebContent&);
441 };
442 #endif
443
444 template<> struct ArgumentCoder<WebCore::CompositionUnderline> {
445     static void encode(Encoder&, const WebCore::CompositionUnderline&);
446     static std::optional<WebCore::CompositionUnderline> decode(Decoder&);
447 };
448
449 template<> struct ArgumentCoder<WebCore::DatabaseDetails> {
450     static void encode(Encoder&, const WebCore::DatabaseDetails&);
451     static bool decode(Decoder&, WebCore::DatabaseDetails&);
452 };
453
454 template<> struct ArgumentCoder<WebCore::DictationAlternative> {
455     static void encode(Encoder&, const WebCore::DictationAlternative&);
456     static std::optional<WebCore::DictationAlternative> decode(Decoder&);
457 };
458
459 template<> struct ArgumentCoder<WebCore::FileChooserSettings> {
460     static void encode(Encoder&, const WebCore::FileChooserSettings&);
461     static bool decode(Decoder&, WebCore::FileChooserSettings&);
462 };
463
464 template<> struct ArgumentCoder<WebCore::GrammarDetail> {
465     static void encode(Encoder&, const WebCore::GrammarDetail&);
466     static std::optional<WebCore::GrammarDetail> decode(Decoder&);
467 };
468
469 template<> struct ArgumentCoder<WebCore::TextCheckingRequestData> {
470     static void encode(Encoder&, const WebCore::TextCheckingRequestData&);
471     static bool decode(Decoder&, WebCore::TextCheckingRequestData&);
472 };
473
474 template<> struct ArgumentCoder<WebCore::TextCheckingResult> {
475     static void encode(Encoder&, const WebCore::TextCheckingResult&);
476     static std::optional<WebCore::TextCheckingResult> decode(Decoder&);
477 };
478
479 template<> struct ArgumentCoder<WebCore::UserStyleSheet> {
480     static void encode(Encoder&, const WebCore::UserStyleSheet&);
481     static bool decode(Decoder&, WebCore::UserStyleSheet&);
482 };
483
484 template<> struct ArgumentCoder<WebCore::ScrollableAreaParameters> {
485     static void encode(Encoder&, const WebCore::ScrollableAreaParameters&);
486     static bool decode(Decoder&, WebCore::ScrollableAreaParameters&);
487 };
488
489 template<> struct ArgumentCoder<WebCore::FixedPositionViewportConstraints> {
490     static void encode(Encoder&, const WebCore::FixedPositionViewportConstraints&);
491     static bool decode(Decoder&, WebCore::FixedPositionViewportConstraints&);
492 };
493
494 template<> struct ArgumentCoder<WebCore::StickyPositionViewportConstraints> {
495     static void encode(Encoder&, const WebCore::StickyPositionViewportConstraints&);
496     static bool decode(Decoder&, WebCore::StickyPositionViewportConstraints&);
497 };
498
499 #if !USE(COORDINATED_GRAPHICS)
500 template<> struct ArgumentCoder<WebCore::FilterOperations> {
501     static void encode(Encoder&, const WebCore::FilterOperations&);
502     static bool decode(Decoder&, WebCore::FilterOperations&);
503 };
504     
505 template<> struct ArgumentCoder<WebCore::FilterOperation> {
506     static void encode(Encoder&, const WebCore::FilterOperation&);
507 };
508 bool decodeFilterOperation(Decoder&, RefPtr<WebCore::FilterOperation>&);
509 #endif
510
511 template<> struct ArgumentCoder<WebCore::BlobPart> {
512     static void encode(Encoder&, const WebCore::BlobPart&);
513     static std::optional<WebCore::BlobPart> decode(Decoder&);
514 };
515
516 #if ENABLE(CONTENT_FILTERING)
517 template<> struct ArgumentCoder<WebCore::ContentFilterUnblockHandler> {
518     static void encode(Encoder&, const WebCore::ContentFilterUnblockHandler&);
519     static bool decode(Decoder&, WebCore::ContentFilterUnblockHandler&);
520 };
521 #endif
522
523 #if ENABLE(MEDIA_SESSION)
524 template<> struct ArgumentCoder<WebCore::MediaSessionMetadata> {
525     static void encode(Encoder&, const WebCore::MediaSessionMetadata&);
526     static bool decode(Decoder&, WebCore::MediaSessionMetadata&);
527 };
528 #endif
529
530 template<> struct ArgumentCoder<WebCore::TextIndicatorData> {
531     static void encode(Encoder&, const WebCore::TextIndicatorData&);
532     static std::optional<WebCore::TextIndicatorData> decode(Decoder&);
533 };
534
535 template<> struct ArgumentCoder<WebCore::DictionaryPopupInfo> {
536     static void encode(Encoder&, const WebCore::DictionaryPopupInfo&);
537     static bool decode(Decoder&, WebCore::DictionaryPopupInfo&);
538 };
539
540 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
541 template<> struct ArgumentCoder<WebCore::MediaPlaybackTargetContext> {
542     static void encode(Encoder&, const WebCore::MediaPlaybackTargetContext&);
543     static bool decode(Decoder&, WebCore::MediaPlaybackTargetContext&);
544     static void encodePlatformData(Encoder&, const WebCore::MediaPlaybackTargetContext&);
545     static bool decodePlatformData(Decoder&, WebCore::MediaPlaybackTargetContext&);
546 };
547 #endif
548
549 template<> struct ArgumentCoder<WebCore::RecentSearch> {
550     static void encode(Encoder&, const WebCore::RecentSearch&);
551     static std::optional<WebCore::RecentSearch> decode(Decoder&);
552 };
553
554 template<> struct ArgumentCoder<WebCore::ExceptionDetails> {
555     static void encode(Encoder&, const WebCore::ExceptionDetails&);
556     static bool decode(Decoder&, WebCore::ExceptionDetails&);
557 };
558
559 template<> struct ArgumentCoder<WebCore::ResourceLoadStatistics> {
560     static void encode(Encoder&, const WebCore::ResourceLoadStatistics&);
561     static std::optional<WebCore::ResourceLoadStatistics> decode(Decoder&);
562 };
563
564 #if ENABLE(APPLE_PAY)
565
566 template<> struct ArgumentCoder<WebCore::Payment> {
567     static void encode(Encoder&, const WebCore::Payment&);
568     static bool decode(Decoder&, WebCore::Payment&);
569 };
570
571 template<> struct ArgumentCoder<WebCore::PaymentAuthorizationResult> {
572     static void encode(Encoder&, const WebCore::PaymentAuthorizationResult&);
573     static std::optional<WebCore::PaymentAuthorizationResult> decode(Decoder&);
574 };
575
576 template<> struct ArgumentCoder<WebCore::PaymentContact> {
577     static void encode(Encoder&, const WebCore::PaymentContact&);
578     static bool decode(Decoder&, WebCore::PaymentContact&);
579 };
580
581 template<> struct ArgumentCoder<WebCore::PaymentError> {
582     static void encode(Encoder&, const WebCore::PaymentError&);
583     static std::optional<WebCore::PaymentError> decode(Decoder&);
584 };
585
586 template<> struct ArgumentCoder<WebCore::PaymentMerchantSession> {
587     static void encode(Encoder&, const WebCore::PaymentMerchantSession&);
588     static bool decode(Decoder&, WebCore::PaymentMerchantSession&);
589 };
590
591 template<> struct ArgumentCoder<WebCore::PaymentMethod> {
592     static void encode(Encoder&, const WebCore::PaymentMethod&);
593     static bool decode(Decoder&, WebCore::PaymentMethod&);
594 };
595
596 template<> struct ArgumentCoder<WebCore::PaymentMethodUpdate> {
597     static void encode(Encoder&, const WebCore::PaymentMethodUpdate&);
598     static std::optional<WebCore::PaymentMethodUpdate> decode(Decoder&);
599 };
600
601 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest> {
602     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest&);
603     static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest&);
604 };
605
606 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ContactFields> {
607     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::ContactFields&);
608     static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::ContactFields&);
609 };
610
611 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::LineItem> {
612     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::LineItem&);
613     static std::optional<WebCore::ApplePaySessionPaymentRequest::LineItem> decode(Decoder&);
614 };
615
616 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities> {
617     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities&);
618     static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities&);
619 };
620
621 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> {
622     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&);
623     static std::optional<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> decode(Decoder&);
624 };
625
626 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> {
627     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems&);
628     static std::optional<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> decode(Decoder&);
629 };
630
631 template<> struct ArgumentCoder<WebCore::ShippingContactUpdate> {
632     static void encode(Encoder&, const WebCore::ShippingContactUpdate&);
633     static std::optional<WebCore::ShippingContactUpdate> decode(Decoder&);
634 };
635
636 template<> struct ArgumentCoder<WebCore::ShippingMethodUpdate> {
637     static void encode(Encoder&, const WebCore::ShippingMethodUpdate&);
638     static std::optional<WebCore::ShippingMethodUpdate> decode(Decoder&);
639 };
640
641 #endif
642
643 #if ENABLE(MEDIA_STREAM)
644 template<> struct ArgumentCoder<WebCore::MediaConstraints> {
645     static void encode(Encoder&, const WebCore::MediaConstraints&);
646     static bool decode(Decoder&, WebCore::MediaConstraints&);
647 };
648 #endif
649
650 #if ENABLE(INDEXED_DATABASE)
651
652 template<> struct ArgumentCoder<WebCore::IDBKeyPath> {
653     static void encode(Encoder&, const WebCore::IDBKeyPath&);
654     static bool decode(Decoder&, WebCore::IDBKeyPath&);
655 };
656
657 #endif
658
659 #if ENABLE(SERVICE_WORKER)
660
661 template<> struct ArgumentCoder<WebCore::ServiceWorkerOrClientData> {
662     static void encode(Encoder&, const WebCore::ServiceWorkerOrClientData&);
663     static bool decode(Decoder&, WebCore::ServiceWorkerOrClientData&);
664 };
665
666 template<> struct ArgumentCoder<WebCore::ServiceWorkerOrClientIdentifier> {
667     static void encode(Encoder&, const WebCore::ServiceWorkerOrClientIdentifier&);
668     static bool decode(Decoder&, WebCore::ServiceWorkerOrClientIdentifier&);
669 };
670
671 #endif
672
673 #if ENABLE(CSS_SCROLL_SNAP)
674
675 template<> struct ArgumentCoder<WebCore::ScrollOffsetRange<float>> {
676     static void encode(Encoder&, const WebCore::ScrollOffsetRange<float>&);
677     static std::optional<WebCore::ScrollOffsetRange<float>> decode(Decoder&);
678 };
679
680 #endif
681
682 template<> struct ArgumentCoder<WebCore::MediaSelectionOption> {
683     static void encode(Encoder&, const WebCore::MediaSelectionOption&);
684     static std::optional<WebCore::MediaSelectionOption> decode(Decoder&);
685 };
686
687 template<> struct ArgumentCoder<WebCore::PromisedBlobInfo> {
688     static void encode(Encoder&, const WebCore::PromisedBlobInfo&);
689     static bool decode(Decoder&, WebCore::PromisedBlobInfo&);
690 };
691
692 } // namespace IPC
693
694 namespace WTF {
695
696 template<> struct EnumTraits<WebCore::ColorSpace> {
697     using values = EnumValues<
698     WebCore::ColorSpace,
699     WebCore::ColorSpace::ColorSpaceSRGB,
700     WebCore::ColorSpace::ColorSpaceLinearRGB,
701     WebCore::ColorSpace::ColorSpaceDisplayP3
702     >;
703 };
704
705 template<> struct EnumTraits<WebCore::HasInsecureContent> {
706     using values = EnumValues<
707         WebCore::HasInsecureContent,
708         WebCore::HasInsecureContent::No,
709         WebCore::HasInsecureContent::Yes
710     >;
711 };
712
713 template<> struct EnumTraits<WebCore::AutoplayEvent> {
714     using values = EnumValues<
715         WebCore::AutoplayEvent,
716         WebCore::AutoplayEvent::DidPreventMediaFromPlaying,
717         WebCore::AutoplayEvent::DidPlayMediaPreventedFromPlaying,
718         WebCore::AutoplayEvent::DidAutoplayMediaPastThresholdWithoutUserInterference,
719         WebCore::AutoplayEvent::UserDidInterfereWithPlayback
720     >;
721 };
722
723 template<> struct EnumTraits<WebCore::ShouldSample> {
724     using values = EnumValues<
725         WebCore::ShouldSample,
726         WebCore::ShouldSample::No,
727         WebCore::ShouldSample::Yes
728     >;
729 };
730
731 template<> struct EnumTraits<WebCore::NetworkLoadPriority> {
732     using values = EnumValues<
733         WebCore::NetworkLoadPriority,
734         WebCore::NetworkLoadPriority::Low,
735         WebCore::NetworkLoadPriority::Medium,
736         WebCore::NetworkLoadPriority::High
737     >;
738 };
739
740 template<> struct EnumTraits<WebCore::NotificationDirection> {
741     using values = EnumValues<
742         WebCore::NotificationDirection,
743         WebCore::NotificationDirection::Auto,
744         WebCore::NotificationDirection::Ltr,
745         WebCore::NotificationDirection::Rtl
746     >;
747 };
748
749 #if ENABLE(INDEXED_DATABASE)
750 template<> struct EnumTraits<WebCore::IndexedDB::GetAllType> {
751     using values = EnumValues<
752         WebCore::IndexedDB::GetAllType,
753         WebCore::IndexedDB::GetAllType::Keys,
754         WebCore::IndexedDB::GetAllType::Values
755     >;
756 };
757 #endif
758
759 #if ENABLE(MEDIA_STREAM)
760 template<> struct EnumTraits<WebCore::RealtimeMediaSource::Type> {
761     using values = EnumValues<
762         WebCore::RealtimeMediaSource::Type,
763         WebCore::RealtimeMediaSource::Type::None,
764         WebCore::RealtimeMediaSource::Type::Audio,
765         WebCore::RealtimeMediaSource::Type::Video
766     >;
767 };
768 #endif
769
770 template<> struct EnumTraits<WebCore::MediaSelectionOption::Type> {
771     using values = EnumValues<
772         WebCore::MediaSelectionOption::Type,
773         WebCore::MediaSelectionOption::Type::Regular,
774         WebCore::MediaSelectionOption::Type::LegibleOff,
775         WebCore::MediaSelectionOption::Type::LegibleAuto
776     >;
777 };
778
779 template <> struct EnumTraits<WebCore::StoredCredentialsPolicy> {
780     using values = EnumValues<
781         WebCore::StoredCredentialsPolicy,
782         WebCore::StoredCredentialsPolicy::DoNotUse,
783         WebCore::StoredCredentialsPolicy::Use
784     >;
785 };
786
787 template <> struct EnumTraits<WebCore::WorkerType> {
788     using values = EnumValues<
789         WebCore::WorkerType,
790         WebCore::WorkerType::Classic,
791         WebCore::WorkerType::Module
792     >;
793 };
794
795 } // namespace WTF