| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ | 5 #ifndef NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ |
| 6 #define NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ | 6 #define NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
| 18 #include "net/ssl/ssl_private_key.h" | 18 #include "net/ssl/ssl_private_key.h" |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class TaskRunner; | 21 class TaskRunner; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace net { | 24 namespace net { |
| 25 | 25 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 45 // error code. It will only be called on the task runner passed to the | 45 // error code. It will only be called on the task runner passed to the |
| 46 // owning ThreadedSSLPrivateKey. | 46 // owning ThreadedSSLPrivateKey. |
| 47 virtual Error SignDigest(Hash hash, | 47 virtual Error SignDigest(Hash hash, |
| 48 const base::StringPiece& input, | 48 const base::StringPiece& input, |
| 49 std::vector<uint8_t>* signature) = 0; | 49 std::vector<uint8_t>* signature) = 0; |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(Delegate); | 52 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 ThreadedSSLPrivateKey(scoped_ptr<Delegate> delegate, | 55 ThreadedSSLPrivateKey(std::unique_ptr<Delegate> delegate, |
| 56 scoped_refptr<base::TaskRunner> task_runner); | 56 scoped_refptr<base::TaskRunner> task_runner); |
| 57 | 57 |
| 58 // SSLPrivateKey implementation. | 58 // SSLPrivateKey implementation. |
| 59 Type GetType() override; | 59 Type GetType() override; |
| 60 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override; | 60 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override; |
| 61 size_t GetMaxSignatureLengthInBytes() override; | 61 size_t GetMaxSignatureLengthInBytes() override; |
| 62 void SignDigest(Hash hash, | 62 void SignDigest(Hash hash, |
| 63 const base::StringPiece& input, | 63 const base::StringPiece& input, |
| 64 const SignCallback& callback) override; | 64 const SignCallback& callback) override; |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 ~ThreadedSSLPrivateKey() override; | 67 ~ThreadedSSLPrivateKey() override; |
| 68 class Core; | 68 class Core; |
| 69 | 69 |
| 70 scoped_refptr<Core> core_; | 70 scoped_refptr<Core> core_; |
| 71 scoped_refptr<base::TaskRunner> task_runner_; | 71 scoped_refptr<base::TaskRunner> task_runner_; |
| 72 base::WeakPtrFactory<ThreadedSSLPrivateKey> weak_factory_; | 72 base::WeakPtrFactory<ThreadedSSLPrivateKey> weak_factory_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(ThreadedSSLPrivateKey); | 74 DISALLOW_COPY_AND_ASSIGN(ThreadedSSLPrivateKey); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 } // namespace net | 77 } // namespace net |
| 78 | 78 |
| 79 #endif // NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ | 79 #endif // NET_SSL_THREADED_SSL_PRIVATE_KEY_H_ |
| OLD | NEW |