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

Unified Diff: Source/modules/crypto/NormalizeAlgorithm.h

Issue 295423004: Expose WebCrypto's algorithm normalization. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
Index: Source/modules/crypto/NormalizeAlgorithm.h
diff --git a/Source/modules/crypto/NormalizeAlgorithm.h b/Source/modules/crypto/NormalizeAlgorithm.h
index 65e5ff17dea9ccec3842cbe146cabca7bfcd7a4c..b4fe7a6b170325533299320857d785ace8769ecf 100644
--- a/Source/modules/crypto/NormalizeAlgorithm.h
+++ b/Source/modules/crypto/NormalizeAlgorithm.h
@@ -31,7 +31,10 @@
#ifndef NormalizeAlgorithm_h
#define NormalizeAlgorithm_h
+#include "public/platform/WebCrypto.h"
#include "public/platform/WebCryptoAlgorithm.h"
+#include "public/platform/WebCryptoAlgorithmOperation.h"
+#include "public/platform/WebString.h"
#include "wtf/Assertions.h"
#include "wtf/Forward.h"
@@ -39,23 +42,11 @@ namespace blink { class WebCryptoAlgorithm; }
namespace WebCore {
-class CryptoResult;
class Dictionary;
-enum AlgorithmOperation {
- Encrypt,
- Decrypt,
- Sign,
- Verify,
- Digest,
- GenerateKey,
- ImportKey,
- DeriveKey,
- DeriveBits,
- WrapKey,
- UnwrapKey,
- // <---- End of list (keep this up-to-date)
- LastAlgorithmOperation = UnwrapKey,
+struct AlgorithmError {
+ blink::WebCryptoErrorType errorType;
+ blink::WebString errorDetails;
};
// Converts a javascript Dictionary to a WebCryptoAlgorithm object.
@@ -65,11 +56,11 @@ enum AlgorithmOperation {
//
// On success returns true and sets the WebCryptoAlgorithm.
//
-// On failure parseAlgorithm returns false and completes the CryptoResult
-// with a (non-localized) debug string.
+// On failure normalizeAlgorithm returns false and sets the AlgorithmError with
+// a error type and a (non-localized) debug string.
//
// [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules
-bool parseAlgorithm(const Dictionary&, AlgorithmOperation, blink::WebCryptoAlgorithm&, CryptoResult*) WARN_UNUSED_RETURN;
+bool normalizeAlgorithm(const Dictionary&, blink::AlgorithmOperation, blink::WebCryptoAlgorithm&, AlgorithmError*) WARN_UNUSED_RETURN;
// Returns a null-terminated C-string literal. Caller can assume the pointer
// will be valid for the program's entire runtime.

Powered by Google App Engine
This is Rietveld 408576698