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
36namespace WebKit {
37struct PluginProcessCreationParameters;
38}
39
40namespace Messages {
41namespace PluginProcess {
42
43static inline IPC::StringReference messageReceiverName()
44{
45 return IPC::StringReference("PluginProcess");
46}
47
48class InitializePluginProcess {
49public:
50 typedef std::tuple<const WebKit::PluginProcessCreationParameters&> Arguments;
51
52 static IPC::StringReference receiverName() { return messageReceiverName(); }
53 static IPC::StringReference name() { return IPC::StringReference("InitializePluginProcess"); }
54 static const bool isSync = false;
55
56 explicit InitializePluginProcess(const WebKit::PluginProcessCreationParameters& processCreationParameters)
57 : m_arguments(processCreationParameters)
58 {
59 }
60
61 const Arguments& arguments() const
62 {
63 return m_arguments;
64 }
65
66private:
67 Arguments m_arguments;
68};
69
70class CreateWebProcessConnection {
71public:
72 typedef std::tuple<> Arguments;
73
74 static IPC::StringReference receiverName() { return messageReceiverName(); }
75 static IPC::StringReference name() { return IPC::StringReference("CreateWebProcessConnection"); }
76 static const bool isSync = false;
77
78 const Arguments& arguments() const
79 {
80 return m_arguments;
81 }
82
83private:
84 Arguments m_arguments;
85};
86
87class GetSitesWithData {
88public:
89 typedef std::tuple<uint64_t> Arguments;
90
91 static IPC::StringReference receiverName() { return messageReceiverName(); }
92 static IPC::StringReference name() { return IPC::StringReference("GetSitesWithData"); }
93 static const bool isSync = false;
94
95 explicit GetSitesWithData(uint64_t callbackID)
96 : m_arguments(callbackID)
97 {
98 }
99
100 const Arguments& arguments() const
101 {
102 return m_arguments;
103 }
104
105private:
106 Arguments m_arguments;
107};
108
109class DeleteWebsiteData {
110public:
111 typedef std::tuple<const WallTime&, uint64_t> Arguments;
112
113 static IPC::StringReference receiverName() { return messageReceiverName(); }
114 static IPC::StringReference name() { return IPC::StringReference("DeleteWebsiteData"); }
115 static const bool isSync = false;
116
117 DeleteWebsiteData(const WallTime& modifiedSince, uint64_t callbackID)
118 : m_arguments(modifiedSince, callbackID)
119 {
120 }
121
122 const Arguments& arguments() const
123 {
124 return m_arguments;
125 }
126
127private:
128 Arguments m_arguments;
129};
130
131class DeleteWebsiteDataForHostNames {
132public:
133 typedef std::tuple<const Vector<String>&, uint64_t> Arguments;
134
135 static IPC::StringReference receiverName() { return messageReceiverName(); }
136 static IPC::StringReference name() { return IPC::StringReference("DeleteWebsiteDataForHostNames"); }
137 static const bool isSync = false;
138
139 DeleteWebsiteDataForHostNames(const Vector<String>& hostNames, uint64_t callbackID)
140 : m_arguments(hostNames, callbackID)
141 {
142 }
143
144 const Arguments& arguments() const
145 {
146 return m_arguments;
147 }
148
149private:
150 Arguments m_arguments;
151};
152
153#if PLATFORM(COCOA)
154class SetQOS {
155public:
156 typedef std::tuple<const int&, const int&> Arguments;
157
158 static IPC::StringReference receiverName() { return messageReceiverName(); }
159 static IPC::StringReference name() { return IPC::StringReference("SetQOS"); }
160 static const bool isSync = false;
161
162 SetQOS(const int& latencyQOS, const int& throughputQOS)
163 : m_arguments(latencyQOS, throughputQOS)
164 {
165 }
166
167 const Arguments& arguments() const
168 {
169 return m_arguments;
170 }
171
172private:
173 Arguments m_arguments;
174};
175#endif
176
177} // namespace PluginProcess
178} // namespace Messages
179
180#endif // ENABLE(NETSCAPE_PLUGIN_API)
181