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 | #include "ArgumentCoders.h" |
28 | #include "Connection.h" |
29 | #include "WebCompiledContentRuleListData.h" |
30 | #include "WebUserContentControllerDataTypes.h" |
31 | #include <utility> |
32 | #include <wtf/Forward.h> |
33 | #include <wtf/ThreadSafeRefCounted.h> |
34 | #include <wtf/Vector.h> |
35 | #include <wtf/text/WTFString.h> |
36 | |
37 | namespace WebKit { |
38 | enum class InjectUserScriptImmediately : bool; |
39 | } |
40 | |
41 | namespace Messages { |
42 | namespace WebUserContentController { |
43 | |
44 | static inline IPC::StringReference messageReceiverName() |
45 | { |
46 | return IPC::StringReference("WebUserContentController" ); |
47 | } |
48 | |
49 | class AddUserContentWorlds { |
50 | public: |
51 | typedef std::tuple<const Vector<std::pair<uint64_t, String>>&> Arguments; |
52 | |
53 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
54 | static IPC::StringReference name() { return IPC::StringReference("AddUserContentWorlds" ); } |
55 | static const bool isSync = false; |
56 | |
57 | explicit AddUserContentWorlds(const Vector<std::pair<uint64_t, String>>& worlds) |
58 | : m_arguments(worlds) |
59 | { |
60 | } |
61 | |
62 | const Arguments& arguments() const |
63 | { |
64 | return m_arguments; |
65 | } |
66 | |
67 | private: |
68 | Arguments m_arguments; |
69 | }; |
70 | |
71 | class RemoveUserContentWorlds { |
72 | public: |
73 | typedef std::tuple<const Vector<uint64_t>&> Arguments; |
74 | |
75 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
76 | static IPC::StringReference name() { return IPC::StringReference("RemoveUserContentWorlds" ); } |
77 | static const bool isSync = false; |
78 | |
79 | explicit RemoveUserContentWorlds(const Vector<uint64_t>& worldIdentifiers) |
80 | : m_arguments(worldIdentifiers) |
81 | { |
82 | } |
83 | |
84 | const Arguments& arguments() const |
85 | { |
86 | return m_arguments; |
87 | } |
88 | |
89 | private: |
90 | Arguments m_arguments; |
91 | }; |
92 | |
93 | class AddUserScripts { |
94 | public: |
95 | typedef std::tuple<const Vector<struct WebKit::WebUserScriptData>&, WebKit::InjectUserScriptImmediately> Arguments; |
96 | |
97 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
98 | static IPC::StringReference name() { return IPC::StringReference("AddUserScripts" ); } |
99 | static const bool isSync = false; |
100 | |
101 | AddUserScripts(const Vector<struct WebKit::WebUserScriptData>& userScripts, WebKit::InjectUserScriptImmediately immediately) |
102 | : m_arguments(userScripts, immediately) |
103 | { |
104 | } |
105 | |
106 | const Arguments& arguments() const |
107 | { |
108 | return m_arguments; |
109 | } |
110 | |
111 | private: |
112 | Arguments m_arguments; |
113 | }; |
114 | |
115 | class RemoveUserScript { |
116 | public: |
117 | typedef std::tuple<uint64_t, uint64_t> Arguments; |
118 | |
119 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
120 | static IPC::StringReference name() { return IPC::StringReference("RemoveUserScript" ); } |
121 | static const bool isSync = false; |
122 | |
123 | RemoveUserScript(uint64_t worldIdentifier, uint64_t identifier) |
124 | : m_arguments(worldIdentifier, identifier) |
125 | { |
126 | } |
127 | |
128 | const Arguments& arguments() const |
129 | { |
130 | return m_arguments; |
131 | } |
132 | |
133 | private: |
134 | Arguments m_arguments; |
135 | }; |
136 | |
137 | class RemoveAllUserScripts { |
138 | public: |
139 | typedef std::tuple<const Vector<uint64_t>&> Arguments; |
140 | |
141 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
142 | static IPC::StringReference name() { return IPC::StringReference("RemoveAllUserScripts" ); } |
143 | static const bool isSync = false; |
144 | |
145 | explicit RemoveAllUserScripts(const Vector<uint64_t>& worldIdentifiers) |
146 | : m_arguments(worldIdentifiers) |
147 | { |
148 | } |
149 | |
150 | const Arguments& arguments() const |
151 | { |
152 | return m_arguments; |
153 | } |
154 | |
155 | private: |
156 | Arguments m_arguments; |
157 | }; |
158 | |
159 | class AddUserStyleSheets { |
160 | public: |
161 | typedef std::tuple<const Vector<struct WebKit::WebUserStyleSheetData>&> Arguments; |
162 | |
163 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
164 | static IPC::StringReference name() { return IPC::StringReference("AddUserStyleSheets" ); } |
165 | static const bool isSync = false; |
166 | |
167 | explicit AddUserStyleSheets(const Vector<struct WebKit::WebUserStyleSheetData>& userStyleSheets) |
168 | : m_arguments(userStyleSheets) |
169 | { |
170 | } |
171 | |
172 | const Arguments& arguments() const |
173 | { |
174 | return m_arguments; |
175 | } |
176 | |
177 | private: |
178 | Arguments m_arguments; |
179 | }; |
180 | |
181 | class RemoveUserStyleSheet { |
182 | public: |
183 | typedef std::tuple<uint64_t, uint64_t> Arguments; |
184 | |
185 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
186 | static IPC::StringReference name() { return IPC::StringReference("RemoveUserStyleSheet" ); } |
187 | static const bool isSync = false; |
188 | |
189 | RemoveUserStyleSheet(uint64_t worldIdentifier, uint64_t identifier) |
190 | : m_arguments(worldIdentifier, identifier) |
191 | { |
192 | } |
193 | |
194 | const Arguments& arguments() const |
195 | { |
196 | return m_arguments; |
197 | } |
198 | |
199 | private: |
200 | Arguments m_arguments; |
201 | }; |
202 | |
203 | class RemoveAllUserStyleSheets { |
204 | public: |
205 | typedef std::tuple<const Vector<uint64_t>&> Arguments; |
206 | |
207 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
208 | static IPC::StringReference name() { return IPC::StringReference("RemoveAllUserStyleSheets" ); } |
209 | static const bool isSync = false; |
210 | |
211 | explicit RemoveAllUserStyleSheets(const Vector<uint64_t>& worldIdentifiers) |
212 | : m_arguments(worldIdentifiers) |
213 | { |
214 | } |
215 | |
216 | const Arguments& arguments() const |
217 | { |
218 | return m_arguments; |
219 | } |
220 | |
221 | private: |
222 | Arguments m_arguments; |
223 | }; |
224 | |
225 | class AddUserScriptMessageHandlers { |
226 | public: |
227 | typedef std::tuple<const Vector<struct WebKit::WebScriptMessageHandlerData>&> Arguments; |
228 | |
229 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
230 | static IPC::StringReference name() { return IPC::StringReference("AddUserScriptMessageHandlers" ); } |
231 | static const bool isSync = false; |
232 | |
233 | explicit AddUserScriptMessageHandlers(const Vector<struct WebKit::WebScriptMessageHandlerData>& scriptMessageHandlers) |
234 | : m_arguments(scriptMessageHandlers) |
235 | { |
236 | } |
237 | |
238 | const Arguments& arguments() const |
239 | { |
240 | return m_arguments; |
241 | } |
242 | |
243 | private: |
244 | Arguments m_arguments; |
245 | }; |
246 | |
247 | class RemoveUserScriptMessageHandler { |
248 | public: |
249 | typedef std::tuple<uint64_t, uint64_t> Arguments; |
250 | |
251 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
252 | static IPC::StringReference name() { return IPC::StringReference("RemoveUserScriptMessageHandler" ); } |
253 | static const bool isSync = false; |
254 | |
255 | RemoveUserScriptMessageHandler(uint64_t worldIdentifier, uint64_t identifier) |
256 | : m_arguments(worldIdentifier, identifier) |
257 | { |
258 | } |
259 | |
260 | const Arguments& arguments() const |
261 | { |
262 | return m_arguments; |
263 | } |
264 | |
265 | private: |
266 | Arguments m_arguments; |
267 | }; |
268 | |
269 | class RemoveAllUserScriptMessageHandlers { |
270 | public: |
271 | typedef std::tuple<const Vector<uint64_t>&> Arguments; |
272 | |
273 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
274 | static IPC::StringReference name() { return IPC::StringReference("RemoveAllUserScriptMessageHandlers" ); } |
275 | static const bool isSync = false; |
276 | |
277 | explicit RemoveAllUserScriptMessageHandlers(const Vector<uint64_t>& worldIdentifiers) |
278 | : m_arguments(worldIdentifiers) |
279 | { |
280 | } |
281 | |
282 | const Arguments& arguments() const |
283 | { |
284 | return m_arguments; |
285 | } |
286 | |
287 | private: |
288 | Arguments m_arguments; |
289 | }; |
290 | |
291 | #if ENABLE(CONTENT_EXTENSIONS) |
292 | class AddContentRuleLists { |
293 | public: |
294 | typedef std::tuple<const Vector<std::pair<String, WebKit::WebCompiledContentRuleListData>>&> Arguments; |
295 | |
296 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
297 | static IPC::StringReference name() { return IPC::StringReference("AddContentRuleLists" ); } |
298 | static const bool isSync = false; |
299 | |
300 | explicit AddContentRuleLists(const Vector<std::pair<String, WebKit::WebCompiledContentRuleListData>>& contentFilters) |
301 | : m_arguments(contentFilters) |
302 | { |
303 | } |
304 | |
305 | const Arguments& arguments() const |
306 | { |
307 | return m_arguments; |
308 | } |
309 | |
310 | private: |
311 | Arguments m_arguments; |
312 | }; |
313 | #endif |
314 | |
315 | #if ENABLE(CONTENT_EXTENSIONS) |
316 | class RemoveContentRuleList { |
317 | public: |
318 | typedef std::tuple<const String&> Arguments; |
319 | |
320 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
321 | static IPC::StringReference name() { return IPC::StringReference("RemoveContentRuleList" ); } |
322 | static const bool isSync = false; |
323 | |
324 | explicit RemoveContentRuleList(const String& name) |
325 | : m_arguments(name) |
326 | { |
327 | } |
328 | |
329 | const Arguments& arguments() const |
330 | { |
331 | return m_arguments; |
332 | } |
333 | |
334 | private: |
335 | Arguments m_arguments; |
336 | }; |
337 | #endif |
338 | |
339 | #if ENABLE(CONTENT_EXTENSIONS) |
340 | class RemoveAllContentRuleLists { |
341 | public: |
342 | typedef std::tuple<> Arguments; |
343 | |
344 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
345 | static IPC::StringReference name() { return IPC::StringReference("RemoveAllContentRuleLists" ); } |
346 | static const bool isSync = false; |
347 | |
348 | const Arguments& arguments() const |
349 | { |
350 | return m_arguments; |
351 | } |
352 | |
353 | private: |
354 | Arguments m_arguments; |
355 | }; |
356 | #endif |
357 | |
358 | } // namespace WebUserContentController |
359 | } // namespace Messages |
360 | |