OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cert/cert_database.h" |
6 | 6 |
7 #include <Security/Security.h> | 7 #include <Security/Security.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_logging.h" | 10 #include "base/mac/mac_logging.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/observer_list_threadsafe.h" | 12 #include "base/observer_list_threadsafe.h" |
13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "crypto/mac_security_services_lock.h" | 16 #include "crypto/mac_security_services_lock.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "net/base/x509_certificate.h" | 18 #include "net/cert/x509_certificate.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 // Helper that observes events from the Keychain and forwards them to the | 22 // Helper that observes events from the Keychain and forwards them to the |
23 // given CertDatabase. | 23 // given CertDatabase. |
24 class CertDatabase::Notifier { | 24 class CertDatabase::Notifier { |
25 public: | 25 public: |
26 // Creates a new Notifier that will forward Keychain events to |cert_db|. | 26 // Creates a new Notifier that will forward Keychain events to |cert_db|. |
27 // |message_loop| must refer to a thread with an associated CFRunLoop - a | 27 // |message_loop| must refer to a thread with an associated CFRunLoop - a |
28 // TYPE_UI thread. Events will be dispatched from this message loop. | 28 // TYPE_UI thread. Events will be dispatched from this message loop. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 case errSecDuplicateItem: | 163 case errSecDuplicateItem: |
164 return OK; | 164 return OK; |
165 default: | 165 default: |
166 OSSTATUS_LOG(ERROR, err) << "CertDatabase failed to add cert to keychain"; | 166 OSSTATUS_LOG(ERROR, err) << "CertDatabase failed to add cert to keychain"; |
167 // TODO(snej): Map the error code more intelligently. | 167 // TODO(snej): Map the error code more intelligently. |
168 return ERR_ADD_USER_CERT_FAILED; | 168 return ERR_ADD_USER_CERT_FAILED; |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 } // namespace net | 172 } // namespace net |
OLD | NEW |