Back to index

lightning-sunbird  0.9+nobinonly
nsWyciwygChannel.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef nsWyciwygChannel_h___
00040 #define nsWyciwygChannel_h___
00041 
00042 #include "nsWyciwygProtocolHandler.h"
00043 #include "nsXPIDLString.h"
00044 #include "nsString.h"
00045 #include "nsCOMPtr.h"
00046 #include "prlog.h"
00047 
00048 #include "nsIWyciwygChannel.h"
00049 #include "nsILoadGroup.h"
00050 #include "nsIOutputStream.h"
00051 #include "nsIInputStream.h"
00052 #include "nsIInputStreamPump.h"
00053 #include "nsIInterfaceRequestor.h"
00054 #include "nsIProgressEventSink.h"
00055 #include "nsIStreamListener.h"
00056 #include "nsICacheListener.h"
00057 #include "nsICacheEntryDescriptor.h"
00058 #include "nsIURI.h"
00059 
00060 extern PRLogModuleInfo * gWyciwygLog;
00061 
00062 //-----------------------------------------------------------------------------
00063 
00064 class nsWyciwygChannel: public nsIWyciwygChannel,
00065                         public nsIStreamListener,
00066                         public nsICacheListener
00067 {
00068 public:
00069     NS_DECL_ISUPPORTS
00070     NS_DECL_NSIREQUEST
00071     NS_DECL_NSICHANNEL
00072     NS_DECL_NSIWYCIWYGCHANNEL
00073     NS_DECL_NSIREQUESTOBSERVER
00074     NS_DECL_NSISTREAMLISTENER
00075     NS_DECL_NSICACHELISTENER
00076 
00077     // nsWyciwygChannel methods:
00078     nsWyciwygChannel();
00079     virtual ~nsWyciwygChannel();
00080 
00081     nsresult Init(nsIURI *uri);
00082 
00083 protected:
00084     nsresult ReadFromCache();
00085     nsresult OpenCacheEntry(const nsACString & aCacheKey, nsCacheAccessMode aWriteAccess, PRBool * aDelayFlag = nsnull);
00086        
00087     nsresult                            mStatus;
00088     PRBool                              mIsPending;
00089     PRInt32                             mContentLength;
00090     PRUint32                            mLoadFlags;
00091     nsCOMPtr<nsIURI>                    mURI;
00092     nsCOMPtr<nsIURI>                    mOriginalURI;
00093     nsCOMPtr<nsISupports>               mOwner;
00094     nsCOMPtr<nsIInterfaceRequestor>     mCallbacks;
00095     nsCOMPtr<nsIProgressEventSink>      mProgressSink;
00096     nsCOMPtr<nsILoadGroup>              mLoadGroup;
00097     nsCOMPtr<nsIStreamListener>         mListener;
00098     nsCOMPtr<nsISupports>               mListenerContext;
00099 
00100     // reuse as much of this channel implementation as we can
00101     nsCOMPtr<nsIInputStreamPump>        mPump;
00102     
00103     // Cache related stuff    
00104     nsCOMPtr<nsICacheEntryDescriptor>   mCacheEntry;
00105     nsCOMPtr<nsIOutputStream>           mCacheOutputStream;
00106     nsCOMPtr<nsIInputStream>            mCacheInputStream;
00107 
00108     nsCOMPtr<nsISupports>               mSecurityInfo;
00109 };
00110 
00111 #endif /* nsWyciwygChannel_h___ */