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