| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| 6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "third_party/WebKit/public/platform/WebCrypto.h" | 10 #include "third_party/WebKit/public/platform/WebCrypto.h" |
| 11 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" | 11 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" |
| 12 #include "third_party/WebKit/public/platform/WebVector.h" | 12 #include "third_party/WebKit/public/platform/WebVector.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 // Wrapper around the Blink WebCrypto asynchronous interface, which forwards to | 16 // Wrapper around the Blink WebCrypto asynchronous interface, which forwards to |
| 17 // the synchronous platfrom (NSS or OpenSSL) implementation. | 17 // the synchronous platform (NSS or OpenSSL) implementation. |
| 18 // | 18 // |
| 19 // TODO(eroman): Post the synchronous work to a background thread. | 19 // WebCryptoImpl is threadsafe. |
| 20 // |
| 21 // EnsureInit() must be called prior to using methods on WebCryptoImpl(). |
| 20 class WebCryptoImpl : public blink::WebCrypto { | 22 class WebCryptoImpl : public blink::WebCrypto { |
| 21 public: | 23 public: |
| 22 WebCryptoImpl(); | 24 WebCryptoImpl(); |
| 25 |
| 23 virtual ~WebCryptoImpl(); | 26 virtual ~WebCryptoImpl(); |
| 24 | 27 |
| 28 static void EnsureInit(); |
| 29 |
| 25 virtual void encrypt(const blink::WebCryptoAlgorithm& algorithm, | 30 virtual void encrypt(const blink::WebCryptoAlgorithm& algorithm, |
| 26 const blink::WebCryptoKey& key, | 31 const blink::WebCryptoKey& key, |
| 27 const unsigned char* data, | 32 const unsigned char* data, |
| 28 unsigned int data_size, | 33 unsigned int data_size, |
| 29 blink::WebCryptoResult result); | 34 blink::WebCryptoResult result); |
| 30 virtual void decrypt(const blink::WebCryptoAlgorithm& algorithm, | 35 virtual void decrypt(const blink::WebCryptoAlgorithm& algorithm, |
| 31 const blink::WebCryptoKey& key, | 36 const blink::WebCryptoKey& key, |
| 32 const unsigned char* data, | 37 const unsigned char* data, |
| 33 unsigned int data_size, | 38 unsigned int data_size, |
| 34 blink::WebCryptoResult result); | 39 blink::WebCryptoResult result); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 virtual bool serializeKeyForClone(const blink::WebCryptoKey& key, | 104 virtual bool serializeKeyForClone(const blink::WebCryptoKey& key, |
| 100 blink::WebVector<unsigned char>& key_data); | 105 blink::WebVector<unsigned char>& key_data); |
| 101 | 106 |
| 102 private: | 107 private: |
| 103 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 108 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
| 104 }; | 109 }; |
| 105 | 110 |
| 106 } // namespace content | 111 } // namespace content |
| 107 | 112 |
| 108 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 113 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| OLD | NEW |