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 #include "net/ssl/threaded_ssl_private_key.h" | 5 #include "net/ssl/threaded_ssl_private_key.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 }; | 48 }; |
49 | 49 |
50 ThreadedSSLPrivateKey::ThreadedSSLPrivateKey( | 50 ThreadedSSLPrivateKey::ThreadedSSLPrivateKey( |
51 scoped_ptr<ThreadedSSLPrivateKey::Delegate> delegate, | 51 scoped_ptr<ThreadedSSLPrivateKey::Delegate> delegate, |
52 scoped_refptr<base::TaskRunner> task_runner) | 52 scoped_refptr<base::TaskRunner> task_runner) |
53 : core_(new Core(delegate.Pass())), | 53 : core_(new Core(delegate.Pass())), |
54 task_runner_(task_runner.Pass()), | 54 task_runner_(task_runner.Pass()), |
55 weak_factory_(this) { | 55 weak_factory_(this) { |
56 } | 56 } |
57 | 57 |
58 ThreadedSSLPrivateKey::~ThreadedSSLPrivateKey() { | |
59 } | |
60 | |
61 SSLPrivateKey::Type ThreadedSSLPrivateKey::GetType() { | 58 SSLPrivateKey::Type ThreadedSSLPrivateKey::GetType() { |
62 return core_->delegate()->GetType(); | 59 return core_->delegate()->GetType(); |
63 } | 60 } |
64 | 61 |
65 std::vector<SSLPrivateKey::Hash> ThreadedSSLPrivateKey::GetDigestPreferences() { | 62 std::vector<SSLPrivateKey::Hash> ThreadedSSLPrivateKey::GetDigestPreferences() { |
66 return core_->delegate()->GetDigestPreferences(); | 63 return core_->delegate()->GetDigestPreferences(); |
67 } | 64 } |
68 | 65 |
69 size_t ThreadedSSLPrivateKey::GetMaxSignatureLengthInBytes() { | 66 size_t ThreadedSSLPrivateKey::GetMaxSignatureLengthInBytes() { |
70 return core_->delegate()->GetMaxSignatureLengthInBytes(); | 67 return core_->delegate()->GetMaxSignatureLengthInBytes(); |
71 } | 68 } |
72 | 69 |
73 void ThreadedSSLPrivateKey::SignDigest( | 70 void ThreadedSSLPrivateKey::SignDigest( |
74 SSLPrivateKey::Hash hash, | 71 SSLPrivateKey::Hash hash, |
75 const base::StringPiece& input, | 72 const base::StringPiece& input, |
76 const SSLPrivateKey::SignCallback& callback) { | 73 const SSLPrivateKey::SignCallback& callback) { |
77 std::vector<uint8_t>* signature = new std::vector<uint8_t>; | 74 std::vector<uint8_t>* signature = new std::vector<uint8_t>; |
78 base::PostTaskAndReplyWithResult( | 75 base::PostTaskAndReplyWithResult( |
79 task_runner_.get(), FROM_HERE, | 76 task_runner_.get(), FROM_HERE, |
80 base::Bind(&ThreadedSSLPrivateKey::Core::SignDigest, core_, hash, | 77 base::Bind(&ThreadedSSLPrivateKey::Core::SignDigest, core_, hash, |
81 input.as_string(), base::Unretained(signature)), | 78 input.as_string(), base::Unretained(signature)), |
82 base::Bind(&DoCallback, weak_factory_.GetWeakPtr(), callback, | 79 base::Bind(&DoCallback, weak_factory_.GetWeakPtr(), callback, |
83 base::Owned(signature))); | 80 base::Owned(signature))); |
84 } | 81 } |
85 | 82 |
| 83 ThreadedSSLPrivateKey::~ThreadedSSLPrivateKey() {} |
| 84 |
86 } // namespace net | 85 } // namespace net |
OLD | NEW |