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_WebSocketEventListenerParent_h
8 #define mozilla_net_WebSocketEventListenerParent_h
9 
10 #include "mozilla/net/PWebSocketEventListenerParent.h"
11 #include "nsIWebSocketEventService.h"
12 
13 namespace mozilla {
14 namespace net {
15 
16 class WebSocketEventService;
17 
18 class WebSocketEventListenerParent final : public PWebSocketEventListenerParent,
19                                            public nsIWebSocketEventListener {
20  public:
21   NS_DECL_ISUPPORTS
22   NS_DECL_NSIWEBSOCKETEVENTLISTENER
23 
24   explicit WebSocketEventListenerParent(uint64_t aInnerWindowID);
25 
26  private:
27   ~WebSocketEventListenerParent();
28 
29   virtual mozilla::ipc::IPCResult RecvClose() override;
30 
31   virtual void ActorDestroy(ActorDestroyReason aWhy) override;
32 
33   void UnregisterListener();
34 
35   RefPtr<WebSocketEventService> mService;
36   uint64_t mInnerWindowID;
37 };
38 
39 }  // namespace net
40 }  // namespace mozilla
41 
42 #endif  // mozilla_net_WebSocketEventListenerParent_h
43