| Index: Source/core/platform/chromium/support/WebCryptoKey.cpp
|
| diff --git a/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp b/Source/core/platform/chromium/support/WebCryptoKey.cpp
|
| similarity index 52%
|
| copy from Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp
|
| copy to Source/core/platform/chromium/support/WebCryptoKey.cpp
|
| index 0ca2d40f74416e44425edef012e6487de724817d..a239917fd6674bf62d0eee18971552db0a8affab 100644
|
| --- a/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp
|
| +++ b/Source/core/platform/chromium/support/WebCryptoKey.cpp
|
| @@ -29,70 +29,70 @@
|
| */
|
|
|
| #include "config.h"
|
| -#include "public/platform/WebCryptoAlgorithm.h"
|
| +#include "public/platform/WebCryptoKey.h"
|
|
|
| -#include "public/platform/WebCryptoAlgorithmParams.h"
|
| +#include "public/platform/WebCryptoAlgorithm.h"
|
| #include "wtf/OwnPtr.h"
|
| #include "wtf/ThreadSafeRefCounted.h"
|
|
|
| namespace WebKit {
|
|
|
| -class WebCryptoAlgorithmPrivate : public ThreadSafeRefCounted<WebCryptoAlgorithmPrivate> {
|
| +class WebCryptoKeyPrivate : public ThreadSafeRefCounted<WebCryptoKeyPrivate> {
|
| public:
|
| - WebCryptoAlgorithmPrivate(WebCryptoAlgorithmId algorithmId, const char* algorithmName, PassOwnPtr<WebCryptoAlgorithmParams> params)
|
| - : algorithmId(algorithmId)
|
| - , algorithmName(algorithmName)
|
| - , params(params)
|
| + WebCryptoKeyPrivate(PassOwnPtr<WebCryptoKeyHandle> handle, WebCryptoKeyType type, bool extractable, const WebCryptoAlgorithm& algorithm, WebCryptoKeyUsageMask keyUsage)
|
| + : handle(handle)
|
| + , type(type)
|
| + , extractable(extractable)
|
| + , algorithm(algorithm)
|
| + , keyUsage(keyUsage)
|
| {
|
| }
|
|
|
| - WebCryptoAlgorithmId algorithmId;
|
| - const char* const algorithmName;
|
| - OwnPtr<WebCryptoAlgorithmParams> params;
|
| + const OwnPtr<WebCryptoKeyHandle> handle;
|
| + const WebCryptoKeyType type;
|
| + const bool extractable;
|
| + const WebCryptoAlgorithm algorithm;
|
| + const WebCryptoKeyUsageMask keyUsage;
|
| };
|
|
|
| -WebCryptoAlgorithm::WebCryptoAlgorithm(WebCryptoAlgorithmId algorithmId, const char* algorithmName, PassOwnPtr<WebCryptoAlgorithmParams> params)
|
| - : m_private(adoptRef(new WebCryptoAlgorithmPrivate(algorithmId, algorithmName, params)))
|
| +WebCryptoKey WebCryptoKey::create(WebCryptoKeyHandle* handle, WebCryptoKeyType type, bool extractable, const WebCryptoAlgorithm& algorithm, WebCryptoKeyUsageMask keyUsage)
|
| {
|
| + WebCryptoKey key;
|
| + key.m_private = adoptRef(new WebCryptoKeyPrivate(adoptPtr(handle), type, extractable, algorithm, keyUsage));
|
| + return key;
|
| }
|
|
|
| -WebCryptoAlgorithmId WebCryptoAlgorithm::algorithmId() const
|
| +WebCryptoKeyHandle* WebCryptoKey::handle() const
|
| {
|
| - return m_private->algorithmId;
|
| + return m_private->handle.get();
|
| }
|
|
|
| -const char* WebCryptoAlgorithm::algorithmName() const
|
| +WebCryptoKeyType WebCryptoKey::type() const
|
| {
|
| - return m_private->algorithmName;
|
| + return m_private->type;
|
| }
|
|
|
| -WebCryptoAlgorithmParamsType WebCryptoAlgorithm::paramsType() const
|
| +bool WebCryptoKey::extractable() const
|
| {
|
| - if (!m_private->params)
|
| - return WebCryptoAlgorithmParamsTypeNone;
|
| - return m_private->params->type();
|
| + return m_private->extractable;
|
| }
|
|
|
| -WebCryptoAesCbcParams* WebCryptoAlgorithm::aesCbcParams() const
|
| +const WebCryptoAlgorithm& WebCryptoKey::algorithm() const
|
| {
|
| - if (paramsType() == WebCryptoAlgorithmParamsTypeAesCbcParams)
|
| - return static_cast<WebCryptoAesCbcParams*>(m_private->params.get());
|
| - return 0;
|
| + return m_private->algorithm;
|
| }
|
|
|
| -WebCryptoAesKeyGenParams* WebCryptoAlgorithm::aesKeyGenParams() const
|
| +WebCryptoKeyUsageMask WebCryptoKey::keyUsage() const
|
| {
|
| - if (paramsType() == WebCryptoAlgorithmParamsTypeAesKeyGenParams)
|
| - return static_cast<WebCryptoAesKeyGenParams*>(m_private->params.get());
|
| - return 0;
|
| + return m_private->keyUsage;
|
| }
|
|
|
| -void WebCryptoAlgorithm::assign(const WebCryptoAlgorithm& other)
|
| +void WebCryptoKey::assign(const WebCryptoKey& other)
|
| {
|
| m_private = other.m_private;
|
| }
|
|
|
| -void WebCryptoAlgorithm::reset()
|
| +void WebCryptoKey::reset()
|
| {
|
| m_private.reset();
|
| }
|
|
|