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 CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_THREAD_SAFE_CERTIFICATE_MAP
_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_THREAD_SAFE_CERTIFICATE_MAP
_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_THREAD_SAFE_CERTIFICATE_MAP
_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_THREAD_SAFE_CERTIFICATE_MAP
_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "chrome/browser/chromeos/certificate_provider/certificate_info.h" | 14 #include "chrome/browser/chromeos/certificate_provider/certificate_info.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class SHA256HashValueLessThan; | 17 class SHA256HashValueLessThan; |
18 class X509Certificate; | 18 class X509Certificate; |
19 struct SHA256HashValue; | 19 struct SHA256HashValue; |
20 } | 20 } |
21 | 21 |
22 namespace chromeos { | 22 namespace chromeos { |
23 namespace certificate_provider { | 23 namespace certificate_provider { |
24 | 24 |
25 class ThreadSafeCertificateMap { | 25 class ThreadSafeCertificateMap { |
26 public: | 26 public: |
27 struct MapValue { | 27 struct MapValue { |
28 MapValue(const CertificateInfo& cert_info, const std::string& extension_id); | 28 MapValue(const CertificateInfo& cert_info, const std::string& extension_id); |
29 ~MapValue(); | 29 ~MapValue(); |
30 | 30 |
31 CertificateInfo cert_info; | 31 CertificateInfo cert_info; |
32 std::string extension_id; | 32 std::string extension_id; |
33 }; | 33 }; |
34 using FingerprintToCertAndExtensionMap = | 34 using FingerprintToCertAndExtensionMap = |
35 std::map<net::SHA256HashValue, | 35 std::map<net::SHA256HashValue, |
36 scoped_ptr<MapValue>, | 36 std::unique_ptr<MapValue>, |
37 net::SHA256HashValueLessThan>; | 37 net::SHA256HashValueLessThan>; |
38 | 38 |
39 ThreadSafeCertificateMap(); | 39 ThreadSafeCertificateMap(); |
40 ~ThreadSafeCertificateMap(); | 40 ~ThreadSafeCertificateMap(); |
41 | 41 |
42 // Updates the stored certificates with the given mapping from extension ids | 42 // Updates the stored certificates with the given mapping from extension ids |
43 // to certificates. | 43 // to certificates. |
44 void Update(const std::map<std::string, CertificateInfoList>& | 44 void Update(const std::map<std::string, CertificateInfoList>& |
45 extension_to_certificates); | 45 extension_to_certificates); |
46 | 46 |
(...skipping 18 matching lines...) Expand all Loading... |
65 base::Lock lock_; | 65 base::Lock lock_; |
66 FingerprintToCertAndExtensionMap fingerprint_to_cert_and_extension_; | 66 FingerprintToCertAndExtensionMap fingerprint_to_cert_and_extension_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(ThreadSafeCertificateMap); | 68 DISALLOW_COPY_AND_ASSIGN(ThreadSafeCertificateMap); |
69 }; | 69 }; |
70 | 70 |
71 } // namespace certificate_provider | 71 } // namespace certificate_provider |
72 } // namespace chromeos | 72 } // namespace chromeos |
73 | 73 |
74 #endif // CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_THREAD_SAFE_CERTIFICATE_
MAP_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_THREAD_SAFE_CERTIFICATE_
MAP_H_ |
OLD | NEW |