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/. */
|
2010-10-11 04:35:10 -07:00
|
|
|
|
|
|
|
#ifndef mozilla_net_WyciwygChannelChild_h
|
|
|
|
#define mozilla_net_WyciwygChannelChild_h
|
|
|
|
|
|
|
|
#include "mozilla/net/PWyciwygChannelChild.h"
|
2010-10-17 06:41:50 -07:00
|
|
|
#include "mozilla/net/ChannelEventQueue.h"
|
2010-10-11 04:35:10 -07:00
|
|
|
#include "nsIWyciwygChannel.h"
|
|
|
|
#include "nsIChannel.h"
|
|
|
|
#include "nsIProgressEventSink.h"
|
2012-09-04 17:37:45 -07:00
|
|
|
#include "PrivateBrowsingChannel.h"
|
2010-10-11 04:35:10 -07: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-04 17:37:45 -07:00
|
|
|
, public PrivateBrowsingChannel<WyciwygChannelChild>
|
2010-10-11 04:35:10 -07: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 06:41:50 -07:00
|
|
|
bool IsSuspended();
|
|
|
|
|
2010-10-11 04:35:10 -07:00
|
|
|
protected:
|
|
|
|
bool RecvOnStartRequest(const nsresult& statusCode,
|
2012-10-22 10:51:07 -07:00
|
|
|
const int64_t& contentLength,
|
2012-08-22 08:56:38 -07:00
|
|
|
const int32_t& source,
|
2010-10-11 04:35:10 -07:00
|
|
|
const nsCString& charset,
|
|
|
|
const nsCString& securityInfo);
|
|
|
|
bool RecvOnDataAvailable(const nsCString& data,
|
2012-09-05 19:41:02 -07:00
|
|
|
const uint64_t& offset);
|
2010-10-11 04:35:10 -07:00
|
|
|
bool RecvOnStopRequest(const nsresult& statusCode);
|
2010-11-19 13:12:45 -08:00
|
|
|
bool RecvCancelEarly(const nsresult& statusCode);
|
2010-10-11 04:35:10 -07:00
|
|
|
|
2010-10-17 06:41:50 -07:00
|
|
|
void OnStartRequest(const nsresult& statusCode,
|
2012-10-22 10:51:07 -07:00
|
|
|
const int64_t& contentLength,
|
2012-08-22 08:56:38 -07:00
|
|
|
const int32_t& source,
|
2010-10-17 06:41:50 -07:00
|
|
|
const nsCString& charset,
|
|
|
|
const nsCString& securityInfo);
|
|
|
|
void OnDataAvailable(const nsCString& data,
|
2012-09-05 19:41:02 -07:00
|
|
|
const uint64_t& offset);
|
2010-10-17 06:41:50 -07:00
|
|
|
void OnStopRequest(const nsresult& statusCode);
|
2010-11-19 13:12:45 -08:00
|
|
|
void CancelEarly(const nsresult& statusCode);
|
2010-10-17 06:41:50 -07:00
|
|
|
|
2012-09-04 17:37:45 -07:00
|
|
|
friend class PrivateBrowsingChannel<WyciwygChannelChild>;
|
|
|
|
|
2010-10-11 04:35:10 -07:00
|
|
|
private:
|
|
|
|
nsresult mStatus;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsPending;
|
2010-11-19 13:12:45 -08:00
|
|
|
bool mCanceled;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mLoadFlags;
|
2012-10-22 10:51:07 -07:00
|
|
|
int64_t mContentLength;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mCharsetSource;
|
2010-10-11 04:35:10 -07: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-11 18:37:09 -07:00
|
|
|
ChannelEventQueue mEventQ;
|
2010-10-17 06:41:50 -07:00
|
|
|
|
|
|
|
friend class WyciwygStartRequestEvent;
|
|
|
|
friend class WyciwygDataAvailableEvent;
|
|
|
|
friend class WyciwygStopRequestEvent;
|
2010-11-19 13:12:45 -08:00
|
|
|
friend class WyciwygCancelEvent;
|
2010-10-11 04:35:10 -07:00
|
|
|
};
|
|
|
|
|
2010-10-19 08:44:31 -07:00
|
|
|
inline bool
|
2010-10-17 06:41:50 -07:00
|
|
|
WyciwygChannelChild::IsSuspended()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-10-11 04:35:10 -07:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_net_WyciwygChannelChild_h
|