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 #import "chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h" |
6 | 6 |
7 #import <SecurityInterface/SFChooseIdentityPanel.h> | 7 #import <SecurityInterface/SFChooseIdentityPanel.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 constrainedWindow_->CloseWebContentsModalDialog(); | 201 constrainedWindow_->CloseWebContentsModalDialog(); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 - (void)displayForWebContents:(content::WebContents*)webContents { | 205 - (void)displayForWebContents:(content::WebContents*)webContents { |
206 // Create an array of CFIdentityRefs for the certificates: | 206 // Create an array of CFIdentityRefs for the certificates: |
207 size_t numCerts = observer_->cert_request_info()->client_certs.size(); | 207 size_t numCerts = observer_->cert_request_info()->client_certs.size(); |
208 identities_.reset(CFArrayCreateMutable( | 208 identities_.reset(CFArrayCreateMutable( |
209 kCFAllocatorDefault, numCerts, &kCFTypeArrayCallBacks)); | 209 kCFAllocatorDefault, numCerts, &kCFTypeArrayCallBacks)); |
210 for (size_t i = 0; i < numCerts; ++i) { | 210 for (size_t i = 0; i < numCerts; ++i) { |
211 SecCertificateRef cert = | 211 base::ScopedCFTypeRef<SecCertificateRef> cert( |
212 observer_->cert_request_info()->client_certs[i]->os_cert_handle(); | 212 net::x509_util::CreateSecCertificateFromX509Certificate( |
| 213 observer_->cert_request_info()->client_certs[i].get())); |
| 214 if (!cert) |
| 215 continue; |
213 SecIdentityRef identity; | 216 SecIdentityRef identity; |
214 if (SecIdentityCreateWithCertificate(NULL, cert, &identity) == noErr) { | 217 if (SecIdentityCreateWithCertificate(NULL, cert, &identity) == noErr) { |
215 CFArrayAppendValue(identities_, identity); | 218 CFArrayAppendValue(identities_, identity); |
216 CFRelease(identity); | 219 CFRelease(identity); |
217 certificates_.push_back(observer_->cert_request_info()->client_certs[i]); | 220 certificates_.push_back(observer_->cert_request_info()->client_certs[i]); |
218 } | 221 } |
219 } | 222 } |
220 | 223 |
221 // Get the message to display: | 224 // Get the message to display: |
222 NSString* message = l10n_util::GetNSStringF( | 225 NSString* message = l10n_util::GetNSStringF( |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 320 } |
318 | 321 |
319 - (void)onConstrainedWindowClosed { | 322 - (void)onConstrainedWindowClosed { |
320 observer_->StopObserving(); | 323 observer_->StopObserving(); |
321 panel_.reset(); | 324 panel_.reset(); |
322 constrainedWindow_.reset(); | 325 constrainedWindow_.reset(); |
323 [self release]; | 326 [self release]; |
324 } | 327 } |
325 | 328 |
326 @end | 329 @end |
OLD | NEW |