Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/chromeos/certificate_provider/thread_safe_certificate_map.cc

Issue 2257103002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/chromeos/certificate_provider/thread_safe_certificate_m ap.h" 5 #include "chrome/browser/chromeos/certificate_provider/thread_safe_certificate_m ap.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "net/base/hash_value.h" 8 #include "net/base/hash_value.h"
9 #include "net/cert/x509_certificate.h" 9 #include "net/cert/x509_certificate.h"
10 10
11 namespace chromeos { 11 namespace chromeos {
12 namespace certificate_provider { 12 namespace certificate_provider {
13 namespace { 13 namespace {
14 14
15 void BuildFingerprintsMap( 15 void BuildFingerprintsMap(
16 const std::map<std::string, certificate_provider::CertificateInfoList>& 16 const std::map<std::string, certificate_provider::CertificateInfoList>&
17 extension_to_certificates, 17 extension_to_certificates,
18 ThreadSafeCertificateMap::FingerprintToCertAndExtensionMap* 18 ThreadSafeCertificateMap::FingerprintToCertAndExtensionMap*
19 fingerprint_to_cert) { 19 fingerprint_to_cert) {
20 for (const auto& entry : extension_to_certificates) { 20 for (const auto& entry : extension_to_certificates) {
21 const std::string& extension_id = entry.first; 21 const std::string& extension_id = entry.first;
22 for (const CertificateInfo& cert_info : entry.second) { 22 for (const CertificateInfo& cert_info : entry.second) {
23 const net::SHA256HashValue fingerprint = 23 const net::SHA256HashValue fingerprint =
24 net::X509Certificate::CalculateFingerprint256( 24 net::X509Certificate::CalculateFingerprint256(
25 cert_info.certificate->os_cert_handle()); 25 cert_info.certificate->os_cert_handle());
26 fingerprint_to_cert->insert(std::make_pair( 26 fingerprint_to_cert->insert(std::make_pair(
27 fingerprint, base::WrapUnique(new ThreadSafeCertificateMap::MapValue( 27 fingerprint, base::MakeUnique<ThreadSafeCertificateMap::MapValue>(
28 cert_info, extension_id)))); 28 cert_info, extension_id)));
29 } 29 }
30 } 30 }
31 } 31 }
32 32
33 } // namespace 33 } // namespace
34 34
35 ThreadSafeCertificateMap::MapValue::MapValue(const CertificateInfo& cert_info, 35 ThreadSafeCertificateMap::MapValue::MapValue(const CertificateInfo& cert_info,
36 const std::string& extension_id) 36 const std::string& extension_id)
37 : cert_info(cert_info), extension_id(extension_id) {} 37 : cert_info(cert_info), extension_id(extension_id) {}
38 38
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 MapValue* const value = entry.second.get(); 89 MapValue* const value = entry.second.get();
90 // Only remove the association of the fingerprint to the extension, but keep 90 // Only remove the association of the fingerprint to the extension, but keep
91 // the fingerprint. 91 // the fingerprint.
92 if (value && value->extension_id == extension_id) 92 if (value && value->extension_id == extension_id)
93 fingerprint_to_cert_and_extension_[entry.first] = nullptr; 93 fingerprint_to_cert_and_extension_[entry.first] = nullptr;
94 } 94 }
95 } 95 }
96 96
97 } // namespace certificate_provider 97 } // namespace certificate_provider
98 } // namespace chromeos 98 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698