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 | #include <wtf/Vector.h> |
34 | #include <wtf/text/WTFString.h> |
35 | |
36 | namespace WebCore { |
37 | class ; |
38 | class IntRect; |
39 | class ProtectionSpace; |
40 | } |
41 | |
42 | namespace WebKit { |
43 | class NPVariantData; |
44 | } |
45 | |
46 | namespace Messages { |
47 | namespace PluginProxy { |
48 | |
49 | static inline IPC::StringReference messageReceiverName() |
50 | { |
51 | return IPC::StringReference("PluginProxy" ); |
52 | } |
53 | |
54 | class LoadURL { |
55 | public: |
56 | typedef std::tuple<uint64_t, const String&, const String&, const String&, const WebCore::HTTPHeaderMap&, const Vector<uint8_t>&, bool> Arguments; |
57 | |
58 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
59 | static IPC::StringReference name() { return IPC::StringReference("LoadURL" ); } |
60 | static const bool isSync = false; |
61 | |
62 | (uint64_t requestID, const String& method, const String& urlString, const String& target, const WebCore::HTTPHeaderMap& , const Vector<uint8_t>& httpBody, bool ) |
63 | : m_arguments(requestID, method, urlString, target, headerFields, httpBody, allowPopups) |
64 | { |
65 | } |
66 | |
67 | const Arguments& arguments() const |
68 | { |
69 | return m_arguments; |
70 | } |
71 | |
72 | private: |
73 | Arguments m_arguments; |
74 | }; |
75 | |
76 | class Update { |
77 | public: |
78 | typedef std::tuple<const WebCore::IntRect&> Arguments; |
79 | |
80 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
81 | static IPC::StringReference name() { return IPC::StringReference("Update" ); } |
82 | static const bool isSync = false; |
83 | |
84 | explicit Update(const WebCore::IntRect& paintedRect) |
85 | : m_arguments(paintedRect) |
86 | { |
87 | } |
88 | |
89 | const Arguments& arguments() const |
90 | { |
91 | return m_arguments; |
92 | } |
93 | |
94 | private: |
95 | Arguments m_arguments; |
96 | }; |
97 | |
98 | class ProxiesForURL { |
99 | public: |
100 | typedef std::tuple<const String&> Arguments; |
101 | |
102 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
103 | static IPC::StringReference name() { return IPC::StringReference("ProxiesForURL" ); } |
104 | static const bool isSync = true; |
105 | |
106 | using DelayedReply = CompletionHandler<void(const String& proxiesString)>; |
107 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const String& proxiesString); |
108 | using Reply = std::tuple<String&>; |
109 | using ReplyArguments = std::tuple<String>; |
110 | explicit ProxiesForURL(const String& urlString) |
111 | : m_arguments(urlString) |
112 | { |
113 | } |
114 | |
115 | const Arguments& arguments() const |
116 | { |
117 | return m_arguments; |
118 | } |
119 | |
120 | private: |
121 | Arguments m_arguments; |
122 | }; |
123 | |
124 | class CookiesForURL { |
125 | public: |
126 | typedef std::tuple<const String&> Arguments; |
127 | |
128 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
129 | static IPC::StringReference name() { return IPC::StringReference("CookiesForURL" ); } |
130 | static const bool isSync = true; |
131 | |
132 | using DelayedReply = CompletionHandler<void(const String& cookieString)>; |
133 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const String& cookieString); |
134 | using Reply = std::tuple<String&>; |
135 | using ReplyArguments = std::tuple<String>; |
136 | explicit CookiesForURL(const String& urlString) |
137 | : m_arguments(urlString) |
138 | { |
139 | } |
140 | |
141 | const Arguments& arguments() const |
142 | { |
143 | return m_arguments; |
144 | } |
145 | |
146 | private: |
147 | Arguments m_arguments; |
148 | }; |
149 | |
150 | class SetCookiesForURL { |
151 | public: |
152 | typedef std::tuple<const String&, const String&> Arguments; |
153 | |
154 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
155 | static IPC::StringReference name() { return IPC::StringReference("SetCookiesForURL" ); } |
156 | static const bool isSync = false; |
157 | |
158 | SetCookiesForURL(const String& urlString, const String& cookieString) |
159 | : m_arguments(urlString, cookieString) |
160 | { |
161 | } |
162 | |
163 | const Arguments& arguments() const |
164 | { |
165 | return m_arguments; |
166 | } |
167 | |
168 | private: |
169 | Arguments m_arguments; |
170 | }; |
171 | |
172 | class GetAuthenticationInfo { |
173 | public: |
174 | typedef std::tuple<const WebCore::ProtectionSpace&> Arguments; |
175 | |
176 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
177 | static IPC::StringReference name() { return IPC::StringReference("GetAuthenticationInfo" ); } |
178 | static const bool isSync = true; |
179 | |
180 | using DelayedReply = CompletionHandler<void(bool returnValue, const String& username, const String& password)>; |
181 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool returnValue, const String& username, const String& password); |
182 | using Reply = std::tuple<bool&, String&, String&>; |
183 | using ReplyArguments = std::tuple<bool, String, String>; |
184 | explicit GetAuthenticationInfo(const WebCore::ProtectionSpace& protectionSpace) |
185 | : m_arguments(protectionSpace) |
186 | { |
187 | } |
188 | |
189 | const Arguments& arguments() const |
190 | { |
191 | return m_arguments; |
192 | } |
193 | |
194 | private: |
195 | Arguments m_arguments; |
196 | }; |
197 | |
198 | class GetPluginElementNPObject { |
199 | public: |
200 | typedef std::tuple<> Arguments; |
201 | |
202 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
203 | static IPC::StringReference name() { return IPC::StringReference("GetPluginElementNPObject" ); } |
204 | static const bool isSync = true; |
205 | |
206 | using DelayedReply = CompletionHandler<void(uint64_t pluginElementNPObjectID)>; |
207 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, uint64_t pluginElementNPObjectID); |
208 | using Reply = std::tuple<uint64_t&>; |
209 | using ReplyArguments = std::tuple<uint64_t>; |
210 | const Arguments& arguments() const |
211 | { |
212 | return m_arguments; |
213 | } |
214 | |
215 | private: |
216 | Arguments m_arguments; |
217 | }; |
218 | |
219 | class Evaluate { |
220 | public: |
221 | typedef std::tuple<const WebKit::NPVariantData&, const String&, bool> Arguments; |
222 | |
223 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
224 | static IPC::StringReference name() { return IPC::StringReference("Evaluate" ); } |
225 | static const bool isSync = true; |
226 | |
227 | using DelayedReply = CompletionHandler<void(bool returnValue, const WebKit::NPVariantData& resultData)>; |
228 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool returnValue, const WebKit::NPVariantData& resultData); |
229 | using Reply = std::tuple<bool&, WebKit::NPVariantData&>; |
230 | using ReplyArguments = std::tuple<bool, WebKit::NPVariantData>; |
231 | Evaluate(const WebKit::NPVariantData& npObjectAsVariantData, const String& scriptString, bool ) |
232 | : m_arguments(npObjectAsVariantData, scriptString, allowPopups) |
233 | { |
234 | } |
235 | |
236 | const Arguments& arguments() const |
237 | { |
238 | return m_arguments; |
239 | } |
240 | |
241 | private: |
242 | Arguments m_arguments; |
243 | }; |
244 | |
245 | class CancelStreamLoad { |
246 | public: |
247 | typedef std::tuple<uint64_t> Arguments; |
248 | |
249 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
250 | static IPC::StringReference name() { return IPC::StringReference("CancelStreamLoad" ); } |
251 | static const bool isSync = false; |
252 | |
253 | explicit CancelStreamLoad(uint64_t streamID) |
254 | : m_arguments(streamID) |
255 | { |
256 | } |
257 | |
258 | const Arguments& arguments() const |
259 | { |
260 | return m_arguments; |
261 | } |
262 | |
263 | private: |
264 | Arguments m_arguments; |
265 | }; |
266 | |
267 | class ContinueStreamLoad { |
268 | public: |
269 | typedef std::tuple<uint64_t> Arguments; |
270 | |
271 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
272 | static IPC::StringReference name() { return IPC::StringReference("ContinueStreamLoad" ); } |
273 | static const bool isSync = false; |
274 | |
275 | explicit ContinueStreamLoad(uint64_t streamID) |
276 | : m_arguments(streamID) |
277 | { |
278 | } |
279 | |
280 | const Arguments& arguments() const |
281 | { |
282 | return m_arguments; |
283 | } |
284 | |
285 | private: |
286 | Arguments m_arguments; |
287 | }; |
288 | |
289 | class CancelManualStreamLoad { |
290 | public: |
291 | typedef std::tuple<> Arguments; |
292 | |
293 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
294 | static IPC::StringReference name() { return IPC::StringReference("CancelManualStreamLoad" ); } |
295 | static const bool isSync = false; |
296 | |
297 | const Arguments& arguments() const |
298 | { |
299 | return m_arguments; |
300 | } |
301 | |
302 | private: |
303 | Arguments m_arguments; |
304 | }; |
305 | |
306 | class SetStatusbarText { |
307 | public: |
308 | typedef std::tuple<const String&> Arguments; |
309 | |
310 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
311 | static IPC::StringReference name() { return IPC::StringReference("SetStatusbarText" ); } |
312 | static const bool isSync = false; |
313 | |
314 | explicit SetStatusbarText(const String& statusbarText) |
315 | : m_arguments(statusbarText) |
316 | { |
317 | } |
318 | |
319 | const Arguments& arguments() const |
320 | { |
321 | return m_arguments; |
322 | } |
323 | |
324 | private: |
325 | Arguments m_arguments; |
326 | }; |
327 | |
328 | #if PLATFORM(COCOA) |
329 | class PluginFocusOrWindowFocusChanged { |
330 | public: |
331 | typedef std::tuple<bool> Arguments; |
332 | |
333 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
334 | static IPC::StringReference name() { return IPC::StringReference("PluginFocusOrWindowFocusChanged" ); } |
335 | static const bool isSync = false; |
336 | |
337 | explicit PluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus) |
338 | : m_arguments(pluginHasFocusAndWindowHasFocus) |
339 | { |
340 | } |
341 | |
342 | const Arguments& arguments() const |
343 | { |
344 | return m_arguments; |
345 | } |
346 | |
347 | private: |
348 | Arguments m_arguments; |
349 | }; |
350 | #endif |
351 | |
352 | #if PLATFORM(COCOA) |
353 | class SetComplexTextInputState { |
354 | public: |
355 | typedef std::tuple<uint64_t> Arguments; |
356 | |
357 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
358 | static IPC::StringReference name() { return IPC::StringReference("SetComplexTextInputState" ); } |
359 | static const bool isSync = false; |
360 | |
361 | explicit SetComplexTextInputState(uint64_t complexTextInputState) |
362 | : m_arguments(complexTextInputState) |
363 | { |
364 | } |
365 | |
366 | const Arguments& arguments() const |
367 | { |
368 | return m_arguments; |
369 | } |
370 | |
371 | private: |
372 | Arguments m_arguments; |
373 | }; |
374 | #endif |
375 | |
376 | #if PLATFORM(COCOA) |
377 | class SetLayerHostingContextID { |
378 | public: |
379 | typedef std::tuple<uint32_t> Arguments; |
380 | |
381 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
382 | static IPC::StringReference name() { return IPC::StringReference("SetLayerHostingContextID" ); } |
383 | static const bool isSync = false; |
384 | |
385 | explicit SetLayerHostingContextID(uint32_t layerHostingContextID) |
386 | : m_arguments(layerHostingContextID) |
387 | { |
388 | } |
389 | |
390 | const Arguments& arguments() const |
391 | { |
392 | return m_arguments; |
393 | } |
394 | |
395 | private: |
396 | Arguments m_arguments; |
397 | }; |
398 | #endif |
399 | |
400 | #if PLATFORM(X11) |
401 | class CreatePluginContainer { |
402 | public: |
403 | typedef std::tuple<> Arguments; |
404 | |
405 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
406 | static IPC::StringReference name() { return IPC::StringReference("CreatePluginContainer" ); } |
407 | static const bool isSync = true; |
408 | |
409 | using DelayedReply = CompletionHandler<void(uint64_t windowID)>; |
410 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, uint64_t windowID); |
411 | using Reply = std::tuple<uint64_t&>; |
412 | using ReplyArguments = std::tuple<uint64_t>; |
413 | const Arguments& arguments() const |
414 | { |
415 | return m_arguments; |
416 | } |
417 | |
418 | private: |
419 | Arguments m_arguments; |
420 | }; |
421 | #endif |
422 | |
423 | #if PLATFORM(X11) |
424 | class WindowedPluginGeometryDidChange { |
425 | public: |
426 | typedef std::tuple<const WebCore::IntRect&, const WebCore::IntRect&, uint64_t> Arguments; |
427 | |
428 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
429 | static IPC::StringReference name() { return IPC::StringReference("WindowedPluginGeometryDidChange" ); } |
430 | static const bool isSync = false; |
431 | |
432 | WindowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID) |
433 | : m_arguments(frameRect, clipRect, windowID) |
434 | { |
435 | } |
436 | |
437 | const Arguments& arguments() const |
438 | { |
439 | return m_arguments; |
440 | } |
441 | |
442 | private: |
443 | Arguments m_arguments; |
444 | }; |
445 | #endif |
446 | |
447 | #if PLATFORM(X11) |
448 | class WindowedPluginVisibilityDidChange { |
449 | public: |
450 | typedef std::tuple<bool, uint64_t> Arguments; |
451 | |
452 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
453 | static IPC::StringReference name() { return IPC::StringReference("WindowedPluginVisibilityDidChange" ); } |
454 | static const bool isSync = false; |
455 | |
456 | WindowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID) |
457 | : m_arguments(isVisible, windowID) |
458 | { |
459 | } |
460 | |
461 | const Arguments& arguments() const |
462 | { |
463 | return m_arguments; |
464 | } |
465 | |
466 | private: |
467 | Arguments m_arguments; |
468 | }; |
469 | #endif |
470 | |
471 | class DidCreatePlugin { |
472 | public: |
473 | typedef std::tuple<bool, uint32_t> Arguments; |
474 | |
475 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
476 | static IPC::StringReference name() { return IPC::StringReference("DidCreatePlugin" ); } |
477 | static const bool isSync = true; |
478 | |
479 | using DelayedReply = CompletionHandler<void()>; |
480 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&); |
481 | using Reply = std::tuple<>; |
482 | using ReplyArguments = std::tuple<>; |
483 | DidCreatePlugin(bool wantsWheelEvents, uint32_t remoteLayerClientID) |
484 | : m_arguments(wantsWheelEvents, remoteLayerClientID) |
485 | { |
486 | } |
487 | |
488 | const Arguments& arguments() const |
489 | { |
490 | return m_arguments; |
491 | } |
492 | |
493 | private: |
494 | Arguments m_arguments; |
495 | }; |
496 | |
497 | class DidFailToCreatePlugin { |
498 | public: |
499 | typedef std::tuple<> Arguments; |
500 | |
501 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
502 | static IPC::StringReference name() { return IPC::StringReference("DidFailToCreatePlugin" ); } |
503 | static const bool isSync = true; |
504 | |
505 | using DelayedReply = CompletionHandler<void()>; |
506 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&); |
507 | using Reply = std::tuple<>; |
508 | using ReplyArguments = std::tuple<>; |
509 | const Arguments& arguments() const |
510 | { |
511 | return m_arguments; |
512 | } |
513 | |
514 | private: |
515 | Arguments m_arguments; |
516 | }; |
517 | |
518 | class SetPluginIsPlayingAudio { |
519 | public: |
520 | typedef std::tuple<bool> Arguments; |
521 | |
522 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
523 | static IPC::StringReference name() { return IPC::StringReference("SetPluginIsPlayingAudio" ); } |
524 | static const bool isSync = false; |
525 | |
526 | explicit SetPluginIsPlayingAudio(bool pluginIsPlayingAudio) |
527 | : m_arguments(pluginIsPlayingAudio) |
528 | { |
529 | } |
530 | |
531 | const Arguments& arguments() const |
532 | { |
533 | return m_arguments; |
534 | } |
535 | |
536 | private: |
537 | Arguments m_arguments; |
538 | }; |
539 | |
540 | } // namespace PluginProxy |
541 | } // namespace Messages |
542 | |
543 | #endif // ENABLE(NETSCAPE_PLUGIN_API) |
544 | |