Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_net_WebSocketEventListenerChild_h
8 : #define mozilla_net_WebSocketEventListenerChild_h
9 :
10 : #include "mozilla/net/NeckoTargetHolder.h"
11 : #include "mozilla/net/PWebSocketEventListenerChild.h"
12 :
13 : namespace mozilla {
14 : namespace net {
15 :
16 : class WebSocketEventService;
17 :
18 : class WebSocketEventListenerChild final : public PWebSocketEventListenerChild
19 : , public NeckoTargetHolder
20 : {
21 : public:
22 0 : NS_INLINE_DECL_REFCOUNTING(WebSocketEventListenerChild)
23 :
24 : explicit WebSocketEventListenerChild(uint64_t aInnerWindowID,
25 : nsIEventTarget* aTarget);
26 :
27 : mozilla::ipc::IPCResult RecvWebSocketCreated(const uint32_t& aWebSocketSerialID,
28 : const nsString& aURI,
29 : const nsCString& aProtocols) override;
30 :
31 : mozilla::ipc::IPCResult RecvWebSocketOpened(const uint32_t& aWebSocketSerialID,
32 : const nsString& aEffectiveURI,
33 : const nsCString& aProtocols,
34 : const nsCString& aExtensions) override;
35 :
36 : mozilla::ipc::IPCResult RecvWebSocketMessageAvailable(const uint32_t& aWebSocketSerialID,
37 : const nsCString& aData,
38 : const uint16_t& aMessageType) override;
39 :
40 : mozilla::ipc::IPCResult RecvWebSocketClosed(const uint32_t& aWebSocketSerialID,
41 : const bool& aWasClean,
42 : const uint16_t& aCode,
43 : const nsString& aReason) override;
44 :
45 : mozilla::ipc::IPCResult RecvFrameReceived(const uint32_t& aWebSocketSerialID,
46 : const WebSocketFrameData& aFrameData) override;
47 :
48 : mozilla::ipc::IPCResult RecvFrameSent(const uint32_t& aWebSocketSerialID,
49 : const WebSocketFrameData& aFrameData) override;
50 :
51 : void Close();
52 :
53 : private:
54 : ~WebSocketEventListenerChild();
55 :
56 : virtual void ActorDestroy(ActorDestroyReason aWhy) override;
57 :
58 : RefPtr<WebSocketEventService> mService;
59 : uint64_t mInnerWindowID;
60 : };
61 :
62 : } // namespace net
63 : } // namespace mozilla
64 :
65 : #endif // mozilla_net_WebSocketEventListenerChild_h
|