[email protected] | 408699c | 2013-07-17 21:23:16 | [diff] [blame] | 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "content/renderer/webcrypto_impl.h" | ||||
6 | |||||
[email protected] | e5b794b | 2013-08-30 01:32:54 | [diff] [blame] | 7 | #include "third_party/WebKit/public/platform/WebArrayBuffer.h" |
[email protected] | 408699c | 2013-07-17 21:23:16 | [diff] [blame] | 8 | |
9 | namespace content { | ||||
10 | |||||
[email protected] | 7e4c36f | 2013-09-12 06:10:19 | [diff] [blame^] | 11 | WebCryptoImpl::WebCryptoImpl() { |
12 | Init(); | ||||
13 | } | ||||
14 | |||||
[email protected] | e5b794b | 2013-08-30 01:32:54 | [diff] [blame] | 15 | void WebCryptoImpl::digest( |
16 | const WebKit::WebCryptoAlgorithm& algorithm, | ||||
17 | const unsigned char* data, | ||||
[email protected] | ed80a09 | 2013-09-10 16:36:38 | [diff] [blame] | 18 | unsigned data_size, |
[email protected] | e5b794b | 2013-08-30 01:32:54 | [diff] [blame] | 19 | WebKit::WebCryptoResult result) { |
20 | WebKit::WebArrayBuffer buffer; | ||||
[email protected] | ed80a09 | 2013-09-10 16:36:38 | [diff] [blame] | 21 | if (!DigestInternal(algorithm, data, data_size, &buffer)) { |
[email protected] | e5b794b | 2013-08-30 01:32:54 | [diff] [blame] | 22 | result.completeWithError(); |
23 | } else { | ||||
24 | result.completeWithBuffer(buffer); | ||||
[email protected] | 408699c | 2013-07-17 21:23:16 | [diff] [blame] | 25 | } |
26 | } | ||||
27 | |||||
28 | } // namespace content |