WebSocketChannelParent.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_net_WebSocketChannelParent_h
  6. #define mozilla_net_WebSocketChannelParent_h
  7. #include "mozilla/net/PWebSocketParent.h"
  8. #include "mozilla/net/NeckoParent.h"
  9. #include "nsIInterfaceRequestor.h"
  10. #include "nsIWebSocketListener.h"
  11. #include "nsIWebSocketChannel.h"
  12. #include "nsILoadContext.h"
  13. #include "nsCOMPtr.h"
  14. #include "nsString.h"
  15. class nsIAuthPromptProvider;
  16. namespace mozilla {
  17. namespace net {
  18. class WebSocketChannelParent : public PWebSocketParent,
  19. public nsIWebSocketListener,
  20. public nsIInterfaceRequestor
  21. {
  22. ~WebSocketChannelParent();
  23. public:
  24. NS_DECL_THREADSAFE_ISUPPORTS
  25. NS_DECL_NSIWEBSOCKETLISTENER
  26. NS_DECL_NSIINTERFACEREQUESTOR
  27. WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider,
  28. nsILoadContext* aLoadContext,
  29. PBOverrideStatus aOverrideStatus,
  30. uint32_t aSerial);
  31. private:
  32. bool RecvAsyncOpen(const OptionalURIParams& aURI,
  33. const nsCString& aOrigin,
  34. const uint64_t& aInnerWindowID,
  35. const nsCString& aProtocol,
  36. const bool& aSecure,
  37. const uint32_t& aPingInterval,
  38. const bool& aClientSetPingInterval,
  39. const uint32_t& aPingTimeout,
  40. const bool& aClientSetPingTimeout,
  41. const OptionalLoadInfoArgs& aLoadInfoArgs,
  42. const OptionalTransportProvider& aTransportProvider,
  43. const nsCString& aNegotiatedExtensions) override;
  44. bool RecvClose(const uint16_t & code, const nsCString & reason) override;
  45. bool RecvSendMsg(const nsCString& aMsg) override;
  46. bool RecvSendBinaryMsg(const nsCString& aMsg) override;
  47. bool RecvSendBinaryStream(const InputStreamParams& aStream,
  48. const uint32_t& aLength) override;
  49. bool RecvDeleteSelf() override;
  50. void ActorDestroy(ActorDestroyReason why) override;
  51. nsCOMPtr<nsIAuthPromptProvider> mAuthProvider;
  52. nsCOMPtr<nsIWebSocketChannel> mChannel;
  53. nsCOMPtr<nsILoadContext> mLoadContext;
  54. bool mIPCOpen;
  55. uint32_t mSerial;
  56. };
  57. } // namespace net
  58. } // namespace mozilla
  59. #endif // mozilla_net_WebSocketChannelParent_h