1/* 2 * Copyright (C) 2010 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#ifndef WebPageMessages_h 26#define WebPageMessages_h 27 28#if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND)) 29 30#include "Arguments.h" 31#include "Connection.h" 32#include "MessageEncoder.h" 33#include "Plugin.h" 34#include "StringReference.h" 35#include <WebCore/GraphicsLayer.h> 36#include <WebCore/KeyboardEvent.h> 37#include <WebCore/PluginData.h> 38#include <utility> 39#include <wtf/HashMap.h> 40#include <wtf/ThreadSafeRefCounted.h> 41#include <wtf/Vector.h> 42#include <wtf/text/WTFString.h> 43 44namespace IPC { 45 class Connection; 46 class DummyType; 47 class MachPort; 48} 49 50namespace WTF { 51 class String; 52} 53 54namespace WebKit { 55 struct WebPreferencesStore; 56 class WebTouchEvent; 57} 58 59namespace Messages { 60namespace WebPage { 61 62static inline IPC::StringReference messageReceiverName() 63{ 64 return IPC::StringReference("WebPage"); 65} 66 67class LoadURL { 68public: 69 typedef std::tuple<String> DecodeType; 70 71 static IPC::StringReference receiverName() { return messageReceiverName(); } 72 static IPC::StringReference name() { return IPC::StringReference("LoadURL"); } 73 static const bool isSync = false; 74 75 explicit LoadURL(const String& url) 76 : m_arguments(url) 77 { 78 } 79 80 const std::tuple<const String&>& arguments() const 81 { 82 return m_arguments; 83 } 84 85private: 86 std::tuple<const String&> m_arguments; 87}; 88 89#if ENABLE(TOUCH_EVENTS) 90class LoadSomething { 91public: 92 typedef std::tuple<String> DecodeType; 93 94 static IPC::StringReference receiverName() { return messageReceiverName(); } 95 static IPC::StringReference name() { return IPC::StringReference("LoadSomething"); } 96 static const bool isSync = false; 97 98 explicit LoadSomething(const String& url) 99 : m_arguments(url) 100 { 101 } 102 103 const std::tuple<const String&>& arguments() const 104 { 105 return m_arguments; 106 } 107 108private: 109 std::tuple<const String&> m_arguments; 110}; 111#endif 112 113#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION)) 114class TouchEvent { 115public: 116 typedef std::tuple<WebKit::WebTouchEvent> DecodeType; 117 118 static IPC::StringReference receiverName() { return messageReceiverName(); } 119 static IPC::StringReference name() { return IPC::StringReference("TouchEvent"); } 120 static const bool isSync = false; 121 122 explicit TouchEvent(const WebKit::WebTouchEvent& event) 123 : m_arguments(event) 124 { 125 } 126 127 const std::tuple<const WebKit::WebTouchEvent&>& arguments() const 128 { 129 return m_arguments; 130 } 131 132private: 133 std::tuple<const WebKit::WebTouchEvent&> m_arguments; 134}; 135#endif 136 137#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION)) 138class AddEvent { 139public: 140 typedef std::tuple<WebKit::WebTouchEvent> DecodeType; 141 142 static IPC::StringReference receiverName() { return messageReceiverName(); } 143 static IPC::StringReference name() { return IPC::StringReference("AddEvent"); } 144 static const bool isSync = false; 145 146 explicit AddEvent(const WebKit::WebTouchEvent& event) 147 : m_arguments(event) 148 { 149 } 150 151 const std::tuple<const WebKit::WebTouchEvent&>& arguments() const 152 { 153 return m_arguments; 154 } 155 156private: 157 std::tuple<const WebKit::WebTouchEvent&> m_arguments; 158}; 159#endif 160 161#if ENABLE(TOUCH_EVENTS) 162class LoadSomethingElse { 163public: 164 typedef std::tuple<String> DecodeType; 165 166 static IPC::StringReference receiverName() { return messageReceiverName(); } 167 static IPC::StringReference name() { return IPC::StringReference("LoadSomethingElse"); } 168 static const bool isSync = false; 169 170 explicit LoadSomethingElse(const String& url) 171 : m_arguments(url) 172 { 173 } 174 175 const std::tuple<const String&>& arguments() const 176 { 177 return m_arguments; 178 } 179 180private: 181 std::tuple<const String&> m_arguments; 182}; 183#endif 184 185class DidReceivePolicyDecision { 186public: 187 typedef std::tuple<uint64_t, uint64_t, uint32_t> DecodeType; 188 189 static IPC::StringReference receiverName() { return messageReceiverName(); } 190 static IPC::StringReference name() { return IPC::StringReference("DidReceivePolicyDecision"); } 191 static const bool isSync = false; 192 193 DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction) 194 : m_arguments(frameID, listenerID, policyAction) 195 { 196 } 197 198 const std::tuple<uint64_t, uint64_t, uint32_t>& arguments() const 199 { 200 return m_arguments; 201 } 202 203private: 204 std::tuple<uint64_t, uint64_t, uint32_t> m_arguments; 205}; 206 207class Close { 208public: 209 typedef std::tuple<> DecodeType; 210 211 static IPC::StringReference receiverName() { return messageReceiverName(); } 212 static IPC::StringReference name() { return IPC::StringReference("Close"); } 213 static const bool isSync = false; 214 215 const std::tuple<>& arguments() const 216 { 217 return m_arguments; 218 } 219 220private: 221 std::tuple<> m_arguments; 222}; 223 224class PreferencesDidChange { 225public: 226 typedef std::tuple<WebKit::WebPreferencesStore> DecodeType; 227 228 static IPC::StringReference receiverName() { return messageReceiverName(); } 229 static IPC::StringReference name() { return IPC::StringReference("PreferencesDidChange"); } 230 static const bool isSync = false; 231 232 explicit PreferencesDidChange(const WebKit::WebPreferencesStore& store) 233 : m_arguments(store) 234 { 235 } 236 237 const std::tuple<const WebKit::WebPreferencesStore&>& arguments() const 238 { 239 return m_arguments; 240 } 241 242private: 243 std::tuple<const WebKit::WebPreferencesStore&> m_arguments; 244}; 245 246class SendDoubleAndFloat { 247public: 248 typedef std::tuple<double, float> DecodeType; 249 250 static IPC::StringReference receiverName() { return messageReceiverName(); } 251 static IPC::StringReference name() { return IPC::StringReference("SendDoubleAndFloat"); } 252 static const bool isSync = false; 253 254 SendDoubleAndFloat(double d, float f) 255 : m_arguments(d, f) 256 { 257 } 258 259 const std::tuple<double, float>& arguments() const 260 { 261 return m_arguments; 262 } 263 264private: 265 std::tuple<double, float> m_arguments; 266}; 267 268class SendInts { 269public: 270 typedef std::tuple<Vector<uint64_t>, Vector<Vector<uint64_t>>> DecodeType; 271 272 static IPC::StringReference receiverName() { return messageReceiverName(); } 273 static IPC::StringReference name() { return IPC::StringReference("SendInts"); } 274 static const bool isSync = false; 275 276 SendInts(const Vector<uint64_t>& ints, const Vector<Vector<uint64_t>>& intVectors) 277 : m_arguments(ints, intVectors) 278 { 279 } 280 281 const std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&>& arguments() const 282 { 283 return m_arguments; 284 } 285 286private: 287 std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&> m_arguments; 288}; 289 290class CreatePlugin { 291public: 292 typedef std::tuple<uint64_t, WebKit::Plugin::Parameters> DecodeType; 293 294 static IPC::StringReference receiverName() { return messageReceiverName(); } 295 static IPC::StringReference name() { return IPC::StringReference("CreatePlugin"); } 296 static const bool isSync = true; 297 298 typedef IPC::Arguments<bool&> Reply; 299 CreatePlugin(uint64_t pluginInstanceID, const WebKit::Plugin::Parameters& parameters) 300 : m_arguments(pluginInstanceID, parameters) 301 { 302 } 303 304 const std::tuple<uint64_t, const WebKit::Plugin::Parameters&>& arguments() const 305 { 306 return m_arguments; 307 } 308 309private: 310 std::tuple<uint64_t, const WebKit::Plugin::Parameters&> m_arguments; 311}; 312 313class RunJavaScriptAlert { 314public: 315 typedef std::tuple<uint64_t, String> DecodeType; 316 317 static IPC::StringReference receiverName() { return messageReceiverName(); } 318 static IPC::StringReference name() { return IPC::StringReference("RunJavaScriptAlert"); } 319 static const bool isSync = true; 320 321 typedef IPC::Arguments<> Reply; 322 RunJavaScriptAlert(uint64_t frameID, const String& message) 323 : m_arguments(frameID, message) 324 { 325 } 326 327 const std::tuple<uint64_t, const String&>& arguments() const 328 { 329 return m_arguments; 330 } 331 332private: 333 std::tuple<uint64_t, const String&> m_arguments; 334}; 335 336class GetPlugins { 337public: 338 typedef std::tuple<bool> DecodeType; 339 340 static IPC::StringReference receiverName() { return messageReceiverName(); } 341 static IPC::StringReference name() { return IPC::StringReference("GetPlugins"); } 342 static const bool isSync = true; 343 344 typedef IPC::Arguments<Vector<WebCore::PluginInfo>&> Reply; 345 explicit GetPlugins(bool refresh) 346 : m_arguments(refresh) 347 { 348 } 349 350 const std::tuple<bool>& arguments() const 351 { 352 return m_arguments; 353 } 354 355private: 356 std::tuple<bool> m_arguments; 357}; 358 359class GetPluginProcessConnection { 360public: 361 typedef std::tuple<String> DecodeType; 362 363 static IPC::StringReference receiverName() { return messageReceiverName(); } 364 static IPC::StringReference name() { return IPC::StringReference("GetPluginProcessConnection"); } 365 static const bool isSync = true; 366 367 struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> { 368 DelayedReply(PassRefPtr<IPC::Connection>, std::unique_ptr<IPC::MessageEncoder>); 369 ~DelayedReply(); 370 371 bool send(const IPC::Connection::Handle& connectionHandle); 372 373 private: 374 RefPtr<IPC::Connection> m_connection; 375 std::unique_ptr<IPC::MessageEncoder> m_encoder; 376 }; 377 378 typedef IPC::Arguments<IPC::Connection::Handle&> Reply; 379 explicit GetPluginProcessConnection(const String& pluginPath) 380 : m_arguments(pluginPath) 381 { 382 } 383 384 const std::tuple<const String&>& arguments() const 385 { 386 return m_arguments; 387 } 388 389private: 390 std::tuple<const String&> m_arguments; 391}; 392 393class TestMultipleAttributes { 394public: 395 typedef std::tuple<> DecodeType; 396 397 static IPC::StringReference receiverName() { return messageReceiverName(); } 398 static IPC::StringReference name() { return IPC::StringReference("TestMultipleAttributes"); } 399 static const bool isSync = true; 400 401 struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> { 402 DelayedReply(PassRefPtr<IPC::Connection>, std::unique_ptr<IPC::MessageEncoder>); 403 ~DelayedReply(); 404 405 bool send(); 406 407 private: 408 RefPtr<IPC::Connection> m_connection; 409 std::unique_ptr<IPC::MessageEncoder> m_encoder; 410 }; 411 412 typedef IPC::Arguments<> Reply; 413 const std::tuple<>& arguments() const 414 { 415 return m_arguments; 416 } 417 418private: 419 std::tuple<> m_arguments; 420}; 421 422class TestParameterAttributes { 423public: 424 typedef std::tuple<uint64_t, double, double> DecodeType; 425 426 static IPC::StringReference receiverName() { return messageReceiverName(); } 427 static IPC::StringReference name() { return IPC::StringReference("TestParameterAttributes"); } 428 static const bool isSync = false; 429 430 TestParameterAttributes(uint64_t foo, double bar, double baz) 431 : m_arguments(foo, bar, baz) 432 { 433 } 434 435 const std::tuple<uint64_t, double, double>& arguments() const 436 { 437 return m_arguments; 438 } 439 440private: 441 std::tuple<uint64_t, double, double> m_arguments; 442}; 443 444class TemplateTest { 445public: 446 typedef std::tuple<HashMap<String, std::pair<String, uint64_t>>> DecodeType; 447 448 static IPC::StringReference receiverName() { return messageReceiverName(); } 449 static IPC::StringReference name() { return IPC::StringReference("TemplateTest"); } 450 static const bool isSync = false; 451 452 explicit TemplateTest(const HashMap<String, std::pair<String, uint64_t>>& a) 453 : m_arguments(a) 454 { 455 } 456 457 const std::tuple<const HashMap<String, std::pair<String, uint64_t>>&>& arguments() const 458 { 459 return m_arguments; 460 } 461 462private: 463 std::tuple<const HashMap<String, std::pair<String, uint64_t>>&> m_arguments; 464}; 465 466class SetVideoLayerID { 467public: 468 typedef std::tuple<WebCore::GraphicsLayer::PlatformLayerID> DecodeType; 469 470 static IPC::StringReference receiverName() { return messageReceiverName(); } 471 static IPC::StringReference name() { return IPC::StringReference("SetVideoLayerID"); } 472 static const bool isSync = false; 473 474 explicit SetVideoLayerID(const WebCore::GraphicsLayer::PlatformLayerID& videoLayerID) 475 : m_arguments(videoLayerID) 476 { 477 } 478 479 const std::tuple<const WebCore::GraphicsLayer::PlatformLayerID&>& arguments() const 480 { 481 return m_arguments; 482 } 483 484private: 485 std::tuple<const WebCore::GraphicsLayer::PlatformLayerID&> m_arguments; 486}; 487 488#if PLATFORM(MAC) 489class DidCreateWebProcessConnection { 490public: 491 typedef std::tuple<IPC::MachPort> DecodeType; 492 493 static IPC::StringReference receiverName() { return messageReceiverName(); } 494 static IPC::StringReference name() { return IPC::StringReference("DidCreateWebProcessConnection"); } 495 static const bool isSync = false; 496 497 explicit DidCreateWebProcessConnection(const IPC::MachPort& connectionIdentifier) 498 : m_arguments(connectionIdentifier) 499 { 500 } 501 502 const std::tuple<const IPC::MachPort&>& arguments() const 503 { 504 return m_arguments; 505 } 506 507private: 508 std::tuple<const IPC::MachPort&> m_arguments; 509}; 510#endif 511 512#if PLATFORM(MAC) 513class InterpretKeyEvent { 514public: 515 typedef std::tuple<uint32_t> DecodeType; 516 517 static IPC::StringReference receiverName() { return messageReceiverName(); } 518 static IPC::StringReference name() { return IPC::StringReference("InterpretKeyEvent"); } 519 static const bool isSync = true; 520 521 typedef IPC::Arguments<Vector<WebCore::KeypressCommand>&> Reply; 522 explicit InterpretKeyEvent(uint32_t type) 523 : m_arguments(type) 524 { 525 } 526 527 const std::tuple<uint32_t>& arguments() const 528 { 529 return m_arguments; 530 } 531 532private: 533 std::tuple<uint32_t> m_arguments; 534}; 535#endif 536 537#if ENABLE(DEPRECATED_FEATURE) 538class DeprecatedOperation { 539public: 540 typedef std::tuple<IPC::DummyType> DecodeType; 541 542 static IPC::StringReference receiverName() { return messageReceiverName(); } 543 static IPC::StringReference name() { return IPC::StringReference("DeprecatedOperation"); } 544 static const bool isSync = false; 545 546 explicit DeprecatedOperation(const IPC::DummyType& dummy) 547 : m_arguments(dummy) 548 { 549 } 550 551 const std::tuple<const IPC::DummyType&>& arguments() const 552 { 553 return m_arguments; 554 } 555 556private: 557 std::tuple<const IPC::DummyType&> m_arguments; 558}; 559#endif 560 561#if ENABLE(EXPERIMENTAL_FEATURE) 562class ExperimentalOperation { 563public: 564 typedef std::tuple<IPC::DummyType> DecodeType; 565 566 static IPC::StringReference receiverName() { return messageReceiverName(); } 567 static IPC::StringReference name() { return IPC::StringReference("ExperimentalOperation"); } 568 static const bool isSync = false; 569 570 explicit ExperimentalOperation(const IPC::DummyType& dummy) 571 : m_arguments(dummy) 572 { 573 } 574 575 const std::tuple<const IPC::DummyType&>& arguments() const 576 { 577 return m_arguments; 578 } 579 580private: 581 std::tuple<const IPC::DummyType&> m_arguments; 582}; 583#endif 584 585} // namespace WebPage 586} // namespace Messages 587 588#endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND)) 589 590#endif // WebPageMessages_h 591