Index: Source/modules/crypto/KeyAlgorithm.h |
diff --git a/Source/modules/crypto/Algorithm.h b/Source/modules/crypto/KeyAlgorithm.h |
similarity index 66% |
rename from Source/modules/crypto/Algorithm.h |
rename to Source/modules/crypto/KeyAlgorithm.h |
index b71e875ac6aaa9193931f60549e24053c446a380..81c292321b225bd1dbee7842e8a2aed50bb98c1b 100644 |
--- a/Source/modules/crypto/Algorithm.h |
+++ b/Source/modules/crypto/KeyAlgorithm.h |
@@ -28,34 +28,44 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef Algorithm_h |
-#define Algorithm_h |
+#ifndef KeyAlgorithm_h |
+#define KeyAlgorithm_h |
#include "bindings/v8/ScriptWrappable.h" |
#include "heap/Handle.h" |
-#include "public/platform/WebCryptoAlgorithm.h" |
+#include "public/platform/WebCryptoKeyAlgorithm.h" |
#include "wtf/Forward.h" |
#include "wtf/PassRefPtr.h" |
#include "wtf/RefCounted.h" |
namespace WebCore { |
-class Algorithm : public RefCountedWillBeGarbageCollectedFinalized<Algorithm>, public ScriptWrappable { |
+class KeyAlgorithm : public RefCountedWillBeGarbageCollectedFinalized<KeyAlgorithm>, public ScriptWrappable { |
public: |
- static PassRefPtrWillBeRawPtr<Algorithm> create(const blink::WebCryptoAlgorithm&); |
+ virtual ~KeyAlgorithm(); |
+ |
+ static PassRefPtrWillBeRawPtr<KeyAlgorithm> create(const blink::WebCryptoKeyAlgorithm&); |
+ static PassRefPtrWillBeRawPtr<KeyAlgorithm> createHash(const blink::WebCryptoAlgorithm&); |
String name(); |
- blink::WebCryptoAlgorithmParamsType type() const { return m_algorithm.paramsType(); } |
+ // Needed by SpecialWrapFor and for casting. |
+ bool isAesKeyAlgorithm() const; |
+ bool isHmacKeyAlgorithm() const; |
+ bool isRsaHashedKeyAlgorithm() const; |
+ bool isRsaKeyAlgorithm() const; |
- void trace(Visitor*) { } |
+ virtual void trace(Visitor*); |
protected: |
- explicit Algorithm(const blink::WebCryptoAlgorithm&); |
+ explicit KeyAlgorithm(const blink::WebCryptoKeyAlgorithm&); |
- const blink::WebCryptoAlgorithm m_algorithm; |
+ blink::WebCryptoKeyAlgorithm m_algorithm; |
}; |
+#define DEFINE_KEY_ALGORITHM_TYPE_CASTS(thisType) \ |
+ DEFINE_TYPE_CASTS(thisType, KeyAlgorithm, value, value->is##thisType(), value.is##thisType()) |
+ |
} // namespace WebCore |
#endif |