michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 mozilla_dom_permission_message_utils_h__ michael@0: #define mozilla_dom_permission_message_utils_h__ michael@0: michael@0: #include "ipc/IPCMessageUtils.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIPrincipal.h" michael@0: michael@0: namespace IPC { michael@0: michael@0: class Principal { michael@0: friend struct ParamTraits; michael@0: michael@0: public: michael@0: Principal() : mPrincipal(nullptr) {} michael@0: Principal(nsIPrincipal* aPrincipal) : mPrincipal(aPrincipal) {} michael@0: operator nsIPrincipal*() const { return mPrincipal.get(); } michael@0: michael@0: private: michael@0: // Unimplemented michael@0: Principal& operator=(Principal&); michael@0: nsCOMPtr mPrincipal; michael@0: }; michael@0: michael@0: template <> michael@0: struct ParamTraits michael@0: { michael@0: typedef Principal paramType; michael@0: static void Write(Message* aMsg, const paramType& aParam); michael@0: static bool Read(const Message* aMsg, void** aIter, paramType* aResult); michael@0: }; michael@0: michael@0: } // namespace IPC michael@0: michael@0: #endif // mozilla_dom_permission_message_utils_h__ michael@0: