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(NETSCAPE_PLUGIN_API) |
28 | |
29 | #include "ArgumentCoders.h" |
30 | #include "Connection.h" |
31 | #include <wtf/Forward.h> |
32 | #include <wtf/ThreadSafeRefCounted.h> |
33 | |
34 | namespace WebKit { |
35 | struct PluginCreationParameters; |
36 | } |
37 | |
38 | namespace Messages { |
39 | namespace WebProcessConnection { |
40 | |
41 | static inline IPC::StringReference messageReceiverName() |
42 | { |
43 | return IPC::StringReference("WebProcessConnection" ); |
44 | } |
45 | |
46 | class CreatePlugin { |
47 | public: |
48 | typedef std::tuple<const WebKit::PluginCreationParameters&> Arguments; |
49 | |
50 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
51 | static IPC::StringReference name() { return IPC::StringReference("CreatePlugin" ); } |
52 | static const bool isSync = true; |
53 | |
54 | using DelayedReply = CompletionHandler<void(bool creationResult, bool wantsWheelEvents, uint32_t remoteLayerClientID)>; |
55 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool creationResult, bool wantsWheelEvents, uint32_t remoteLayerClientID); |
56 | using Reply = std::tuple<bool&, bool&, uint32_t&>; |
57 | using ReplyArguments = std::tuple<bool, bool, uint32_t>; |
58 | explicit CreatePlugin(const WebKit::PluginCreationParameters& pluginCreationParameters) |
59 | : m_arguments(pluginCreationParameters) |
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 CreatePluginAsynchronously { |
73 | public: |
74 | typedef std::tuple<const WebKit::PluginCreationParameters&> Arguments; |
75 | |
76 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
77 | static IPC::StringReference name() { return IPC::StringReference("CreatePluginAsynchronously" ); } |
78 | static const bool isSync = false; |
79 | |
80 | explicit CreatePluginAsynchronously(const WebKit::PluginCreationParameters& pluginCreationParameters) |
81 | : m_arguments(pluginCreationParameters) |
82 | { |
83 | } |
84 | |
85 | const Arguments& arguments() const |
86 | { |
87 | return m_arguments; |
88 | } |
89 | |
90 | private: |
91 | Arguments m_arguments; |
92 | }; |
93 | |
94 | class DestroyPlugin { |
95 | public: |
96 | typedef std::tuple<uint64_t, bool> Arguments; |
97 | |
98 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
99 | static IPC::StringReference name() { return IPC::StringReference("DestroyPlugin" ); } |
100 | static const bool isSync = true; |
101 | |
102 | using DelayedReply = CompletionHandler<void()>; |
103 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&); |
104 | using Reply = std::tuple<>; |
105 | using ReplyArguments = std::tuple<>; |
106 | DestroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete) |
107 | : m_arguments(pluginInstanceID, asynchronousCreationIncomplete) |
108 | { |
109 | } |
110 | |
111 | const Arguments& arguments() const |
112 | { |
113 | return m_arguments; |
114 | } |
115 | |
116 | private: |
117 | Arguments m_arguments; |
118 | }; |
119 | |
120 | } // namespace WebProcessConnection |
121 | } // namespace Messages |
122 | |
123 | #endif // ENABLE(NETSCAPE_PLUGIN_API) |
124 | |