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 | #include "config.h" |
26 | |
27 | #include "WebCookieManager.h" |
28 | |
29 | #include "ArgumentCoders.h" |
30 | #include "CallbackID.h" |
31 | #include "Decoder.h" |
32 | #include "HandleMessage.h" |
33 | #include "OptionalCallbackID.h" |
34 | #if USE(SOUP) |
35 | #include "SoupCookiePersistentStorageType.h" |
36 | #endif |
37 | #include "WebCookieManagerMessages.h" |
38 | #include "WebCoreArgumentCoders.h" |
39 | #include <WebCore/Cookie.h> |
40 | #include <pal/SessionID.h> |
41 | #include <wtf/Vector.h> |
42 | #include <wtf/WallTime.h> |
43 | #include <wtf/text/WTFString.h> |
44 | |
45 | namespace WebKit { |
46 | |
47 | void WebCookieManager::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder) |
48 | { |
49 | if (decoder.messageName() == Messages::WebCookieManager::GetHostnamesWithCookies::name()) { |
50 | IPC::handleMessage<Messages::WebCookieManager::GetHostnamesWithCookies>(decoder, this, &WebCookieManager::getHostnamesWithCookies); |
51 | return; |
52 | } |
53 | if (decoder.messageName() == Messages::WebCookieManager::DeleteCookiesForHostnames::name()) { |
54 | IPC::handleMessage<Messages::WebCookieManager::DeleteCookiesForHostnames>(decoder, this, &WebCookieManager::deleteCookiesForHostnames); |
55 | return; |
56 | } |
57 | if (decoder.messageName() == Messages::WebCookieManager::DeleteAllCookies::name()) { |
58 | IPC::handleMessage<Messages::WebCookieManager::DeleteAllCookies>(decoder, this, &WebCookieManager::deleteAllCookies); |
59 | return; |
60 | } |
61 | if (decoder.messageName() == Messages::WebCookieManager::SetCookie::name()) { |
62 | IPC::handleMessage<Messages::WebCookieManager::SetCookie>(decoder, this, &WebCookieManager::setCookie); |
63 | return; |
64 | } |
65 | if (decoder.messageName() == Messages::WebCookieManager::SetCookies::name()) { |
66 | IPC::handleMessage<Messages::WebCookieManager::SetCookies>(decoder, this, &WebCookieManager::setCookies); |
67 | return; |
68 | } |
69 | if (decoder.messageName() == Messages::WebCookieManager::GetAllCookies::name()) { |
70 | IPC::handleMessage<Messages::WebCookieManager::GetAllCookies>(decoder, this, &WebCookieManager::getAllCookies); |
71 | return; |
72 | } |
73 | if (decoder.messageName() == Messages::WebCookieManager::GetCookies::name()) { |
74 | IPC::handleMessage<Messages::WebCookieManager::GetCookies>(decoder, this, &WebCookieManager::getCookies); |
75 | return; |
76 | } |
77 | if (decoder.messageName() == Messages::WebCookieManager::DeleteCookie::name()) { |
78 | IPC::handleMessage<Messages::WebCookieManager::DeleteCookie>(decoder, this, &WebCookieManager::deleteCookie); |
79 | return; |
80 | } |
81 | if (decoder.messageName() == Messages::WebCookieManager::DeleteAllCookiesModifiedSince::name()) { |
82 | IPC::handleMessage<Messages::WebCookieManager::DeleteAllCookiesModifiedSince>(decoder, this, &WebCookieManager::deleteAllCookiesModifiedSince); |
83 | return; |
84 | } |
85 | if (decoder.messageName() == Messages::WebCookieManager::SetHTTPCookieAcceptPolicy::name()) { |
86 | IPC::handleMessage<Messages::WebCookieManager::SetHTTPCookieAcceptPolicy>(decoder, this, &WebCookieManager::setHTTPCookieAcceptPolicy); |
87 | return; |
88 | } |
89 | if (decoder.messageName() == Messages::WebCookieManager::GetHTTPCookieAcceptPolicy::name()) { |
90 | IPC::handleMessage<Messages::WebCookieManager::GetHTTPCookieAcceptPolicy>(decoder, this, &WebCookieManager::getHTTPCookieAcceptPolicy); |
91 | return; |
92 | } |
93 | if (decoder.messageName() == Messages::WebCookieManager::StartObservingCookieChanges::name()) { |
94 | IPC::handleMessage<Messages::WebCookieManager::StartObservingCookieChanges>(decoder, this, &WebCookieManager::startObservingCookieChanges); |
95 | return; |
96 | } |
97 | if (decoder.messageName() == Messages::WebCookieManager::StopObservingCookieChanges::name()) { |
98 | IPC::handleMessage<Messages::WebCookieManager::StopObservingCookieChanges>(decoder, this, &WebCookieManager::stopObservingCookieChanges); |
99 | return; |
100 | } |
101 | #if USE(SOUP) |
102 | if (decoder.messageName() == Messages::WebCookieManager::SetCookiePersistentStorage::name()) { |
103 | IPC::handleMessage<Messages::WebCookieManager::SetCookiePersistentStorage>(decoder, this, &WebCookieManager::setCookiePersistentStorage); |
104 | return; |
105 | } |
106 | #endif |
107 | UNUSED_PARAM(connection); |
108 | UNUSED_PARAM(decoder); |
109 | ASSERT_NOT_REACHED(); |
110 | } |
111 | |
112 | } // namespace WebKit |
113 | |
114 | |