Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1814)

Unified Diff: Source/modules/crypto/RsaHashedKeyAlgorithm.cpp

Issue 179353002: [webcrypto] Add the KeyAlgorithm interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase yet again (another conflict) Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/crypto/RsaHashedKeyAlgorithm.h ('k') | Source/modules/crypto/RsaHashedKeyAlgorithm.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/RsaHashedKeyAlgorithm.cpp
diff --git a/Source/modules/crypto/Algorithm.cpp b/Source/modules/crypto/RsaHashedKeyAlgorithm.cpp
similarity index 70%
copy from Source/modules/crypto/Algorithm.cpp
copy to Source/modules/crypto/RsaHashedKeyAlgorithm.cpp
index 35568ff46e53cd840dc945fad6df50f12beff7be..482d7428015e604b56fa48d790410fec073c4415 100644
--- a/Source/modules/crypto/Algorithm.cpp
+++ b/Source/modules/crypto/RsaHashedKeyAlgorithm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,27 +29,35 @@
*/
#include "config.h"
-#include "modules/crypto/Algorithm.h"
+#include "modules/crypto/RsaHashedKeyAlgorithm.h"
#include "modules/crypto/NormalizeAlgorithm.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
-PassRefPtrWillBeRawPtr<Algorithm> Algorithm::create(const blink::WebCryptoAlgorithm& algorithm)
+PassRefPtrWillBeRawPtr<RsaHashedKeyAlgorithm> RsaHashedKeyAlgorithm::create(const blink::WebCryptoKeyAlgorithm& algorithm)
{
- return adoptRefWillBeNoop(new Algorithm(algorithm));
+ return adoptRefWillBeNoop(new RsaHashedKeyAlgorithm(algorithm));
}
-Algorithm::Algorithm(const blink::WebCryptoAlgorithm& algorithm)
- : m_algorithm(algorithm)
+KeyAlgorithm* RsaHashedKeyAlgorithm::hash()
{
- ScriptWrappable::init(this);
+ if (!m_hash)
+ m_hash = KeyAlgorithm::createHash(m_algorithm.rsaHashedParams()->hash());
+ return m_hash.get();
}
-String Algorithm::name()
+void RsaHashedKeyAlgorithm::trace(Visitor* visitor)
{
- return algorithmIdToName(m_algorithm.id());
+ RsaKeyAlgorithm::trace(visitor);
+ visitor->trace(m_hash);
+}
+
+RsaHashedKeyAlgorithm::RsaHashedKeyAlgorithm(const blink::WebCryptoKeyAlgorithm& algorithm)
+ : RsaKeyAlgorithm(algorithm)
+{
+ ScriptWrappable::init(this);
}
} // namespace WebCore
« no previous file with comments | « Source/modules/crypto/RsaHashedKeyAlgorithm.h ('k') | Source/modules/crypto/RsaHashedKeyAlgorithm.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698