1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef mozilla_Permission_h 7 #define mozilla_Permission_h 8 9 #include "nsIPermission.h" 10 #include "nsCOMPtr.h" 11 #include "nsString.h" 12 13 namespace mozilla { 14 15 //////////////////////////////////////////////////////////////////////////////// 16 17 class Permission : public nsIPermission { 18 public: 19 // nsISupports 20 NS_DECL_ISUPPORTS 21 NS_DECL_NSIPERMISSION 22 23 static already_AddRefed<Permission> Create( 24 nsIPrincipal* aPrincipal, const nsACString& aType, uint32_t aCapability, 25 uint32_t aExpireType, int64_t aExpireTime, int64_t aModificationTime); 26 27 // This method creates a new nsIPrincipal with a stripped OriginAttributes (no 28 // userContextId) and a content principal equal to the origin of 'aPrincipal'. 29 static already_AddRefed<nsIPrincipal> ClonePrincipalForPermission( 30 nsIPrincipal* aPrincipal); 31 32 protected: 33 Permission(nsIPrincipal* aPrincipal, const nsACString& aType, 34 uint32_t aCapability, uint32_t aExpireType, int64_t aExpireTime, 35 int64_t aModificationTime); 36 37 virtual ~Permission() = default; 38 39 nsCOMPtr<nsIPrincipal> mPrincipal; 40 nsCString mType; 41 uint32_t mCapability; 42 uint32_t mExpireType; 43 int64_t mExpireTime; 44 int64_t mModificationTime; 45 }; 46 47 } // namespace mozilla 48 49 #endif // mozilla_Permission_h 50