dom/media/gmp/GMPUtils.h
author Chris Pearce <cpearce@mozilla.com>
Thu, 15 Oct 2015 09:56:42 +1300
changeset 607012 aa99936362c2dbef1886f67d32641199bae838ec
parent 602456 f7fb82b98052509b881a6c28de2755fbaba1969f
child 606754 124a9a85a16640cc26c54a362aeae860f3368066
permissions -rw-r--r--
Bug 1214505 - Backout f7fb82b98052 and afac098c635f from m-a. r=backout,a=slyvestre

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef GMPUtils_h_
#define GMPUtils_h_

#include "mozilla/UniquePtr.h"
#include "nsTArray.h"

class nsIFile;
class nsCString;

namespace mozilla {

template<typename T>
struct DestroyPolicy
{
  void operator()(T* aGMPObject) const {
    aGMPObject->Destroy();
  }
};

template<typename T>
using GMPUniquePtr = mozilla::UniquePtr<T, DestroyPolicy<T>>;

bool GetEMEVoucherPath(nsIFile** aPath);

bool EMEVoucherFileExists();

void
SplitAt(const char* aDelims,
        const nsACString& aInput,
        nsTArray<nsCString>& aOutTokens);

nsCString
ToBase64(const nsTArray<uint8_t>& aBytes);

} // namespace mozilla

#endif