| 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 | #if ENABLE(NETSCAPE_PLUGIN_API) |
| 28 | |
| 29 | #include "ArgumentCoders.h" |
| 30 | #include "Connection.h" |
| 31 | #include <wtf/Forward.h> |
| 32 | #include <wtf/ThreadSafeRefCounted.h> |
| 33 | #include <wtf/Vector.h> |
| 34 | #include <wtf/text/WTFString.h> |
| 35 | |
| 36 | namespace IPC { |
| 37 | class Attachment; |
| 38 | } |
| 39 | |
| 40 | namespace Messages { |
| 41 | namespace PluginProcessProxy { |
| 42 | |
| 43 | static inline IPC::StringReference messageReceiverName() |
| 44 | { |
| 45 | return IPC::StringReference("PluginProcessProxy" ); |
| 46 | } |
| 47 | |
| 48 | class DidCreateWebProcessConnection { |
| 49 | public: |
| 50 | typedef std::tuple<const IPC::Attachment&, bool> Arguments; |
| 51 | |
| 52 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 53 | static IPC::StringReference name() { return IPC::StringReference("DidCreateWebProcessConnection" ); } |
| 54 | static const bool isSync = false; |
| 55 | |
| 56 | DidCreateWebProcessConnection(const IPC::Attachment& connectionIdentifier, bool supportsAsynchronousPluginInitialization) |
| 57 | : m_arguments(connectionIdentifier, supportsAsynchronousPluginInitialization) |
| 58 | { |
| 59 | } |
| 60 | |
| 61 | const Arguments& arguments() const |
| 62 | { |
| 63 | return m_arguments; |
| 64 | } |
| 65 | |
| 66 | private: |
| 67 | Arguments m_arguments; |
| 68 | }; |
| 69 | |
| 70 | class DidGetSitesWithData { |
| 71 | public: |
| 72 | typedef std::tuple<const Vector<String>&, uint64_t> Arguments; |
| 73 | |
| 74 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 75 | static IPC::StringReference name() { return IPC::StringReference("DidGetSitesWithData" ); } |
| 76 | static const bool isSync = false; |
| 77 | |
| 78 | DidGetSitesWithData(const Vector<String>& sites, uint64_t callbackID) |
| 79 | : m_arguments(sites, callbackID) |
| 80 | { |
| 81 | } |
| 82 | |
| 83 | const Arguments& arguments() const |
| 84 | { |
| 85 | return m_arguments; |
| 86 | } |
| 87 | |
| 88 | private: |
| 89 | Arguments m_arguments; |
| 90 | }; |
| 91 | |
| 92 | class DidDeleteWebsiteData { |
| 93 | public: |
| 94 | typedef std::tuple<uint64_t> Arguments; |
| 95 | |
| 96 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 97 | static IPC::StringReference name() { return IPC::StringReference("DidDeleteWebsiteData" ); } |
| 98 | static const bool isSync = false; |
| 99 | |
| 100 | explicit DidDeleteWebsiteData(uint64_t callbackID) |
| 101 | : m_arguments(callbackID) |
| 102 | { |
| 103 | } |
| 104 | |
| 105 | const Arguments& arguments() const |
| 106 | { |
| 107 | return m_arguments; |
| 108 | } |
| 109 | |
| 110 | private: |
| 111 | Arguments m_arguments; |
| 112 | }; |
| 113 | |
| 114 | class DidDeleteWebsiteDataForHostNames { |
| 115 | public: |
| 116 | typedef std::tuple<uint64_t> Arguments; |
| 117 | |
| 118 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 119 | static IPC::StringReference name() { return IPC::StringReference("DidDeleteWebsiteDataForHostNames" ); } |
| 120 | static const bool isSync = false; |
| 121 | |
| 122 | explicit DidDeleteWebsiteDataForHostNames(uint64_t callbackID) |
| 123 | : m_arguments(callbackID) |
| 124 | { |
| 125 | } |
| 126 | |
| 127 | const Arguments& arguments() const |
| 128 | { |
| 129 | return m_arguments; |
| 130 | } |
| 131 | |
| 132 | private: |
| 133 | Arguments m_arguments; |
| 134 | }; |
| 135 | |
| 136 | #if PLATFORM(COCOA) |
| 137 | class SetModalWindowIsShowing { |
| 138 | public: |
| 139 | typedef std::tuple<bool> Arguments; |
| 140 | |
| 141 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 142 | static IPC::StringReference name() { return IPC::StringReference("SetModalWindowIsShowing" ); } |
| 143 | static const bool isSync = false; |
| 144 | |
| 145 | explicit SetModalWindowIsShowing(bool modalWindowIsShowing) |
| 146 | : m_arguments(modalWindowIsShowing) |
| 147 | { |
| 148 | } |
| 149 | |
| 150 | const Arguments& arguments() const |
| 151 | { |
| 152 | return m_arguments; |
| 153 | } |
| 154 | |
| 155 | private: |
| 156 | Arguments m_arguments; |
| 157 | }; |
| 158 | #endif |
| 159 | |
| 160 | #if PLATFORM(COCOA) |
| 161 | class SetFullscreenWindowIsShowing { |
| 162 | public: |
| 163 | typedef std::tuple<bool> Arguments; |
| 164 | |
| 165 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 166 | static IPC::StringReference name() { return IPC::StringReference("SetFullscreenWindowIsShowing" ); } |
| 167 | static const bool isSync = false; |
| 168 | |
| 169 | explicit SetFullscreenWindowIsShowing(bool fullscreenWindowIsShowing) |
| 170 | : m_arguments(fullscreenWindowIsShowing) |
| 171 | { |
| 172 | } |
| 173 | |
| 174 | const Arguments& arguments() const |
| 175 | { |
| 176 | return m_arguments; |
| 177 | } |
| 178 | |
| 179 | private: |
| 180 | Arguments m_arguments; |
| 181 | }; |
| 182 | #endif |
| 183 | |
| 184 | #if PLATFORM(COCOA) |
| 185 | class LaunchProcess { |
| 186 | public: |
| 187 | typedef std::tuple<const String&, const Vector<String>&> Arguments; |
| 188 | |
| 189 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 190 | static IPC::StringReference name() { return IPC::StringReference("LaunchProcess" ); } |
| 191 | static const bool isSync = true; |
| 192 | |
| 193 | using DelayedReply = CompletionHandler<void(bool result)>; |
| 194 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool result); |
| 195 | using Reply = std::tuple<bool&>; |
| 196 | using ReplyArguments = std::tuple<bool>; |
| 197 | LaunchProcess(const String& launchPath, const Vector<String>& arguments) |
| 198 | : m_arguments(launchPath, arguments) |
| 199 | { |
| 200 | } |
| 201 | |
| 202 | const Arguments& arguments() const |
| 203 | { |
| 204 | return m_arguments; |
| 205 | } |
| 206 | |
| 207 | private: |
| 208 | Arguments m_arguments; |
| 209 | }; |
| 210 | #endif |
| 211 | |
| 212 | #if PLATFORM(COCOA) |
| 213 | class LaunchApplicationAtURL { |
| 214 | public: |
| 215 | typedef std::tuple<const String&, const Vector<String>&> Arguments; |
| 216 | |
| 217 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 218 | static IPC::StringReference name() { return IPC::StringReference("LaunchApplicationAtURL" ); } |
| 219 | static const bool isSync = true; |
| 220 | |
| 221 | using DelayedReply = CompletionHandler<void(bool result)>; |
| 222 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool result); |
| 223 | using Reply = std::tuple<bool&>; |
| 224 | using ReplyArguments = std::tuple<bool>; |
| 225 | LaunchApplicationAtURL(const String& url, const Vector<String>& arguments) |
| 226 | : m_arguments(url, arguments) |
| 227 | { |
| 228 | } |
| 229 | |
| 230 | const Arguments& arguments() const |
| 231 | { |
| 232 | return m_arguments; |
| 233 | } |
| 234 | |
| 235 | private: |
| 236 | Arguments m_arguments; |
| 237 | }; |
| 238 | #endif |
| 239 | |
| 240 | #if PLATFORM(COCOA) |
| 241 | class OpenURL { |
| 242 | public: |
| 243 | typedef std::tuple<const String&> Arguments; |
| 244 | |
| 245 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 246 | static IPC::StringReference name() { return IPC::StringReference("OpenURL" ); } |
| 247 | static const bool isSync = true; |
| 248 | |
| 249 | using DelayedReply = CompletionHandler<void(bool result, int32_t status, const String& launchedURLString)>; |
| 250 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool result, int32_t status, const String& launchedURLString); |
| 251 | using Reply = std::tuple<bool&, int32_t&, String&>; |
| 252 | using ReplyArguments = std::tuple<bool, int32_t, String>; |
| 253 | explicit OpenURL(const String& urlString) |
| 254 | : m_arguments(urlString) |
| 255 | { |
| 256 | } |
| 257 | |
| 258 | const Arguments& arguments() const |
| 259 | { |
| 260 | return m_arguments; |
| 261 | } |
| 262 | |
| 263 | private: |
| 264 | Arguments m_arguments; |
| 265 | }; |
| 266 | #endif |
| 267 | |
| 268 | #if PLATFORM(COCOA) |
| 269 | class OpenFile { |
| 270 | public: |
| 271 | typedef std::tuple<const String&> Arguments; |
| 272 | |
| 273 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
| 274 | static IPC::StringReference name() { return IPC::StringReference("OpenFile" ); } |
| 275 | static const bool isSync = true; |
| 276 | |
| 277 | using DelayedReply = CompletionHandler<void(bool result)>; |
| 278 | static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool result); |
| 279 | using Reply = std::tuple<bool&>; |
| 280 | using ReplyArguments = std::tuple<bool>; |
| 281 | explicit OpenFile(const String& fullPath) |
| 282 | : m_arguments(fullPath) |
| 283 | { |
| 284 | } |
| 285 | |
| 286 | const Arguments& arguments() const |
| 287 | { |
| 288 | return m_arguments; |
| 289 | } |
| 290 | |
| 291 | private: |
| 292 | Arguments m_arguments; |
| 293 | }; |
| 294 | #endif |
| 295 | |
| 296 | } // namespace PluginProcessProxy |
| 297 | } // namespace Messages |
| 298 | |
| 299 | #endif // ENABLE(NETSCAPE_PLUGIN_API) |
| 300 | |