Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsJARChannel_h__
7 #define nsJARChannel_h__
9 #include "nsIJARChannel.h"
10 #include "nsIJARURI.h"
11 #include "nsIInputStreamPump.h"
12 #include "nsIInterfaceRequestor.h"
13 #include "nsIProgressEventSink.h"
14 #include "nsIStreamListener.h"
15 #include "nsIRemoteOpenFileListener.h"
16 #include "nsIZipReader.h"
17 #include "nsIDownloader.h"
18 #include "nsILoadGroup.h"
19 #include "nsHashPropertyBag.h"
20 #include "nsIFile.h"
21 #include "nsIURI.h"
22 #include "nsCOMPtr.h"
23 #include "nsString.h"
24 #include "prlog.h"
26 class nsJARInputThunk;
28 //-----------------------------------------------------------------------------
30 class nsJARChannel : public nsIJARChannel
31 , public nsIDownloadObserver
32 , public nsIStreamListener
33 , public nsIRemoteOpenFileListener
34 , public nsHashPropertyBag
35 {
36 public:
37 NS_DECL_THREADSAFE_ISUPPORTS
38 NS_DECL_NSIREQUEST
39 NS_DECL_NSICHANNEL
40 NS_DECL_NSIJARCHANNEL
41 NS_DECL_NSIDOWNLOADOBSERVER
42 NS_DECL_NSIREQUESTOBSERVER
43 NS_DECL_NSISTREAMLISTENER
44 NS_DECL_NSIREMOTEOPENFILELISTENER
46 nsJARChannel();
47 virtual ~nsJARChannel();
49 nsresult Init(nsIURI *uri);
51 private:
52 nsresult CreateJarInput(nsIZipReaderCache *, nsJARInputThunk **);
53 nsresult LookupFile();
54 nsresult OpenLocalFile();
55 void NotifyError(nsresult aError);
57 #if defined(PR_LOGGING)
58 nsCString mSpec;
59 #endif
61 bool mOpened;
63 nsCOMPtr<nsIJARURI> mJarURI;
64 nsCOMPtr<nsIURI> mOriginalURI;
65 nsCOMPtr<nsIURI> mAppURI;
66 nsCOMPtr<nsISupports> mOwner;
67 nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
68 nsCOMPtr<nsISupports> mSecurityInfo;
69 nsCOMPtr<nsIProgressEventSink> mProgressSink;
70 nsCOMPtr<nsILoadGroup> mLoadGroup;
71 nsCOMPtr<nsIStreamListener> mListener;
72 nsCOMPtr<nsISupports> mListenerContext;
73 nsCString mContentType;
74 nsCString mContentCharset;
75 nsCString mContentDispositionHeader;
76 /* mContentDisposition is uninitialized if mContentDispositionHeader is
77 * empty */
78 uint32_t mContentDisposition;
79 int64_t mContentLength;
80 uint32_t mLoadFlags;
81 nsresult mStatus;
82 bool mIsPending;
83 bool mIsUnsafe;
84 bool mOpeningRemote;
86 nsCOMPtr<nsIStreamListener> mDownloader;
87 nsCOMPtr<nsIInputStreamPump> mPump;
88 nsCOMPtr<nsIFile> mJarFile;
89 nsCOMPtr<nsIURI> mJarBaseURI;
90 nsCString mJarEntry;
91 nsCString mInnerJarEntry;
92 };
94 #endif // nsJARChannel_h__