michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsContentPermissionHelper_h michael@0: #define nsContentPermissionHelper_h michael@0: michael@0: #include "nsIContentPermissionPrompt.h" michael@0: #include "nsTArray.h" michael@0: #include "nsIMutableArray.h" michael@0: michael@0: class nsContentPermissionRequestProxy; michael@0: michael@0: // Forward declare IPC::Principal here which is defined in michael@0: // PermissionMessageUtils.h. Include this file will transitively includes michael@0: // "windows.h" and it defines michael@0: // #define CreateEvent CreateEventW michael@0: // #define LoadImage LoadImageW michael@0: // That will mess up windows build. michael@0: namespace IPC { michael@0: class Principal; michael@0: } michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class Element; michael@0: class PermissionRequest; michael@0: class ContentPermissionRequestParent; michael@0: class PContentPermissionRequestParent; michael@0: michael@0: class ContentPermissionType : public nsIContentPermissionType michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSICONTENTPERMISSIONTYPE michael@0: michael@0: ContentPermissionType(const nsACString& aType, michael@0: const nsACString& aAccess, michael@0: const nsTArray& aOptions); michael@0: virtual ~ContentPermissionType(); michael@0: michael@0: protected: michael@0: nsCString mType; michael@0: nsCString mAccess; michael@0: nsTArray mOptions; michael@0: }; michael@0: michael@0: uint32_t ConvertPermissionRequestToArray(nsTArray& aSrcArray, michael@0: nsIMutableArray* aDesArray); michael@0: michael@0: nsresult CreatePermissionArray(const nsACString& aType, michael@0: const nsACString& aAccess, michael@0: const nsTArray& aOptions, michael@0: nsIArray** aTypesArray); michael@0: michael@0: PContentPermissionRequestParent* michael@0: CreateContentPermissionRequestParent(const nsTArray& aRequests, michael@0: Element* element, michael@0: const IPC::Principal& principal); michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: class nsContentPermissionRequestProxy : public nsIContentPermissionRequest michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSICONTENTPERMISSIONREQUEST michael@0: michael@0: nsContentPermissionRequestProxy(); michael@0: virtual ~nsContentPermissionRequestProxy(); michael@0: michael@0: nsresult Init(const nsTArray& requests, michael@0: mozilla::dom::ContentPermissionRequestParent* parent); michael@0: void OnParentDestroyed(); michael@0: michael@0: private: michael@0: // Non-owning pointer to the ContentPermissionRequestParent object which owns this proxy. michael@0: mozilla::dom::ContentPermissionRequestParent* mParent; michael@0: nsTArray mPermissionRequests; michael@0: }; michael@0: michael@0: #endif // nsContentPermissionHelper_h