2002-01-31 22:35:33 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
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/. */
|
2002-01-31 22:35:33 +03:00
|
|
|
|
|
|
|
#ifndef nsWyciwygChannel_h___
|
|
|
|
#define nsWyciwygChannel_h___
|
|
|
|
|
|
|
|
#include "nsString.h"
|
2003-01-18 05:15:14 +03:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
|
|
|
#include "nsIWyciwygChannel.h"
|
2002-01-31 22:35:33 +03:00
|
|
|
#include "nsIStreamListener.h"
|
2013-12-18 20:06:40 +04:00
|
|
|
#include "nsICacheEntryOpenCallback.h"
|
2012-09-05 04:37:45 +04:00
|
|
|
#include "PrivateBrowsingChannel.h"
|
2002-01-31 22:35:33 +03:00
|
|
|
|
2013-12-18 20:06:40 +04:00
|
|
|
class nsICacheEntry;
|
2013-09-23 07:35:52 +04:00
|
|
|
class nsIEventTarget;
|
|
|
|
class nsIInputStream;
|
|
|
|
class nsIInputStreamPump;
|
|
|
|
class nsILoadGroup;
|
|
|
|
class nsIOutputStream;
|
|
|
|
class nsIProgressEventSink;
|
|
|
|
class nsIURI;
|
|
|
|
|
2002-01-31 22:35:33 +03:00
|
|
|
extern PRLogModuleInfo * gWyciwygLog;
|
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
//-----------------------------------------------------------------------------
|
2002-01-31 22:35:33 +03:00
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
class nsWyciwygChannel: public nsIWyciwygChannel,
|
2002-01-31 22:35:33 +03:00
|
|
|
public nsIStreamListener,
|
2013-12-18 20:06:40 +04:00
|
|
|
public nsICacheEntryOpenCallback,
|
2012-09-05 04:37:45 +04:00
|
|
|
public mozilla::net::PrivateBrowsingChannel<nsWyciwygChannel>
|
2002-01-31 22:35:33 +03:00
|
|
|
{
|
|
|
|
public:
|
2013-07-19 06:24:13 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2002-01-31 22:35:33 +03:00
|
|
|
NS_DECL_NSIREQUEST
|
|
|
|
NS_DECL_NSICHANNEL
|
|
|
|
NS_DECL_NSIWYCIWYGCHANNEL
|
2003-01-18 05:15:14 +03:00
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
2002-01-31 22:35:33 +03:00
|
|
|
NS_DECL_NSISTREAMLISTENER
|
2013-12-18 20:06:40 +04:00
|
|
|
NS_DECL_NSICACHEENTRYOPENCALLBACK
|
2002-01-31 22:35:33 +03:00
|
|
|
|
2010-11-23 15:01:30 +03:00
|
|
|
friend class nsWyciwygSetCharsetandSourceEvent;
|
|
|
|
friend class nsWyciwygWriteEvent;
|
|
|
|
friend class nsWyciwygCloseEvent;
|
|
|
|
|
2002-01-31 22:35:33 +03:00
|
|
|
// nsWyciwygChannel methods:
|
|
|
|
nsWyciwygChannel();
|
|
|
|
virtual ~nsWyciwygChannel();
|
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
nsresult Init(nsIURI *uri);
|
2002-01-31 22:35:33 +03:00
|
|
|
|
|
|
|
protected:
|
2013-12-18 20:06:40 +04:00
|
|
|
nsresult WriteToCacheEntryInternal(const nsAString& aData);
|
2010-11-23 15:01:30 +03:00
|
|
|
void SetCharsetAndSourceInternal();
|
|
|
|
nsresult CloseCacheEntryInternal(nsresult reason);
|
|
|
|
|
2002-01-31 22:35:33 +03:00
|
|
|
nsresult ReadFromCache();
|
2014-01-17 17:32:01 +04:00
|
|
|
nsresult EnsureWriteCacheEntry();
|
2013-12-18 20:06:40 +04:00
|
|
|
nsresult OpenCacheEntry(nsIURI *aURI, uint32_t aOpenFlags);
|
2007-08-25 05:45:15 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void WriteCharsetAndSourceToCache(int32_t aSource,
|
2007-08-25 05:45:15 +04:00
|
|
|
const nsCString& aCharset);
|
2008-01-05 09:48:12 +03:00
|
|
|
|
|
|
|
void NotifyListener();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsOnCacheIOThread();
|
2010-11-23 15:01:30 +03:00
|
|
|
|
2012-09-05 04:37:45 +04:00
|
|
|
friend class mozilla::net::PrivateBrowsingChannel<nsWyciwygChannel>;
|
|
|
|
|
2013-12-18 20:06:40 +04:00
|
|
|
enum EMode {
|
|
|
|
NONE,
|
|
|
|
WRITING,
|
|
|
|
READING
|
|
|
|
};
|
|
|
|
|
|
|
|
EMode mMode;
|
2004-05-10 01:37:32 +04:00
|
|
|
nsresult mStatus;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsPending;
|
|
|
|
bool mCharsetAndSourceSet;
|
|
|
|
bool mNeedToWriteCharset;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mCharsetSource;
|
2007-08-25 04:25:41 +04:00
|
|
|
nsCString mCharset;
|
2012-10-22 21:51:07 +04:00
|
|
|
int64_t mContentLength;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLoadFlags;
|
2013-01-11 18:40:25 +04:00
|
|
|
uint32_t mAppId;
|
|
|
|
bool mInBrowser;
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCOMPtr<nsIURI> mURI;
|
2002-01-31 22:35:33 +03:00
|
|
|
nsCOMPtr<nsIURI> mOriginalURI;
|
|
|
|
nsCOMPtr<nsISupports> mOwner;
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
|
|
|
nsCOMPtr<nsIProgressEventSink> mProgressSink;
|
|
|
|
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
2002-01-31 22:35:33 +03:00
|
|
|
nsCOMPtr<nsIStreamListener> mListener;
|
|
|
|
nsCOMPtr<nsISupports> mListenerContext;
|
2003-01-18 05:15:14 +03:00
|
|
|
|
|
|
|
// reuse as much of this channel implementation as we can
|
|
|
|
nsCOMPtr<nsIInputStreamPump> mPump;
|
2002-01-31 22:35:33 +03:00
|
|
|
|
|
|
|
// Cache related stuff
|
2013-12-18 20:06:40 +04:00
|
|
|
nsCOMPtr<nsICacheEntry> mCacheEntry;
|
2002-01-31 22:35:33 +03:00
|
|
|
nsCOMPtr<nsIOutputStream> mCacheOutputStream;
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCOMPtr<nsIInputStream> mCacheInputStream;
|
2010-11-23 15:01:30 +03:00
|
|
|
nsCOMPtr<nsIEventTarget> mCacheIOTarget;
|
2004-07-28 04:26:58 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> mSecurityInfo;
|
2002-01-31 22:35:33 +03:00
|
|
|
};
|
|
|
|
|
2002-01-31 23:39:17 +03:00
|
|
|
#endif /* nsWyciwygChannel_h___ */
|