OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "config.h" | 31 #include "config.h" |
32 #include "public/web/WebCryptoNormalize.h" | 32 #include "public/web/WebCryptoNormalize.h" |
33 | 33 |
34 #include "bindings/core/v8/Dictionary.h" | 34 #include "bindings/core/v8/Dictionary.h" |
35 #include "modules/crypto/CryptoResultImpl.h" | 35 #include "modules/crypto/CryptoResultImpl.h" |
36 #include "modules/crypto/NormalizeAlgorithm.h" | 36 #include "modules/crypto/NormalizeAlgorithm.h" |
37 #include "platform/CryptoResult.h" | 37 #include "platform/CryptoResult.h" |
38 #include "public/platform/WebString.h" | 38 #include "public/platform/WebString.h" |
39 #include <v8.h> | 39 #include <v8.h> |
40 | 40 |
41 using namespace blink; | |
42 | |
43 namespace blink { | 41 namespace blink { |
44 | 42 |
45 | |
46 WebCryptoAlgorithm normalizeCryptoAlgorithm(v8::Handle<v8::Object> algorithmObje
ct, WebCryptoOperation operation, int* exceptionCode, WebString* errorDetails, v
8::Isolate* isolate) | 43 WebCryptoAlgorithm normalizeCryptoAlgorithm(v8::Handle<v8::Object> algorithmObje
ct, WebCryptoOperation operation, int* exceptionCode, WebString* errorDetails, v
8::Isolate* isolate) |
47 { | 44 { |
48 blink::Dictionary algorithmDictionary(algorithmObject, isolate); | 45 Dictionary algorithmDictionary(algorithmObject, isolate); |
49 if (!algorithmDictionary.isUndefinedOrNull() && !algorithmDictionary.isObjec
t()) | 46 if (!algorithmDictionary.isUndefinedOrNull() && !algorithmDictionary.isObjec
t()) |
50 return WebCryptoAlgorithm(); | 47 return WebCryptoAlgorithm(); |
51 WebCryptoAlgorithm algorithm; | 48 WebCryptoAlgorithm algorithm; |
52 blink::AlgorithmError error; | 49 AlgorithmError error; |
53 if (!normalizeAlgorithm(algorithmDictionary, operation, algorithm, &error))
{ | 50 if (!normalizeAlgorithm(algorithmDictionary, operation, algorithm, &error))
{ |
54 *exceptionCode = blink::webCryptoErrorToExceptionCode(error.errorType); | 51 *exceptionCode = webCryptoErrorToExceptionCode(error.errorType); |
55 *errorDetails = error.errorDetails; | 52 *errorDetails = error.errorDetails; |
56 return WebCryptoAlgorithm(); | 53 return WebCryptoAlgorithm(); |
57 } | 54 } |
58 | 55 |
59 return algorithm; | 56 return algorithm; |
60 } | 57 } |
61 | 58 |
62 } // namespace blink | 59 } // namespace blink |
OLD | NEW |