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 nsLoadContextInfo_h__
6 #define nsLoadContextInfo_h__
7 
8 #include "nsILoadContextInfo.h"
9 
10 class nsIChannel;
11 class nsILoadContext;
12 
13 namespace mozilla {
14 namespace net {
15 
16 class LoadContextInfo : public nsILoadContextInfo
17 {
18 public:
19   NS_DECL_THREADSAFE_ISUPPORTS
20   NS_DECL_NSILOADCONTEXTINFO
21 
22   LoadContextInfo(bool aIsAnonymous, NeckoOriginAttributes aOriginAttributes);
23 
24 private:
25   virtual ~LoadContextInfo();
26 
27 protected:
28   bool mIsAnonymous : 1;
29   NeckoOriginAttributes mOriginAttributes;
30 };
31 
32 class LoadContextInfoFactory : public nsILoadContextInfoFactory
33 {
~LoadContextInfoFactory()34   virtual ~LoadContextInfoFactory() {}
35 public:
36   NS_DECL_ISUPPORTS // deliberately not thread-safe
37   NS_DECL_NSILOADCONTEXTINFOFACTORY
38 };
39 
40 LoadContextInfo*
41 GetLoadContextInfo(nsIChannel *aChannel);
42 
43 LoadContextInfo*
44 GetLoadContextInfo(nsILoadContext *aLoadContext,
45                    bool aIsAnonymous);
46 
47 LoadContextInfo*
48 GetLoadContextInfo(nsIDOMWindow *aLoadContext,
49                    bool aIsAnonymous);
50 
51 LoadContextInfo*
52 GetLoadContextInfo(nsILoadContextInfo *aInfo);
53 
54 LoadContextInfo*
55 GetLoadContextInfo(bool const aIsAnonymous,
56                    NeckoOriginAttributes const &aOriginAttributes);
57 
58 } // namespace net
59 } // namespace mozilla
60 
61 #endif
62