PermissionDelegateIPCUtils.h (1165B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_permissiondelegateipcutils_h 8 #define mozilla_permissiondelegateipcutils_h 9 10 #include "ipc/IPCMessageUtils.h" 11 12 #include "mozilla/PermissionDelegateHandler.h" 13 14 namespace IPC { 15 16 template <> 17 struct ParamTraits< 18 mozilla::PermissionDelegateHandler::DelegatedPermissionList> { 19 typedef mozilla::PermissionDelegateHandler::DelegatedPermissionList paramType; 20 21 static void Write(MessageWriter* aWriter, const paramType& aParam) { 22 for (auto& permission : aParam.mPermissions) { 23 WriteParam(aWriter, permission); 24 } 25 } 26 27 static bool Read(MessageReader* aReader, paramType* aResult) { 28 for (auto& permission : aResult->mPermissions) { 29 if (!ReadParam(aReader, &permission)) { 30 return false; 31 } 32 } 33 34 return true; 35 } 36 }; 37 38 } // namespace IPC 39 40 #endif // mozilla_permissiondelegateipcutils_h