| 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef NormalizeAlgorithm_h | 31 #ifndef NormalizeAlgorithm_h |
| 32 #define NormalizeAlgorithm_h | 32 #define NormalizeAlgorithm_h |
| 33 | 33 |
| 34 #include "bindings/modules/v8/UnionTypesModules.h" | 34 #include "bindings/modules/v8/UnionTypesModules.h" |
| 35 #include "modules/ModulesExport.h" | 35 #include "modules/ModulesExport.h" |
| 36 #include "public/platform/WebCrypto.h" | 36 #include "public/platform/WebCrypto.h" |
| 37 #include "public/platform/WebCryptoAlgorithm.h" | 37 #include "public/platform/WebCryptoAlgorithm.h" |
| 38 #include "public/platform/WebString.h" | 38 #include "public/platform/WebString.h" |
| 39 #include "wtf/Allocator.h" |
| 39 #include "wtf/Assertions.h" | 40 #include "wtf/Assertions.h" |
| 40 #include "wtf/Forward.h" | 41 #include "wtf/Forward.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 44 class Dictionary; | 45 class Dictionary; |
| 45 | 46 |
| 46 struct AlgorithmError { | 47 struct AlgorithmError { |
| 48 STACK_ALLOCATED(); |
| 47 WebCryptoErrorType errorType; | 49 WebCryptoErrorType errorType; |
| 48 WebString errorDetails; | 50 WebString errorDetails; |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 typedef DictionaryOrString AlgorithmIdentifier; | 53 typedef DictionaryOrString AlgorithmIdentifier; |
| 52 | 54 |
| 53 // Converts a javascript AlgorithmIdentifier to a WebCryptoAlgorithm object. | 55 // Converts a javascript AlgorithmIdentifier to a WebCryptoAlgorithm object. |
| 54 // | 56 // |
| 55 // This corresponds with "normalizing" [1] the algorithm, and then validating | 57 // This corresponds with "normalizing" [1] the algorithm, and then validating |
| 56 // the expected parameters for the algorithm/operation combination. | 58 // the expected parameters for the algorithm/operation combination. |
| 57 // | 59 // |
| 58 // On success returns true and sets the WebCryptoAlgorithm. | 60 // On success returns true and sets the WebCryptoAlgorithm. |
| 59 // | 61 // |
| 60 // On failure normalizeAlgorithm returns false and sets the AlgorithmError with | 62 // On failure normalizeAlgorithm returns false and sets the AlgorithmError with |
| 61 // a error type and a (non-localized) debug string. | 63 // a error type and a (non-localized) debug string. |
| 62 // | 64 // |
| 63 // [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules | 65 // [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules |
| 64 MODULES_EXPORT bool normalizeAlgorithm(const AlgorithmIdentifier&, WebCryptoOper
ation, WebCryptoAlgorithm&, AlgorithmError*) WARN_UNUSED_RETURN; | 66 MODULES_EXPORT bool normalizeAlgorithm(const AlgorithmIdentifier&, WebCryptoOper
ation, WebCryptoAlgorithm&, AlgorithmError*) WARN_UNUSED_RETURN; |
| 65 | 67 |
| 66 } // namespace blink | 68 } // namespace blink |
| 67 | 69 |
| 68 #endif | 70 #endif |
| OLD | NEW |