| 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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 setNotSupportedError(context.toString("Unsupported operation", operation
ToString(op)), error); | 939 setNotSupportedError(context.toString("Unsupported operation", operation
ToString(op)), error); |
| 940 return false; | 940 return false; |
| 941 } | 941 } |
| 942 | 942 |
| 943 WebCryptoAlgorithmParamsType paramsType = static_cast<WebCryptoAlgorithmPara
msType>(algorithmInfo->operationToParamsType[op]); | 943 WebCryptoAlgorithmParamsType paramsType = static_cast<WebCryptoAlgorithmPara
msType>(algorithmInfo->operationToParamsType[op]); |
| 944 | 944 |
| 945 OwnPtr<WebCryptoAlgorithmParams> params; | 945 OwnPtr<WebCryptoAlgorithmParams> params; |
| 946 if (!parseAlgorithmParams(raw, paramsType, params, context, error)) | 946 if (!parseAlgorithmParams(raw, paramsType, params, context, error)) |
| 947 return false; | 947 return false; |
| 948 | 948 |
| 949 algorithm = WebCryptoAlgorithm(algorithmId, params.release()); | 949 algorithm = WebCryptoAlgorithm(algorithmId, std::move(params)); |
| 950 return true; | 950 return true; |
| 951 } | 951 } |
| 952 | 952 |
| 953 bool parseAlgorithmIdentifier(const AlgorithmIdentifier& raw, WebCryptoOperation
op, WebCryptoAlgorithm& algorithm, ErrorContext context, AlgorithmError* error) | 953 bool parseAlgorithmIdentifier(const AlgorithmIdentifier& raw, WebCryptoOperation
op, WebCryptoAlgorithm& algorithm, ErrorContext context, AlgorithmError* error) |
| 954 { | 954 { |
| 955 context.add("Algorithm"); | 955 context.add("Algorithm"); |
| 956 | 956 |
| 957 // If the AlgorithmIdentifier is a String, treat it the same as a Dictionary
with a "name" attribute and nothing else. | 957 // If the AlgorithmIdentifier is a String, treat it the same as a Dictionary
with a "name" attribute and nothing else. |
| 958 if (raw.isString()) { | 958 if (raw.isString()) { |
| 959 return parseAlgorithmDictionary(raw.getAsString(), Dictionary(), op, alg
orithm, context, error); | 959 return parseAlgorithmDictionary(raw.getAsString(), Dictionary(), op, alg
orithm, context, error); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 977 } | 977 } |
| 978 | 978 |
| 979 } // namespace | 979 } // namespace |
| 980 | 980 |
| 981 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, W
ebCryptoAlgorithm& algorithm, AlgorithmError* error) | 981 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, W
ebCryptoAlgorithm& algorithm, AlgorithmError* error) |
| 982 { | 982 { |
| 983 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); | 983 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); |
| 984 } | 984 } |
| 985 | 985 |
| 986 } // namespace blink | 986 } // namespace blink |
| OLD | NEW |