2012-05-21 15:12:37 +04: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/. */
|
2010-10-11 15:35:10 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_net_WyciwygChannelChild_h
|
|
|
|
#define mozilla_net_WyciwygChannelChild_h
|
|
|
|
|
|
|
|
#include "mozilla/net/PWyciwygChannelChild.h"
|
2010-10-17 17:41:50 +04:00
|
|
|
#include "mozilla/net/ChannelEventQueue.h"
|
2010-10-11 15:35:10 +04:00
|
|
|
#include "nsIWyciwygChannel.h"
|
|
|
|
#include "nsIChannel.h"
|
|
|
|
#include "nsIProgressEventSink.h"
|
2012-09-05 04:37:45 +04:00
|
|
|
#include "PrivateBrowsingChannel.h"
|
2010-10-11 15:35:10 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
|
|
|
// TODO: replace with IPDL states
|
|
|
|
enum WyciwygChannelChildState {
|
|
|
|
WCC_NEW,
|
|
|
|
WCC_INIT,
|
|
|
|
|
|
|
|
// States when reading from the channel
|
|
|
|
WCC_OPENED,
|
|
|
|
WCC_ONSTART,
|
|
|
|
WCC_ONDATA,
|
|
|
|
WCC_ONSTOP,
|
|
|
|
|
|
|
|
// States when writing to the cache
|
|
|
|
WCC_ONWRITE,
|
|
|
|
WCC_ONCLOSED
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Header file contents
|
|
|
|
class WyciwygChannelChild : public PWyciwygChannelChild
|
|
|
|
, public nsIWyciwygChannel
|
2012-09-05 04:37:45 +04:00
|
|
|
, public PrivateBrowsingChannel<WyciwygChannelChild>
|
2010-10-11 15:35:10 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIREQUEST
|
|
|
|
NS_DECL_NSICHANNEL
|
|
|
|
NS_DECL_NSIWYCIWYGCHANNEL
|
|
|
|
|
|
|
|
WyciwygChannelChild();
|
|
|
|
virtual ~WyciwygChannelChild();
|
|
|
|
|
|
|
|
void AddIPDLReference();
|
|
|
|
void ReleaseIPDLReference();
|
|
|
|
|
|
|
|
nsresult Init(nsIURI *uri);
|
|
|
|
|
2010-10-17 17:41:50 +04:00
|
|
|
bool IsSuspended();
|
|
|
|
|
2010-10-11 15:35:10 +04:00
|
|
|
protected:
|
|
|
|
bool RecvOnStartRequest(const nsresult& statusCode,
|
2012-08-22 19:56:38 +04:00
|
|
|
const int32_t& contentLength,
|
|
|
|
const int32_t& source,
|
2010-10-11 15:35:10 +04:00
|
|
|
const nsCString& charset,
|
|
|
|
const nsCString& securityInfo);
|
|
|
|
bool RecvOnDataAvailable(const nsCString& data,
|
2012-09-06 06:41:02 +04:00
|
|
|
const uint64_t& offset);
|
2010-10-11 15:35:10 +04:00
|
|
|
bool RecvOnStopRequest(const nsresult& statusCode);
|
2010-11-20 00:12:45 +03:00
|
|
|
bool RecvCancelEarly(const nsresult& statusCode);
|
2010-10-11 15:35:10 +04:00
|
|
|
|
2010-10-17 17:41:50 +04:00
|
|
|
void OnStartRequest(const nsresult& statusCode,
|
2012-08-22 19:56:38 +04:00
|
|
|
const int32_t& contentLength,
|
|
|
|
const int32_t& source,
|
2010-10-17 17:41:50 +04:00
|
|
|
const nsCString& charset,
|
|
|
|
const nsCString& securityInfo);
|
|
|
|
void OnDataAvailable(const nsCString& data,
|
2012-09-06 06:41:02 +04:00
|
|
|
const uint64_t& offset);
|
2010-10-17 17:41:50 +04:00
|
|
|
void OnStopRequest(const nsresult& statusCode);
|
2010-11-20 00:12:45 +03:00
|
|
|
void CancelEarly(const nsresult& statusCode);
|
2010-10-17 17:41:50 +04:00
|
|
|
|
2012-09-05 04:37:45 +04:00
|
|
|
friend class PrivateBrowsingChannel<WyciwygChannelChild>;
|
|
|
|
|
2010-10-11 15:35:10 +04:00
|
|
|
private:
|
|
|
|
nsresult mStatus;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsPending;
|
2010-11-20 00:12:45 +03:00
|
|
|
bool mCanceled;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLoadFlags;
|
|
|
|
int32_t mContentLength;
|
|
|
|
int32_t mCharsetSource;
|
2010-10-11 15:35:10 +04:00
|
|
|
nsCString mCharset;
|
|
|
|
nsCOMPtr<nsIURI> mURI;
|
|
|
|
nsCOMPtr<nsIURI> mOriginalURI;
|
|
|
|
nsCOMPtr<nsISupports> mOwner;
|
|
|
|
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
|
|
|
nsCOMPtr<nsIProgressEventSink> mProgressSink;
|
|
|
|
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
|
|
|
nsCOMPtr<nsIStreamListener> mListener;
|
|
|
|
nsCOMPtr<nsISupports> mListenerContext;
|
|
|
|
nsCOMPtr<nsISupports> mSecurityInfo;
|
|
|
|
|
|
|
|
// FIXME: replace with IPDL states (bug 536319)
|
|
|
|
enum WyciwygChannelChildState mState;
|
|
|
|
|
|
|
|
bool mIPCOpen;
|
2011-06-12 05:37:09 +04:00
|
|
|
ChannelEventQueue mEventQ;
|
2010-10-17 17:41:50 +04:00
|
|
|
|
|
|
|
friend class WyciwygStartRequestEvent;
|
|
|
|
friend class WyciwygDataAvailableEvent;
|
|
|
|
friend class WyciwygStopRequestEvent;
|
2010-11-20 00:12:45 +03:00
|
|
|
friend class WyciwygCancelEvent;
|
2010-10-11 15:35:10 +04:00
|
|
|
};
|
|
|
|
|
2010-10-19 19:44:31 +04:00
|
|
|
inline bool
|
2010-10-17 17:41:50 +04:00
|
|
|
WyciwygChannelChild::IsSuspended()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-10-11 15:35:10 +04:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_net_WyciwygChannelChild_h
|