2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsWyciwygChannel_h___
|
|
|
|
#define nsWyciwygChannel_h___
|
|
|
|
|
|
|
|
#include "nsWyciwygProtocolHandler.h"
|
|
|
|
#include "nsXPIDLString.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
|
|
|
#include "nsIWyciwygChannel.h"
|
|
|
|
#include "nsILoadGroup.h"
|
|
|
|
#include "nsIOutputStream.h"
|
|
|
|
#include "nsIInputStream.h"
|
|
|
|
#include "nsIInputStreamPump.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIProgressEventSink.h"
|
|
|
|
#include "nsIStreamListener.h"
|
|
|
|
#include "nsICacheListener.h"
|
|
|
|
#include "nsICacheEntryDescriptor.h"
|
|
|
|
#include "nsIURI.h"
|
2010-11-23 04:01:30 -08:00
|
|
|
#include "nsIEventTarget.h"
|
2012-05-24 08:31:54 -07:00
|
|
|
#include "PrivateBrowsingConsumer.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
extern PRLogModuleInfo * gWyciwygLog;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class nsWyciwygChannel: public nsIWyciwygChannel,
|
|
|
|
public nsIStreamListener,
|
2012-05-24 08:31:54 -07:00
|
|
|
public nsICacheListener,
|
|
|
|
public mozilla::net::PrivateBrowsingConsumer
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIREQUEST
|
|
|
|
NS_DECL_NSICHANNEL
|
|
|
|
NS_DECL_NSIWYCIWYGCHANNEL
|
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
|
|
|
NS_DECL_NSISTREAMLISTENER
|
|
|
|
NS_DECL_NSICACHELISTENER
|
|
|
|
|
2010-11-23 04:01:30 -08:00
|
|
|
friend class nsWyciwygSetCharsetandSourceEvent;
|
|
|
|
friend class nsWyciwygWriteEvent;
|
|
|
|
friend class nsWyciwygCloseEvent;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsWyciwygChannel methods:
|
|
|
|
nsWyciwygChannel();
|
|
|
|
virtual ~nsWyciwygChannel();
|
|
|
|
|
|
|
|
nsresult Init(nsIURI *uri);
|
|
|
|
|
|
|
|
protected:
|
2010-11-23 04:01:30 -08:00
|
|
|
nsresult WriteToCacheEntryInternal(const nsAString& aData, const nsACString& spec);
|
|
|
|
void SetCharsetAndSourceInternal();
|
|
|
|
nsresult CloseCacheEntryInternal(nsresult reason);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult ReadFromCache();
|
2010-11-23 04:01:30 -08:00
|
|
|
nsresult OpenCacheEntry(const nsACString & aCacheKey, nsCacheAccessMode aWriteAccess);
|
2007-08-24 18:45:15 -07:00
|
|
|
|
|
|
|
void WriteCharsetAndSourceToCache(PRInt32 aSource,
|
|
|
|
const nsCString& aCharset);
|
2008-01-04 22:48:12 -08:00
|
|
|
|
|
|
|
void NotifyListener();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsOnCacheIOThread();
|
2010-11-23 04:01:30 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult mStatus;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsPending;
|
|
|
|
bool mCharsetAndSourceSet;
|
|
|
|
bool mNeedToWriteCharset;
|
2012-05-24 08:31:54 -07:00
|
|
|
bool mPrivate;
|
2007-08-24 17:25:41 -07:00
|
|
|
PRInt32 mCharsetSource;
|
|
|
|
nsCString mCharset;
|
2010-08-30 13:20:39 -07:00
|
|
|
PRInt32 mContentLength;
|
2007-03-22 10:30:00 -07:00
|
|
|
PRUint32 mLoadFlags;
|
|
|
|
nsCOMPtr<nsIURI> mURI;
|
|
|
|
nsCOMPtr<nsIURI> mOriginalURI;
|
|
|
|
nsCOMPtr<nsISupports> mOwner;
|
|
|
|
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
|
|
|
nsCOMPtr<nsIProgressEventSink> mProgressSink;
|
|
|
|
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
|
|
|
nsCOMPtr<nsIStreamListener> mListener;
|
|
|
|
nsCOMPtr<nsISupports> mListenerContext;
|
|
|
|
|
|
|
|
// reuse as much of this channel implementation as we can
|
|
|
|
nsCOMPtr<nsIInputStreamPump> mPump;
|
|
|
|
|
|
|
|
// Cache related stuff
|
|
|
|
nsCOMPtr<nsICacheEntryDescriptor> mCacheEntry;
|
|
|
|
nsCOMPtr<nsIOutputStream> mCacheOutputStream;
|
|
|
|
nsCOMPtr<nsIInputStream> mCacheInputStream;
|
2010-11-23 04:01:30 -08:00
|
|
|
nsCOMPtr<nsIEventTarget> mCacheIOTarget;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> mSecurityInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsWyciwygChannel_h___ */
|