| 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/certificate_viewer_mac.h" | 5 #import "chrome/browser/ui/certificate_viewer_mac.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 @implementation SSLCertificateViewerMac { | 92 @implementation SSLCertificateViewerMac { |
| 93 // The corresponding list of certificates. | 93 // The corresponding list of certificates. |
| 94 base::scoped_nsobject<NSArray> certificates_; | 94 base::scoped_nsobject<NSArray> certificates_; |
| 95 base::scoped_nsobject<SFCertificatePanel> panel_; | 95 base::scoped_nsobject<SFCertificatePanel> panel_; |
| 96 } | 96 } |
| 97 | 97 |
| 98 - (instancetype)initWithCertificate:(net::X509Certificate*)certificate | 98 - (instancetype)initWithCertificate:(net::X509Certificate*)certificate |
| 99 forWebContents:(content::WebContents*)webContents { | 99 forWebContents:(content::WebContents*)webContents { |
| 100 if ((self = [super init])) { | 100 if ((self = [super init])) { |
| 101 base::ScopedCFTypeRef<CFArrayRef> certChain( | 101 base::ScopedCFTypeRef<CFArrayRef> certChain( |
| 102 certificate->CreateOSCertChainForCert()); | 102 net::x509_util::CreateSecCertificateArrayForX509Certificate( |
| 103 certificate)); |
| 104 if (!certChain) |
| 105 return self; |
| 103 NSArray* certificates = base::mac::CFToNSCast(certChain.get()); | 106 NSArray* certificates = base::mac::CFToNSCast(certChain.get()); |
| 104 certificates_.reset([certificates retain]); | 107 certificates_.reset([certificates retain]); |
| 105 } | 108 } |
| 106 | 109 |
| 107 // Explicitly disable revocation checking, regardless of user preferences | 110 // Explicitly disable revocation checking, regardless of user preferences |
| 108 // or system settings. The behaviour of SFCertificatePanel is to call | 111 // or system settings. The behaviour of SFCertificatePanel is to call |
| 109 // SecTrustEvaluate on the certificate(s) supplied, effectively | 112 // SecTrustEvaluate on the certificate(s) supplied, effectively |
| 110 // duplicating the behaviour of net::X509Certificate::Verify(). However, | 113 // duplicating the behaviour of net::X509Certificate::Verify(). However, |
| 111 // this call stalls the UI if revocation checking is enabled in the | 114 // this call stalls the UI if revocation checking is enabled in the |
| 112 // Keychain preferences or if the cert may be an EV cert. By disabling | 115 // Keychain preferences or if the cert may be an EV cert. By disabling |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 175 |
| 173 - (void)releaseSheetWindow { | 176 - (void)releaseSheetWindow { |
| 174 panel_.reset(); | 177 panel_.reset(); |
| 175 } | 178 } |
| 176 | 179 |
| 177 - (NSWindow*)certificatePanel { | 180 - (NSWindow*)certificatePanel { |
| 178 return panel_; | 181 return panel_; |
| 179 } | 182 } |
| 180 | 183 |
| 181 @end | 184 @end |
| OLD | NEW |