2011-05-04 06:36:23 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set sw=2 ts=8 et tw=80 : */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-05-04 06:36:23 -07:00
|
|
|
|
|
|
|
#ifndef mozilla_net_WebSocketChannelParent_h
|
|
|
|
#define mozilla_net_WebSocketChannelParent_h
|
|
|
|
|
|
|
|
#include "mozilla/net/PWebSocketParent.h"
|
2011-07-04 21:18:33 -07:00
|
|
|
#include "nsIWebSocketListener.h"
|
|
|
|
#include "nsIWebSocketChannel.h"
|
2012-07-22 15:35:33 -07:00
|
|
|
#include "nsILoadContext.h"
|
2011-05-04 06:36:23 -07:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
|
|
|
|
class nsIAuthPromptProvider;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
|
|
|
class WebSocketChannelParent : public PWebSocketParent,
|
|
|
|
public nsIWebSocketListener,
|
2012-07-22 15:35:33 -07:00
|
|
|
public nsIInterfaceRequestor,
|
|
|
|
public nsILoadContext
|
2011-05-04 06:36:23 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIWEBSOCKETLISTENER
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
2012-07-22 15:35:33 -07:00
|
|
|
NS_DECL_NSILOADCONTEXT
|
2011-05-04 06:36:23 -07:00
|
|
|
|
|
|
|
WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool RecvAsyncOpen(const IPC::URI& aURI,
|
|
|
|
const nsCString& aOrigin,
|
|
|
|
const nsCString& aProtocol,
|
2012-07-22 15:35:33 -07:00
|
|
|
const bool& aSecure,
|
|
|
|
const bool& haveLoadContext,
|
|
|
|
const bool& isContent,
|
2012-07-22 15:35:33 -07:00
|
|
|
const bool& usingPrivateBrowsing,
|
|
|
|
const bool& isInBrowserElement,
|
|
|
|
const PRUint32& appId);
|
2011-08-03 12:15:25 -07:00
|
|
|
bool RecvClose(const PRUint16 & code, const nsCString & reason);
|
2011-05-04 06:36:23 -07:00
|
|
|
bool RecvSendMsg(const nsCString& aMsg);
|
|
|
|
bool RecvSendBinaryMsg(const nsCString& aMsg);
|
2011-12-15 15:20:17 -08:00
|
|
|
bool RecvSendBinaryStream(const InputStream& aStream,
|
|
|
|
const PRUint32& aLength);
|
2011-05-04 06:36:23 -07:00
|
|
|
bool RecvDeleteSelf();
|
|
|
|
|
|
|
|
void ActorDestroy(ActorDestroyReason why);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAuthPromptProvider> mAuthProvider;
|
2011-07-04 21:18:32 -07:00
|
|
|
nsCOMPtr<nsIWebSocketChannel> mChannel;
|
2011-05-04 06:36:23 -07:00
|
|
|
bool mIPCOpen;
|
2012-07-22 15:35:33 -07:00
|
|
|
|
|
|
|
// fields for impersonating nsILoadContext
|
2012-07-22 15:35:33 -07:00
|
|
|
bool mHaveLoadContext : 1;
|
|
|
|
bool mIsContent : 1;
|
|
|
|
bool mUsePrivateBrowsing : 1;
|
|
|
|
bool mIsInBrowserElement : 1;
|
|
|
|
|
|
|
|
PRUint32 mAppId;
|
2011-05-04 06:36:23 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_net_WebSocketChannelParent_h
|