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/client_key_store.h" | 5 #include "net/ssl/client_key_store.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> |
8 | 9 |
9 #include "net/cert/x509_certificate.h" | 10 #include "net/cert/x509_certificate.h" |
10 #include "net/ssl/ssl_private_key.h" | 11 #include "net/ssl/ssl_private_key.h" |
11 | 12 |
12 namespace net { | 13 namespace net { |
13 | 14 |
14 namespace { | 15 namespace { |
15 static base::LazyInstance<ClientKeyStore>::Leaky g_client_key_store = | 16 static base::LazyInstance<ClientKeyStore>::Leaky g_client_key_store = |
16 LAZY_INSTANCE_INITIALIZER; | 17 LAZY_INSTANCE_INITIALIZER; |
17 } // namespace | 18 } // namespace |
(...skipping 20 matching lines...) Expand all Loading... |
38 providers_.erase(it); | 39 providers_.erase(it); |
39 } | 40 } |
40 | 41 |
41 scoped_refptr<SSLPrivateKey> ClientKeyStore::FetchClientCertPrivateKey( | 42 scoped_refptr<SSLPrivateKey> ClientKeyStore::FetchClientCertPrivateKey( |
42 const X509Certificate& certificate) { | 43 const X509Certificate& certificate) { |
43 base::AutoLock auto_lock(lock_); | 44 base::AutoLock auto_lock(lock_); |
44 | 45 |
45 for (const auto& provider : providers_) { | 46 for (const auto& provider : providers_) { |
46 scoped_refptr<SSLPrivateKey> key; | 47 scoped_refptr<SSLPrivateKey> key; |
47 if (provider->GetCertificateKey(certificate, &key)) | 48 if (provider->GetCertificateKey(certificate, &key)) |
48 return key.Pass(); | 49 return std::move(key); |
49 } | 50 } |
50 return nullptr; | 51 return nullptr; |
51 } | 52 } |
52 | 53 |
53 } // namespace net | 54 } // namespace net |
OLD | NEW |