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

Side by Side Diff: net/base/cert_database_mac.cc

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixes comments by eroman Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/DEPS ('k') | net/base/cert_database_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base/cert_database.h" 5 #include "net/base/cert_database.h"
6 6
7 #include <Security/Security.h> 7 #include <Security/Security.h>
8 8
9 #include "base/crypto/mac_security_services_lock.h"
10 #include "base/logging.h" 9 #include "base/logging.h"
11 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "crypto/mac_security_services_lock.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/base/x509_certificate.h" 13 #include "net/base/x509_certificate.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 CertDatabase::CertDatabase() { 17 CertDatabase::CertDatabase() {
18 } 18 }
19 19
20 int CertDatabase::CheckUserCert(X509Certificate* cert) { 20 int CertDatabase::CheckUserCert(X509Certificate* cert) {
21 if (!cert) 21 if (!cert)
(...skipping 14 matching lines...) Expand all
36 return ERR_CERT_INVALID; 36 return ERR_CERT_INVALID;
37 } 37 }
38 38
39 CFRelease(identity); 39 CFRelease(identity);
40 return OK; 40 return OK;
41 } 41 }
42 42
43 int CertDatabase::AddUserCert(X509Certificate* cert) { 43 int CertDatabase::AddUserCert(X509Certificate* cert) {
44 OSStatus err; 44 OSStatus err;
45 { 45 {
46 base::AutoLock locked(base::GetMacSecurityServicesLock()); 46 base::AutoLock locked(crypto::GetMacSecurityServicesLock());
47 err = SecCertificateAddToKeychain(cert->os_cert_handle(), NULL); 47 err = SecCertificateAddToKeychain(cert->os_cert_handle(), NULL);
48 } 48 }
49 switch (err) { 49 switch (err) {
50 case noErr: 50 case noErr:
51 CertDatabase::NotifyObserversOfUserCertAdded(cert); 51 CertDatabase::NotifyObserversOfUserCertAdded(cert);
52 // Fall through. 52 // Fall through.
53 case errSecDuplicateItem: 53 case errSecDuplicateItem:
54 return OK; 54 return OK;
55 default: 55 default:
56 LOG(ERROR) << "CertDatabase failed to add cert to keychain: " << err; 56 LOG(ERROR) << "CertDatabase failed to add cert to keychain: " << err;
57 // TODO(snej): Map the error code more intelligently. 57 // TODO(snej): Map the error code more intelligently.
58 return ERR_ADD_USER_CERT_FAILED; 58 return ERR_ADD_USER_CERT_FAILED;
59 } 59 }
60 } 60 }
61 61
62 } // namespace net 62 } // namespace net
OLDNEW
« no previous file with comments | « net/DEPS ('k') | net/base/cert_database_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698