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 final : public nsILoadContextInfo { 17 public: 18 NS_DECL_THREADSAFE_ISUPPORTS 19 NS_DECL_NSILOADCONTEXTINFO 20 21 LoadContextInfo(bool aIsAnonymous, OriginAttributes aOriginAttributes); 22 23 private: 24 virtual ~LoadContextInfo() = default; 25 26 protected: 27 bool mIsAnonymous : 1; 28 OriginAttributes mOriginAttributes; 29 }; 30 31 class LoadContextInfoFactory : public nsILoadContextInfoFactory { 32 virtual ~LoadContextInfoFactory() = default; 33 34 public: 35 NS_DECL_ISUPPORTS // deliberately not thread-safe 36 NS_DECL_NSILOADCONTEXTINFOFACTORY 37 }; 38 39 LoadContextInfo* GetLoadContextInfo(nsIChannel* aChannel); 40 41 LoadContextInfo* GetLoadContextInfo(nsILoadContext* aLoadContext, 42 bool aIsAnonymous); 43 44 LoadContextInfo* GetLoadContextInfo(nsIDOMWindow* aLoadContext, 45 bool aIsAnonymous); 46 47 LoadContextInfo* GetLoadContextInfo(nsILoadContextInfo* aInfo); 48 49 LoadContextInfo* GetLoadContextInfo(bool const aIsAnonymous, 50 OriginAttributes const& aOriginAttributes); 51 52 } // namespace net 53 } // namespace mozilla 54 55 #endif 56