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