| 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 25 matching lines...) Expand all Loading... |
| 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/Allocator.h" |
| 40 #include "wtf/Assertions.h" | 40 #include "wtf/Assertions.h" |
| 41 #include "wtf/Compiler.h" | 41 #include "wtf/Compiler.h" |
| 42 #include "wtf/Forward.h" | 42 #include "wtf/Forward.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 class Dictionary; | |
| 47 | |
| 48 struct AlgorithmError { | 46 struct AlgorithmError { |
| 49 STACK_ALLOCATED(); | 47 STACK_ALLOCATED(); |
| 50 WebCryptoErrorType errorType; | 48 WebCryptoErrorType errorType; |
| 51 WebString errorDetails; | 49 WebString errorDetails; |
| 52 }; | 50 }; |
| 53 | 51 |
| 54 typedef DictionaryOrString AlgorithmIdentifier; | 52 typedef DictionaryOrString AlgorithmIdentifier; |
| 55 | 53 |
| 56 // Converts a javascript AlgorithmIdentifier to a WebCryptoAlgorithm object. | 54 // Converts a javascript AlgorithmIdentifier to a WebCryptoAlgorithm object. |
| 57 // | 55 // |
| 58 // This corresponds with "normalizing" [1] the algorithm, and then validating | 56 // This corresponds with "normalizing" [1] the algorithm, and then validating |
| 59 // the expected parameters for the algorithm/operation combination. | 57 // the expected parameters for the algorithm/operation combination. |
| 60 // | 58 // |
| 61 // On success returns true and sets the WebCryptoAlgorithm. | 59 // On success returns true and sets the WebCryptoAlgorithm. |
| 62 // | 60 // |
| 63 // On failure normalizeAlgorithm returns false and sets the AlgorithmError with | 61 // On failure normalizeAlgorithm returns false and sets the AlgorithmError with |
| 64 // a error type and a (non-localized) debug string. | 62 // a error type and a (non-localized) debug string. |
| 65 // | 63 // |
| 66 // [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules | 64 // [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules |
| 67 MODULES_EXPORT WARN_UNUSED_RESULT bool normalizeAlgorithm( | 65 MODULES_EXPORT WARN_UNUSED_RESULT bool normalizeAlgorithm( |
| 68 const AlgorithmIdentifier&, | 66 const AlgorithmIdentifier&, |
| 69 WebCryptoOperation, | 67 WebCryptoOperation, |
| 70 WebCryptoAlgorithm&, | 68 WebCryptoAlgorithm&, |
| 71 AlgorithmError*); | 69 AlgorithmError*); |
| 72 | 70 |
| 73 } // namespace blink | 71 } // namespace blink |
| 74 | 72 |
| 75 #endif | 73 #endif |
| OLD | NEW |