This source file includes following definitions.
- usages
- create
- createNull
- handle
- type
- extractable
- algorithm
- usages
- isNull
- assign
- reset
#include "config.h"
#include "public/platform/WebCryptoKey.h"
#include "public/platform/WebCryptoAlgorithm.h"
#include "public/platform/WebCryptoAlgorithmParams.h"
#include "public/platform/WebCryptoKeyAlgorithm.h"
#include "wtf/OwnPtr.h"
#include "wtf/ThreadSafeRefCounted.h"
namespace blink {
class WebCryptoKeyPrivate : public ThreadSafeRefCounted<WebCryptoKeyPrivate> {
public:
WebCryptoKeyPrivate(PassOwnPtr<WebCryptoKeyHandle> handle, WebCryptoKeyType type, bool extractable, const WebCryptoKeyAlgorithm& algorithm, WebCryptoKeyUsageMask usages)
: handle(handle)
, type(type)
, extractable(extractable)
, algorithm(algorithm)
, usages(usages)
{
ASSERT(!algorithm.isNull());
}
const OwnPtr<WebCryptoKeyHandle> handle;
const WebCryptoKeyType type;
const bool extractable;
const WebCryptoKeyAlgorithm algorithm;
const WebCryptoKeyUsageMask usages;
};
WebCryptoKey WebCryptoKey::create(WebCryptoKeyHandle* handle, WebCryptoKeyType type, bool extractable, const WebCryptoKeyAlgorithm& algorithm, WebCryptoKeyUsageMask usages)
{
WebCryptoKey key;
key.m_private = adoptRef(new WebCryptoKeyPrivate(adoptPtr(handle), type, extractable, algorithm, usages));
return key;
}
WebCryptoKey WebCryptoKey::createNull()
{
return WebCryptoKey();
}
WebCryptoKeyHandle* WebCryptoKey::handle() const
{
ASSERT(!isNull());
return m_private->handle.get();
}
WebCryptoKeyType WebCryptoKey::type() const
{
ASSERT(!isNull());
return m_private->type;
}
bool WebCryptoKey::extractable() const
{
ASSERT(!isNull());
return m_private->extractable;
}
const WebCryptoKeyAlgorithm& WebCryptoKey::algorithm() const
{
ASSERT(!isNull());
return m_private->algorithm;
}
WebCryptoKeyUsageMask WebCryptoKey::usages() const
{
ASSERT(!isNull());
return m_private->usages;
}
bool WebCryptoKey::isNull() const
{
return m_private.isNull();
}
void WebCryptoKey::assign(const WebCryptoKey& other)
{
m_private = other.m_private;
}
void WebCryptoKey::reset()
{
m_private.reset();
}
}