|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #ifndef nsHostObjectURI_h |
|
6 #define nsHostObjectURI_h |
|
7 |
|
8 #include "mozilla/Attributes.h" |
|
9 #include "nsCOMPtr.h" |
|
10 #include "nsIClassInfo.h" |
|
11 #include "nsIPrincipal.h" |
|
12 #include "nsISerializable.h" |
|
13 #include "nsIURIWithPrincipal.h" |
|
14 #include "nsSimpleURI.h" |
|
15 |
|
16 /** |
|
17 * These URIs refer to host objects: Blobs, with scheme "blob", |
|
18 * MediaStreams, with scheme "mediastream", and MediaSources, with scheme |
|
19 * "mediasource". |
|
20 */ |
|
21 class nsHostObjectURI : public nsSimpleURI, |
|
22 public nsIURIWithPrincipal |
|
23 { |
|
24 public: |
|
25 nsHostObjectURI(nsIPrincipal* aPrincipal) : |
|
26 nsSimpleURI(), mPrincipal(aPrincipal) |
|
27 {} |
|
28 virtual ~nsHostObjectURI() {} |
|
29 |
|
30 // For use only from deserialization |
|
31 nsHostObjectURI() : nsSimpleURI() {} |
|
32 |
|
33 NS_DECL_ISUPPORTS_INHERITED |
|
34 NS_DECL_NSIURIWITHPRINCIPAL |
|
35 NS_DECL_NSISERIALIZABLE |
|
36 NS_DECL_NSICLASSINFO |
|
37 |
|
38 // Override CloneInternal() and EqualsInternal() |
|
39 virtual nsresult CloneInternal(RefHandlingEnum aRefHandlingMode, |
|
40 nsIURI** aClone) MOZ_OVERRIDE; |
|
41 virtual nsresult EqualsInternal(nsIURI* aOther, |
|
42 RefHandlingEnum aRefHandlingMode, |
|
43 bool* aResult) MOZ_OVERRIDE; |
|
44 |
|
45 // Override StartClone to hand back a nsHostObjectURI |
|
46 virtual nsSimpleURI* StartClone(RefHandlingEnum /* unused */) MOZ_OVERRIDE |
|
47 { return new nsHostObjectURI(); } |
|
48 |
|
49 nsCOMPtr<nsIPrincipal> mPrincipal; |
|
50 }; |
|
51 |
|
52 #define NS_HOSTOBJECTURI_CID \ |
|
53 { 0xf5475c51, 0x59a7, 0x4757, \ |
|
54 { 0xb3, 0xd9, 0xe2, 0x11, 0xa9, 0x41, 0x08, 0x72 } } |
|
55 |
|
56 #endif /* nsHostObjectURI_h */ |