dom/ipc/PermissionMessageUtils.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/ipc/PermissionMessageUtils.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef mozilla_dom_permission_message_utils_h__
    1.10 +#define mozilla_dom_permission_message_utils_h__
    1.11 +
    1.12 +#include "ipc/IPCMessageUtils.h"
    1.13 +#include "nsCOMPtr.h"
    1.14 +#include "nsIPrincipal.h"
    1.15 +
    1.16 +namespace IPC {
    1.17 +
    1.18 +class Principal {
    1.19 +  friend struct ParamTraits<Principal>;
    1.20 +
    1.21 +public:
    1.22 +  Principal() : mPrincipal(nullptr) {}
    1.23 +  Principal(nsIPrincipal* aPrincipal) : mPrincipal(aPrincipal) {}
    1.24 +  operator nsIPrincipal*() const { return mPrincipal.get(); }
    1.25 +
    1.26 +private:
    1.27 +  // Unimplemented
    1.28 +  Principal& operator=(Principal&);
    1.29 +  nsCOMPtr<nsIPrincipal> mPrincipal;
    1.30 +};
    1.31 +
    1.32 +template <>
    1.33 +struct ParamTraits<Principal>
    1.34 +{
    1.35 +  typedef Principal paramType;
    1.36 +  static void Write(Message* aMsg, const paramType& aParam);
    1.37 +  static bool Read(const Message* aMsg, void** aIter, paramType* aResult);
    1.38 +};
    1.39 +
    1.40 +} // namespace IPC
    1.41 +
    1.42 +#endif // mozilla_dom_permission_message_utils_h__
    1.43 +

mercurial