Index: Source/modules/crypto/Algorithm.cpp |
diff --git a/Source/modules/crypto/Algorithm.cpp b/Source/modules/crypto/Algorithm.cpp |
index c6a9b8e3b5296b68683bbf241b1745938bba2630..a541110040a08af63d25bfa889e1237d4e28ea2f 100644 |
--- a/Source/modules/crypto/Algorithm.cpp |
+++ b/Source/modules/crypto/Algorithm.cpp |
@@ -31,19 +31,34 @@ |
#include "config.h" |
#include "modules/crypto/Algorithm.h" |
+#include "modules/crypto/AesCbcParams.h" |
+#include "modules/crypto/AesKeyGenParams.h" |
+ |
namespace WebCore { |
+PassRefPtr<Algorithm> Algorithm::create(const WebKit::WebCryptoAlgorithm& algorithm) |
+{ |
+ switch (algorithm.paramsType()) { |
+ case WebKit::WebCryptoAlgorithmParamsTypeNone: |
+ return adoptRef(new Algorithm(algorithm)); |
+ case WebKit::WebCryptoAlgorithmParamsTypeAesCbcParams: |
+ return AesCbcParams::create(algorithm); |
+ case WebKit::WebCryptoAlgorithmParamsTypeAesKeyGenParams: |
+ return AesKeyGenParams::create(algorithm); |
+ } |
+ ASSERT_NOT_REACHED(); |
+ return 0; |
+} |
+ |
Algorithm::Algorithm(const WebKit::WebCryptoAlgorithm& algorithm) |
: m_algorithm(algorithm) |
{ |
ScriptWrappable::init(this); |
} |
-const String& Algorithm::name() |
+String Algorithm::name() |
{ |
- if (m_name.isNull()) |
- m_name = m_algorithm.algorithmName(); |
- return m_name; |
+ return ASCIILiteral(m_algorithm.algorithmName()); |
} |
} // namespace WebCore |