1/* 2 * Copyright (C) 2010, 2011 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#ifndef WebCoreArgumentCoders_h 27#define WebCoreArgumentCoders_h 28 29#include "ArgumentCoders.h" 30 31namespace WebCore { 32class AffineTransform; 33class AuthenticationChallenge; 34class BlobPart; 35class CertificateInfo; 36class Color; 37class Credential; 38class CubicBezierTimingFunction; 39class Cursor; 40class DatabaseDetails; 41class FilterOperation; 42class FilterOperations; 43class FloatPoint; 44class FloatPoint3D; 45class FloatRect; 46class FloatSize; 47class FixedPositionViewportConstraints; 48class HTTPHeaderMap; 49class IDBKeyPath; 50class IntPoint; 51class IntRect; 52class IntSize; 53class KeyframeValueList; 54class LinearTimingFunction; 55class Notification; 56class ProtectionSpace; 57class Region; 58class ResourceError; 59class ResourceRequest; 60class ResourceResponse; 61class SessionID; 62class StepsTimingFunction; 63class StickyPositionViewportConstraints; 64class TextCheckingRequestData; 65class TransformationMatrix; 66class UserStyleSheet; 67class UserScript; 68class URL; 69struct CompositionUnderline; 70struct Cookie; 71struct DictationAlternative; 72struct FileChooserSettings; 73struct IDBDatabaseMetadata; 74struct IDBGetResult; 75struct IDBIndexMetadata; 76struct IDBKeyData; 77struct IDBKeyRangeData; 78struct IDBObjectStoreMetadata; 79struct Length; 80struct GrammarDetail; 81struct MimeClassInfo; 82struct PasteboardImage; 83struct PasteboardWebContent; 84struct PluginInfo; 85struct ScrollableAreaParameters; 86struct TextCheckingResult; 87struct ViewportAttributes; 88struct WindowFeatures; 89} 90 91#if PLATFORM(COCOA) 92namespace WebCore { 93struct KeypressCommand; 94} 95#endif 96 97#if PLATFORM(IOS) 98namespace WebCore { 99class FloatQuad; 100class SelectionRect; 101struct Highlight; 102struct PasteboardImage; 103struct PasteboardWebContent; 104struct ViewportArguments; 105} 106#endif 107 108#if USE(CONTENT_FILTERING) 109namespace WebCore { 110class ContentFilter; 111} 112#endif 113 114namespace IPC { 115 116template<> struct ArgumentCoder<WebCore::AffineTransform> { 117 static void encode(ArgumentEncoder&, const WebCore::AffineTransform&); 118 static bool decode(ArgumentDecoder&, WebCore::AffineTransform&); 119}; 120 121template<> struct ArgumentCoder<WebCore::TransformationMatrix> { 122 static void encode(ArgumentEncoder&, const WebCore::TransformationMatrix&); 123 static bool decode(ArgumentDecoder&, WebCore::TransformationMatrix&); 124}; 125 126template<> struct ArgumentCoder<WebCore::LinearTimingFunction> { 127 static void encode(ArgumentEncoder&, const WebCore::LinearTimingFunction&); 128 static bool decode(ArgumentDecoder&, WebCore::LinearTimingFunction&); 129}; 130 131template<> struct ArgumentCoder<WebCore::CubicBezierTimingFunction> { 132 static void encode(ArgumentEncoder&, const WebCore::CubicBezierTimingFunction&); 133 static bool decode(ArgumentDecoder&, WebCore::CubicBezierTimingFunction&); 134}; 135 136template<> struct ArgumentCoder<WebCore::StepsTimingFunction> { 137 static void encode(ArgumentEncoder&, const WebCore::StepsTimingFunction&); 138 static bool decode(ArgumentDecoder&, WebCore::StepsTimingFunction&); 139}; 140 141template<> struct ArgumentCoder<WebCore::CertificateInfo> { 142 static void encode(ArgumentEncoder&, const WebCore::CertificateInfo&); 143 static bool decode(ArgumentDecoder&, WebCore::CertificateInfo&); 144}; 145 146template<> struct ArgumentCoder<WebCore::FloatPoint> { 147 static void encode(ArgumentEncoder&, const WebCore::FloatPoint&); 148 static bool decode(ArgumentDecoder&, WebCore::FloatPoint&); 149}; 150 151template<> struct ArgumentCoder<WebCore::FloatPoint3D> { 152 static void encode(ArgumentEncoder&, const WebCore::FloatPoint3D&); 153 static bool decode(ArgumentDecoder&, WebCore::FloatPoint3D&); 154}; 155 156template<> struct ArgumentCoder<WebCore::FloatRect> { 157 static void encode(ArgumentEncoder&, const WebCore::FloatRect&); 158 static bool decode(ArgumentDecoder&, WebCore::FloatRect&); 159}; 160 161template<> struct ArgumentCoder<WebCore::FloatSize> { 162 static void encode(ArgumentEncoder&, const WebCore::FloatSize&); 163 static bool decode(ArgumentDecoder&, WebCore::FloatSize&); 164}; 165 166#if PLATFORM(IOS) 167template<> struct ArgumentCoder<WebCore::FloatQuad> { 168 static void encode(ArgumentEncoder&, const WebCore::FloatQuad&); 169 static bool decode(ArgumentDecoder&, WebCore::FloatQuad&); 170}; 171 172template<> struct ArgumentCoder<WebCore::ViewportArguments> { 173 static void encode(ArgumentEncoder&, const WebCore::ViewportArguments&); 174 static bool decode(ArgumentDecoder&, WebCore::ViewportArguments&); 175}; 176#endif // PLATFORM(IOS) 177 178template<> struct ArgumentCoder<WebCore::IntPoint> { 179 static void encode(ArgumentEncoder&, const WebCore::IntPoint&); 180 static bool decode(ArgumentDecoder&, WebCore::IntPoint&); 181}; 182 183template<> struct ArgumentCoder<WebCore::IntRect> { 184 static void encode(ArgumentEncoder&, const WebCore::IntRect&); 185 static bool decode(ArgumentDecoder&, WebCore::IntRect&); 186}; 187 188template<> struct ArgumentCoder<WebCore::IntSize> { 189 static void encode(ArgumentEncoder&, const WebCore::IntSize&); 190 static bool decode(ArgumentDecoder&, WebCore::IntSize&); 191}; 192 193template<> struct ArgumentCoder<WebCore::Region> { 194 static void encode(ArgumentEncoder&, const WebCore::Region&); 195 static bool decode(ArgumentDecoder&, WebCore::Region&); 196}; 197 198template<> struct ArgumentCoder<WebCore::Length> { 199 static void encode(ArgumentEncoder&, const WebCore::Length&); 200 static bool decode(ArgumentDecoder&, WebCore::Length&); 201}; 202 203template<> struct ArgumentCoder<WebCore::ViewportAttributes> { 204 static void encode(ArgumentEncoder&, const WebCore::ViewportAttributes&); 205 static bool decode(ArgumentDecoder&, WebCore::ViewportAttributes&); 206}; 207 208template<> struct ArgumentCoder<WebCore::MimeClassInfo> { 209 static void encode(ArgumentEncoder&, const WebCore::MimeClassInfo&); 210 static bool decode(ArgumentDecoder&, WebCore::MimeClassInfo&); 211}; 212 213template<> struct ArgumentCoder<WebCore::PluginInfo> { 214 static void encode(ArgumentEncoder&, const WebCore::PluginInfo&); 215 static bool decode(ArgumentDecoder&, WebCore::PluginInfo&); 216}; 217 218template<> struct ArgumentCoder<WebCore::HTTPHeaderMap> { 219 static void encode(ArgumentEncoder&, const WebCore::HTTPHeaderMap&); 220 static bool decode(ArgumentDecoder&, WebCore::HTTPHeaderMap&); 221}; 222 223template<> struct ArgumentCoder<WebCore::AuthenticationChallenge> { 224 static void encode(ArgumentEncoder&, const WebCore::AuthenticationChallenge&); 225 static bool decode(ArgumentDecoder&, WebCore::AuthenticationChallenge&); 226}; 227 228template<> struct ArgumentCoder<WebCore::ProtectionSpace> { 229 static void encode(ArgumentEncoder&, const WebCore::ProtectionSpace&); 230 static bool decode(ArgumentDecoder&, WebCore::ProtectionSpace&); 231 static void encodePlatformData(ArgumentEncoder&, const WebCore::ProtectionSpace&); 232 static bool decodePlatformData(ArgumentDecoder&, WebCore::ProtectionSpace&); 233}; 234 235template<> struct ArgumentCoder<WebCore::Credential> { 236 static void encode(ArgumentEncoder&, const WebCore::Credential&); 237 static bool decode(ArgumentDecoder&, WebCore::Credential&); 238}; 239 240template<> struct ArgumentCoder<WebCore::Cursor> { 241 static void encode(ArgumentEncoder&, const WebCore::Cursor&); 242 static bool decode(ArgumentDecoder&, WebCore::Cursor&); 243}; 244 245template<> struct ArgumentCoder<WebCore::ResourceRequest> { 246#if PLATFORM(COCOA) 247 static const bool kShouldSerializeWebCoreData = false; 248#else 249 static const bool kShouldSerializeWebCoreData = true; 250#endif 251 252 static void encode(ArgumentEncoder&, const WebCore::ResourceRequest&); 253 static bool decode(ArgumentDecoder&, WebCore::ResourceRequest&); 254 static void encodePlatformData(ArgumentEncoder&, const WebCore::ResourceRequest&); 255 static bool decodePlatformData(ArgumentDecoder&, WebCore::ResourceRequest&); 256}; 257 258template<> struct ArgumentCoder<WebCore::ResourceResponse> { 259 static void encode(ArgumentEncoder&, const WebCore::ResourceResponse&); 260 static bool decode(ArgumentDecoder&, WebCore::ResourceResponse&); 261 static void encodePlatformData(ArgumentEncoder&, const WebCore::ResourceResponse&); 262 static bool decodePlatformData(ArgumentDecoder&, WebCore::ResourceResponse&); 263}; 264 265template<> struct ArgumentCoder<WebCore::ResourceError> { 266#if PLATFORM(COCOA) 267 static const bool kShouldSerializeWebCoreData = false; 268#else 269 static const bool kShouldSerializeWebCoreData = true; 270#endif 271 272 static void encode(ArgumentEncoder&, const WebCore::ResourceError&); 273 static bool decode(ArgumentDecoder&, WebCore::ResourceError&); 274 static void encodePlatformData(ArgumentEncoder&, const WebCore::ResourceError&); 275 static bool decodePlatformData(ArgumentDecoder&, WebCore::ResourceError&); 276}; 277 278template<> struct ArgumentCoder<WebCore::WindowFeatures> { 279 static void encode(ArgumentEncoder&, const WebCore::WindowFeatures&); 280 static bool decode(ArgumentDecoder&, WebCore::WindowFeatures&); 281}; 282 283template<> struct ArgumentCoder<WebCore::Color> { 284 static void encode(ArgumentEncoder&, const WebCore::Color&); 285 static bool decode(ArgumentDecoder&, WebCore::Color&); 286}; 287 288#if PLATFORM(COCOA) 289template<> struct ArgumentCoder<WebCore::KeypressCommand> { 290 static void encode(ArgumentEncoder&, const WebCore::KeypressCommand&); 291 static bool decode(ArgumentDecoder&, WebCore::KeypressCommand&); 292}; 293#endif 294 295#if PLATFORM(IOS) 296template<> struct ArgumentCoder<WebCore::SelectionRect> { 297 static void encode(ArgumentEncoder&, const WebCore::SelectionRect&); 298 static bool decode(ArgumentDecoder&, WebCore::SelectionRect&); 299}; 300 301template<> struct ArgumentCoder<WebCore::Highlight> { 302 static void encode(ArgumentEncoder&, const WebCore::Highlight&); 303 static bool decode(ArgumentDecoder&, WebCore::Highlight&); 304}; 305 306template<> struct ArgumentCoder<WebCore::PasteboardWebContent> { 307 static void encode(ArgumentEncoder&, const WebCore::PasteboardWebContent&); 308 static bool decode(ArgumentDecoder&, WebCore::PasteboardWebContent&); 309}; 310 311template<> struct ArgumentCoder<WebCore::PasteboardImage> { 312 static void encode(ArgumentEncoder&, const WebCore::PasteboardImage&); 313 static bool decode(ArgumentDecoder&, WebCore::PasteboardImage&); 314}; 315#endif 316 317template<> struct ArgumentCoder<WebCore::CompositionUnderline> { 318 static void encode(ArgumentEncoder&, const WebCore::CompositionUnderline&); 319 static bool decode(ArgumentDecoder&, WebCore::CompositionUnderline&); 320}; 321 322template<> struct ArgumentCoder<WebCore::Cookie> { 323 static void encode(ArgumentEncoder&, const WebCore::Cookie&); 324 static bool decode(ArgumentDecoder&, WebCore::Cookie&); 325}; 326 327template<> struct ArgumentCoder<WebCore::DatabaseDetails> { 328 static void encode(ArgumentEncoder&, const WebCore::DatabaseDetails&); 329 static bool decode(ArgumentDecoder&, WebCore::DatabaseDetails&); 330}; 331 332template<> struct ArgumentCoder<WebCore::DictationAlternative> { 333 static void encode(ArgumentEncoder&, const WebCore::DictationAlternative&); 334 static bool decode(ArgumentDecoder&, WebCore::DictationAlternative&); 335}; 336 337template<> struct ArgumentCoder<WebCore::FileChooserSettings> { 338 static void encode(ArgumentEncoder&, const WebCore::FileChooserSettings&); 339 static bool decode(ArgumentDecoder&, WebCore::FileChooserSettings&); 340}; 341 342template<> struct ArgumentCoder<WebCore::GrammarDetail> { 343 static void encode(ArgumentEncoder&, const WebCore::GrammarDetail&); 344 static bool decode(ArgumentDecoder&, WebCore::GrammarDetail&); 345}; 346 347template<> struct ArgumentCoder<WebCore::TextCheckingRequestData> { 348 static void encode(ArgumentEncoder&, const WebCore::TextCheckingRequestData&); 349 static bool decode(ArgumentDecoder&, WebCore::TextCheckingRequestData&); 350}; 351 352template<> struct ArgumentCoder<WebCore::TextCheckingResult> { 353 static void encode(ArgumentEncoder&, const WebCore::TextCheckingResult&); 354 static bool decode(ArgumentDecoder&, WebCore::TextCheckingResult&); 355}; 356 357template<> struct ArgumentCoder<WebCore::URL> { 358 static void encode(ArgumentEncoder&, const WebCore::URL&); 359 static bool decode(ArgumentDecoder&, WebCore::URL&); 360}; 361 362template<> struct ArgumentCoder<WebCore::UserStyleSheet> { 363 static void encode(ArgumentEncoder&, const WebCore::UserStyleSheet&); 364 static bool decode(ArgumentDecoder&, WebCore::UserStyleSheet&); 365}; 366 367template<> struct ArgumentCoder<WebCore::UserScript> { 368 static void encode(ArgumentEncoder&, const WebCore::UserScript&); 369 static bool decode(ArgumentDecoder&, WebCore::UserScript&); 370}; 371 372template<> struct ArgumentCoder<WebCore::ScrollableAreaParameters> { 373 static void encode(ArgumentEncoder&, const WebCore::ScrollableAreaParameters&); 374 static bool decode(ArgumentDecoder&, WebCore::ScrollableAreaParameters&); 375}; 376 377template<> struct ArgumentCoder<WebCore::FixedPositionViewportConstraints> { 378 static void encode(ArgumentEncoder&, const WebCore::FixedPositionViewportConstraints&); 379 static bool decode(ArgumentDecoder&, WebCore::FixedPositionViewportConstraints&); 380}; 381 382template<> struct ArgumentCoder<WebCore::StickyPositionViewportConstraints> { 383 static void encode(ArgumentEncoder&, const WebCore::StickyPositionViewportConstraints&); 384 static bool decode(ArgumentDecoder&, WebCore::StickyPositionViewportConstraints&); 385}; 386 387#if ENABLE(CSS_FILTERS) && !USE(COORDINATED_GRAPHICS) 388template<> struct ArgumentCoder<WebCore::FilterOperations> { 389 static void encode(ArgumentEncoder&, const WebCore::FilterOperations&); 390 static bool decode(ArgumentDecoder&, WebCore::FilterOperations&); 391}; 392 393template<> struct ArgumentCoder<WebCore::FilterOperation> { 394 static void encode(ArgumentEncoder&, const WebCore::FilterOperation&); 395}; 396bool decodeFilterOperation(ArgumentDecoder&, RefPtr<WebCore::FilterOperation>&); 397#endif 398 399#if ENABLE(INDEXED_DATABASE) 400template<> struct ArgumentCoder<WebCore::IDBDatabaseMetadata> { 401 static void encode(ArgumentEncoder&, const WebCore::IDBDatabaseMetadata&); 402 static bool decode(ArgumentDecoder&, WebCore::IDBDatabaseMetadata&); 403}; 404 405template<> struct ArgumentCoder<WebCore::IDBGetResult> { 406 static void encode(ArgumentEncoder&, const WebCore::IDBGetResult&); 407 static bool decode(ArgumentDecoder&, WebCore::IDBGetResult&); 408}; 409 410template<> struct ArgumentCoder<WebCore::IDBIndexMetadata> { 411 static void encode(ArgumentEncoder&, const WebCore::IDBIndexMetadata&); 412 static bool decode(ArgumentDecoder&, WebCore::IDBIndexMetadata&); 413}; 414 415template<> struct ArgumentCoder<WebCore::IDBKeyData> { 416 static void encode(ArgumentEncoder&, const WebCore::IDBKeyData&); 417 static bool decode(ArgumentDecoder&, WebCore::IDBKeyData&); 418}; 419 420template<> struct ArgumentCoder<WebCore::IDBKeyPath> { 421 static void encode(ArgumentEncoder&, const WebCore::IDBKeyPath&); 422 static bool decode(ArgumentDecoder&, WebCore::IDBKeyPath&); 423}; 424 425template<> struct ArgumentCoder<WebCore::IDBKeyRangeData> { 426 static void encode(ArgumentEncoder&, const WebCore::IDBKeyRangeData&); 427 static bool decode(ArgumentDecoder&, WebCore::IDBKeyRangeData&); 428}; 429 430template<> struct ArgumentCoder<WebCore::IDBObjectStoreMetadata> { 431 static void encode(ArgumentEncoder&, const WebCore::IDBObjectStoreMetadata&); 432 static bool decode(ArgumentDecoder&, WebCore::IDBObjectStoreMetadata&); 433}; 434 435#endif // ENABLE(INDEXED_DATABASE) 436 437template<> struct ArgumentCoder<WebCore::SessionID> { 438 static void encode(ArgumentEncoder&, const WebCore::SessionID&); 439 static bool decode(ArgumentDecoder&, WebCore::SessionID&); 440}; 441 442template<> struct ArgumentCoder<WebCore::BlobPart> { 443 static void encode(ArgumentEncoder&, const WebCore::BlobPart&); 444 static bool decode(ArgumentDecoder&, WebCore::BlobPart&); 445}; 446 447#if USE(CONTENT_FILTERING) 448template<> struct ArgumentCoder<WebCore::ContentFilter> { 449 static void encode(ArgumentEncoder&, const WebCore::ContentFilter&); 450 static bool decode(ArgumentDecoder&, WebCore::ContentFilter&); 451}; 452#endif 453 454} // namespace IPC 455 456#endif // WebCoreArgumentCoders_h 457