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
michael@0 | 1 | /* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef nsJARURI_h__ |
michael@0 | 8 | #define nsJARURI_h__ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsIJARURI.h" |
michael@0 | 11 | #include "nsISerializable.h" |
michael@0 | 12 | #include "nsIClassInfo.h" |
michael@0 | 13 | #include "nsCOMPtr.h" |
michael@0 | 14 | #include "nsString.h" |
michael@0 | 15 | #include "nsINestedURI.h" |
michael@0 | 16 | #include "nsIIPCSerializableURI.h" |
michael@0 | 17 | |
michael@0 | 18 | #define NS_THIS_JARURI_IMPL_CID \ |
michael@0 | 19 | { /* 9a55f629-730b-4d08-b75b-fa7d9570a691 */ \ |
michael@0 | 20 | 0x9a55f629, \ |
michael@0 | 21 | 0x730b, \ |
michael@0 | 22 | 0x4d08, \ |
michael@0 | 23 | {0xb7, 0x5b, 0xfa, 0x7d, 0x95, 0x70, 0xa6, 0x91} \ |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | #define NS_JARURI_CID \ |
michael@0 | 27 | { /* 245abae2-b947-4ded-a46d-9829d3cca462 */ \ |
michael@0 | 28 | 0x245abae2, \ |
michael@0 | 29 | 0xb947, \ |
michael@0 | 30 | 0x4ded, \ |
michael@0 | 31 | {0xa4, 0x6d, 0x98, 0x29, 0xd3, 0xcc, 0xa4, 0x62} \ |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | |
michael@0 | 35 | class nsJARURI : public nsIJARURI, |
michael@0 | 36 | public nsISerializable, |
michael@0 | 37 | public nsIClassInfo, |
michael@0 | 38 | public nsINestedURI, |
michael@0 | 39 | public nsIIPCSerializableURI |
michael@0 | 40 | { |
michael@0 | 41 | public: |
michael@0 | 42 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 43 | NS_DECL_NSIURI |
michael@0 | 44 | NS_DECL_NSIURL |
michael@0 | 45 | NS_DECL_NSIJARURI |
michael@0 | 46 | NS_DECL_NSISERIALIZABLE |
michael@0 | 47 | NS_DECL_NSICLASSINFO |
michael@0 | 48 | NS_DECL_NSINESTEDURI |
michael@0 | 49 | NS_DECL_NSIIPCSERIALIZABLEURI |
michael@0 | 50 | |
michael@0 | 51 | NS_DECLARE_STATIC_IID_ACCESSOR(NS_THIS_JARURI_IMPL_CID) |
michael@0 | 52 | |
michael@0 | 53 | // nsJARURI |
michael@0 | 54 | nsJARURI(); |
michael@0 | 55 | virtual ~nsJARURI(); |
michael@0 | 56 | |
michael@0 | 57 | nsresult Init(const char *charsetHint); |
michael@0 | 58 | nsresult FormatSpec(const nsACString &entryPath, nsACString &result, |
michael@0 | 59 | bool aIncludeScheme = true); |
michael@0 | 60 | nsresult CreateEntryURL(const nsACString& entryFilename, |
michael@0 | 61 | const char* charset, |
michael@0 | 62 | nsIURL** url); |
michael@0 | 63 | nsresult SetSpecWithBase(const nsACString& aSpec, nsIURI* aBaseURL); |
michael@0 | 64 | |
michael@0 | 65 | protected: |
michael@0 | 66 | // enum used in a few places to specify how .ref attribute should be handled |
michael@0 | 67 | enum RefHandlingEnum { |
michael@0 | 68 | eIgnoreRef, |
michael@0 | 69 | eHonorRef |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | // Helper to share code between Equals methods. |
michael@0 | 73 | virtual nsresult EqualsInternal(nsIURI* other, |
michael@0 | 74 | RefHandlingEnum refHandlingMode, |
michael@0 | 75 | bool* result); |
michael@0 | 76 | |
michael@0 | 77 | // Helper to share code between Clone methods. |
michael@0 | 78 | nsresult CloneWithJARFileInternal(nsIURI *jarFile, |
michael@0 | 79 | RefHandlingEnum refHandlingMode, |
michael@0 | 80 | nsIJARURI **result); |
michael@0 | 81 | nsCOMPtr<nsIURI> mJARFile; |
michael@0 | 82 | // mJarEntry stored as a URL so that we can easily access things |
michael@0 | 83 | // like extensions, refs, etc. |
michael@0 | 84 | nsCOMPtr<nsIURL> mJAREntry; |
michael@0 | 85 | nsCString mCharsetHint; |
michael@0 | 86 | }; |
michael@0 | 87 | |
michael@0 | 88 | NS_DEFINE_STATIC_IID_ACCESSOR(nsJARURI, NS_THIS_JARURI_IMPL_CID) |
michael@0 | 89 | |
michael@0 | 90 | #endif // nsJARURI_h__ |