| Index: Source/modules/crypto/CryptoOperation.cpp
|
| diff --git a/Source/core/fileapi/Stream.cpp b/Source/modules/crypto/CryptoOperation.cpp
|
| similarity index 64%
|
| copy from Source/core/fileapi/Stream.cpp
|
| copy to Source/modules/crypto/CryptoOperation.cpp
|
| index 2400e2b69665d8e532eb642d6bab50f41c276bbb..a3a9fd7495cafe35784db42593cf357e61d833d9 100644
|
| --- a/Source/core/fileapi/Stream.cpp
|
| +++ b/Source/modules/crypto/CryptoOperation.cpp
|
| @@ -29,42 +29,43 @@
|
| */
|
|
|
| #include "config.h"
|
| -#include "core/fileapi/Stream.h"
|
| +#include "modules/crypto/CryptoOperation.h"
|
|
|
| -#include "core/fileapi/BlobRegistry.h"
|
| -#include "core/fileapi/BlobURL.h"
|
| -#include "core/platform/network/BlobData.h"
|
| +#include "modules/crypto/AesCbcParams.h"
|
| +#include "modules/crypto/AesKeyGenParams.h"
|
| +#include "modules/crypto/Algorithm.h"
|
|
|
| namespace WebCore {
|
|
|
| -Stream::Stream(const String& mediaType)
|
| - : m_mediaType(mediaType)
|
| - , m_isNeutered(false)
|
| -{
|
| - ScriptWrappable::init(this);
|
| -
|
| - // Create a new internal URL for a stream and register it with the provided
|
| - // media type.
|
| - m_internalURL = BlobURL::createInternalURL();
|
| - BlobRegistry::registerStreamURL(m_internalURL, m_mediaType);
|
| -}
|
| +namespace {
|
|
|
| -void Stream::addData(const char* data, size_t len)
|
| +PassRefPtr<Algorithm> createAlgorithm(const WebKit::WebCryptoAlgorithm& algorithm)
|
| {
|
| - RefPtr<RawData> buffer(RawData::create());
|
| - buffer->mutableData()->resize(len);
|
| - memcpy(buffer->mutableData()->data(), data, len);
|
| - BlobRegistry::addDataToStream(m_internalURL, buffer);
|
| + switch (algorithm.paramsType()) {
|
| + case WebKit::WebCryptoAlgorithmParamsTypeNone:
|
| + return Algorithm::create(algorithm);
|
| + case WebKit::WebCryptoAlgorithmParamsTypeAesCbcParams:
|
| + return AesCbcParams::create(algorithm);
|
| + case WebKit::WebCryptoAlgorithmParamsTypeAesKeyGenParams:
|
| + return AesKeyGenParams::create(algorithm);
|
| + }
|
| + ASSERT_NOT_REACHED();
|
| + return 0;
|
| }
|
|
|
| -void Stream::finalize()
|
| +} // namespace
|
| +
|
| +CryptoOperation::CryptoOperation(const WebKit::WebCryptoAlgorithm& algorithm)
|
| + : m_algorithm(algorithm)
|
| {
|
| - BlobRegistry::finalizeStream(m_internalURL);
|
| + ScriptWrappable::init(this);
|
| }
|
|
|
| -Stream::~Stream()
|
| +Algorithm* CryptoOperation::algorithm()
|
| {
|
| - BlobRegistry::unregisterBlobURL(m_internalURL);
|
| + if (!m_algorithmNode)
|
| + m_algorithmNode = createAlgorithm(m_algorithm);
|
| + return m_algorithmNode.get();
|
| }
|
|
|
| } // namespace WebCore
|
|
|