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"
|
|
|
|
#include "nsIWyciwygChannel.h"
|
|
|
|
#include "nsIChannel.h"
|
2012-09-04 17:37:45 -07:00
|
|
|
#include "PrivateBrowsingChannel.h"
|
2010-10-11 04:35:10 -07:00
|
|
|
|
2013-09-22 20:35:52 -07:00
|
|
|
class nsIProgressEventSink;
|
|
|
|
|
2010-10-11 04:35:10 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2013-09-22 20:35:52 -07:00
|
|
|
class ChannelEventQueue;
|
|
|
|
|
2010-10-11 04:35:10 -07:00
|
|
|
// 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,
|
2014-01-17 11:49:39 -08:00
|
|
|
const nsCString& securityInfo) MOZ_OVERRIDE;
|
2010-10-11 04:35:10 -07:00
|
|
|
bool RecvOnDataAvailable(const nsCString& data,
|
2014-01-17 11:49:39 -08:00
|
|
|
const uint64_t& offset) MOZ_OVERRIDE;
|
|
|
|
bool RecvOnStopRequest(const nsresult& statusCode) MOZ_OVERRIDE;
|
|
|
|
bool RecvCancelEarly(const nsresult& statusCode) MOZ_OVERRIDE;
|
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;
|
2013-01-11 06:40:25 -08:00
|
|
|
bool mSentAppData;
|
2013-06-04 16:10:55 -07:00
|
|
|
nsRefPtr<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
|