| 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 <wtf/Forward.h> |
| 30 | #include <wtf/ThreadSafeRefCounted.h> |
| 31 | #include <wtf/text/WTFString.h> |
| 32 | |
| 33 | namespace IPC { |
| 34 | class DataReference; |
| 35 | } |
| 36 | |
| 37 | namespace WebCore { |
| 38 | class ResourceResponse; |
| 39 | class ResourceRequest; |
| 40 | class ResourceError; |
| 41 | } |
| 42 | |
| 43 | namespace Messages { |
| 44 | namespace LegacyCustomProtocolManager { |
| 45 | |
| 46 | static inline IPC::StringReference messageReceiverName() |
| 47 | { |
| 48 | return IPC::StringReference("LegacyCustomProtocolManager" ); |
| 49 | } |
| 50 | |
| 51 | class DidFailWithError { |
| 52 | public: |
| 53 | typedef std::tuple<uint64_t, const WebCore::ResourceError&> Arguments; |
| 54 | |
| 55 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 56 | static IPC::StringReference name() { return IPC::StringReference("DidFailWithError" ); } |
| 57 | static const bool isSync = false; |
| 58 | |
| 59 | DidFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error) |
| 60 | : m_arguments(customProtocolID, error) |
| 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 DidLoadData { |
| 74 | public: |
| 75 | typedef std::tuple<uint64_t, const IPC::DataReference&> Arguments; |
| 76 | |
| 77 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 78 | static IPC::StringReference name() { return IPC::StringReference("DidLoadData" ); } |
| 79 | static const bool isSync = false; |
| 80 | |
| 81 | DidLoadData(uint64_t customProtocolID, const IPC::DataReference& data) |
| 82 | : m_arguments(customProtocolID, data) |
| 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 DidReceiveResponse { |
| 96 | public: |
| 97 | typedef std::tuple<uint64_t, const WebCore::ResourceResponse&, uint32_t> Arguments; |
| 98 | |
| 99 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 100 | static IPC::StringReference name() { return IPC::StringReference("DidReceiveResponse" ); } |
| 101 | static const bool isSync = false; |
| 102 | |
| 103 | DidReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response, uint32_t cacheStoragePolicy) |
| 104 | : m_arguments(customProtocolID, response, cacheStoragePolicy) |
| 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 DidFinishLoading { |
| 118 | public: |
| 119 | typedef std::tuple<uint64_t> Arguments; |
| 120 | |
| 121 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 122 | static IPC::StringReference name() { return IPC::StringReference("DidFinishLoading" ); } |
| 123 | static const bool isSync = false; |
| 124 | |
| 125 | explicit DidFinishLoading(uint64_t customProtocolID) |
| 126 | : m_arguments(customProtocolID) |
| 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 WasRedirectedToRequest { |
| 140 | public: |
| 141 | typedef std::tuple<uint64_t, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&> Arguments; |
| 142 | |
| 143 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 144 | static IPC::StringReference name() { return IPC::StringReference("WasRedirectedToRequest" ); } |
| 145 | static const bool isSync = false; |
| 146 | |
| 147 | WasRedirectedToRequest(uint64_t customProtocolID, const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& redirectResponse) |
| 148 | : m_arguments(customProtocolID, request, redirectResponse) |
| 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 RegisterScheme { |
| 162 | public: |
| 163 | typedef std::tuple<const String&> Arguments; |
| 164 | |
| 165 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 166 | static IPC::StringReference name() { return IPC::StringReference("RegisterScheme" ); } |
| 167 | static const bool isSync = false; |
| 168 | |
| 169 | explicit RegisterScheme(const String& name) |
| 170 | : m_arguments(name) |
| 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 UnregisterScheme { |
| 184 | public: |
| 185 | typedef std::tuple<const String&> Arguments; |
| 186 | |
| 187 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 188 | static IPC::StringReference name() { return IPC::StringReference("UnregisterScheme" ); } |
| 189 | static const bool isSync = false; |
| 190 | |
| 191 | explicit UnregisterScheme(const String& name) |
| 192 | : m_arguments(name) |
| 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 LegacyCustomProtocolManager |
| 206 | } // namespace Messages |
| 207 | |