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 WebKit { |
40 | class CallbackID; |
41 | } |
42 | |
43 | namespace Messages { |
44 | namespace WebCookieManagerProxy { |
45 | |
46 | static inline IPC::StringReference messageReceiverName() |
47 | { |
48 | return IPC::StringReference("WebCookieManagerProxy" ); |
49 | } |
50 | |
51 | class DidGetHostnamesWithCookies { |
52 | public: |
53 | typedef std::tuple<const Vector<String>&, const WebKit::CallbackID&> Arguments; |
54 | |
55 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
56 | static IPC::StringReference name() { return IPC::StringReference("DidGetHostnamesWithCookies" ); } |
57 | static const bool isSync = false; |
58 | |
59 | DidGetHostnamesWithCookies(const Vector<String>& hostnames, const WebKit::CallbackID& callbackID) |
60 | : m_arguments(hostnames, callbackID) |
61 | { |
62 | } |
63 | |
64 | const Arguments& arguments() const |
65 | { |
66 | return m_arguments; |
67 | } |
68 | |
69 | private: |
70 | Arguments m_arguments; |
71 | }; |
72 | |
73 | class DidGetHTTPCookieAcceptPolicy { |
74 | public: |
75 | typedef std::tuple<uint32_t, const WebKit::CallbackID&> Arguments; |
76 | |
77 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
78 | static IPC::StringReference name() { return IPC::StringReference("DidGetHTTPCookieAcceptPolicy" ); } |
79 | static const bool isSync = false; |
80 | |
81 | DidGetHTTPCookieAcceptPolicy(uint32_t policy, const WebKit::CallbackID& callbackID) |
82 | : m_arguments(policy, callbackID) |
83 | { |
84 | } |
85 | |
86 | const Arguments& arguments() const |
87 | { |
88 | return m_arguments; |
89 | } |
90 | |
91 | private: |
92 | Arguments m_arguments; |
93 | }; |
94 | |
95 | class DidSetHTTPCookieAcceptPolicy { |
96 | public: |
97 | typedef std::tuple<const WebKit::CallbackID&> Arguments; |
98 | |
99 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
100 | static IPC::StringReference name() { return IPC::StringReference("DidSetHTTPCookieAcceptPolicy" ); } |
101 | static const bool isSync = false; |
102 | |
103 | explicit DidSetHTTPCookieAcceptPolicy(const WebKit::CallbackID& callbackID) |
104 | : m_arguments(callbackID) |
105 | { |
106 | } |
107 | |
108 | const Arguments& arguments() const |
109 | { |
110 | return m_arguments; |
111 | } |
112 | |
113 | private: |
114 | Arguments m_arguments; |
115 | }; |
116 | |
117 | class DidDeleteCookies { |
118 | public: |
119 | typedef std::tuple<const WebKit::CallbackID&> Arguments; |
120 | |
121 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
122 | static IPC::StringReference name() { return IPC::StringReference("DidDeleteCookies" ); } |
123 | static const bool isSync = false; |
124 | |
125 | explicit DidDeleteCookies(const WebKit::CallbackID& callbackID) |
126 | : m_arguments(callbackID) |
127 | { |
128 | } |
129 | |
130 | const Arguments& arguments() const |
131 | { |
132 | return m_arguments; |
133 | } |
134 | |
135 | private: |
136 | Arguments m_arguments; |
137 | }; |
138 | |
139 | class DidSetCookies { |
140 | public: |
141 | typedef std::tuple<const WebKit::CallbackID&> Arguments; |
142 | |
143 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
144 | static IPC::StringReference name() { return IPC::StringReference("DidSetCookies" ); } |
145 | static const bool isSync = false; |
146 | |
147 | explicit DidSetCookies(const WebKit::CallbackID& callbackID) |
148 | : m_arguments(callbackID) |
149 | { |
150 | } |
151 | |
152 | const Arguments& arguments() const |
153 | { |
154 | return m_arguments; |
155 | } |
156 | |
157 | private: |
158 | Arguments m_arguments; |
159 | }; |
160 | |
161 | class DidGetCookies { |
162 | public: |
163 | typedef std::tuple<const Vector<WebCore::Cookie>&, const WebKit::CallbackID&> Arguments; |
164 | |
165 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
166 | static IPC::StringReference name() { return IPC::StringReference("DidGetCookies" ); } |
167 | static const bool isSync = false; |
168 | |
169 | DidGetCookies(const Vector<WebCore::Cookie>& cookies, const WebKit::CallbackID& callbackID) |
170 | : m_arguments(cookies, callbackID) |
171 | { |
172 | } |
173 | |
174 | const Arguments& arguments() const |
175 | { |
176 | return m_arguments; |
177 | } |
178 | |
179 | private: |
180 | Arguments m_arguments; |
181 | }; |
182 | |
183 | class CookiesDidChange { |
184 | public: |
185 | typedef std::tuple<const PAL::SessionID&> Arguments; |
186 | |
187 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
188 | static IPC::StringReference name() { return IPC::StringReference("CookiesDidChange" ); } |
189 | static const bool isSync = false; |
190 | |
191 | explicit CookiesDidChange(const PAL::SessionID& sessionID) |
192 | : m_arguments(sessionID) |
193 | { |
194 | } |
195 | |
196 | const Arguments& arguments() const |
197 | { |
198 | return m_arguments; |
199 | } |
200 | |
201 | private: |
202 | Arguments m_arguments; |
203 | }; |
204 | |
205 | } // namespace WebCookieManagerProxy |
206 | } // namespace Messages |
207 | |