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

Side by Side Diff: chrome/browser/cocoa/certificate_viewer.mm

Issue 3855001: Move scoped_cftyperef from base to base/mac, use the new namespace, and name ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/certificate_viewer.h" 5 #include "chrome/browser/certificate_viewer.h"
6 6
7 #include <Security/Security.h> 7 #include <Security/Security.h>
8 #include <SecurityInterface/SFCertificatePanel.h> 8 #include <SecurityInterface/SFCertificatePanel.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/scoped_cftyperef.h" 13 #include "base/mac/scoped_cftyperef.h"
14 #include "net/base/x509_certificate.h" 14 #include "net/base/x509_certificate.h"
15 15
16 void ShowCertificateViewer(gfx::NativeWindow parent, 16 void ShowCertificateViewer(gfx::NativeWindow parent,
17 net::X509Certificate* cert) { 17 net::X509Certificate* cert) {
18 SecCertificateRef cert_mac = cert->os_cert_handle(); 18 SecCertificateRef cert_mac = cert->os_cert_handle();
19 if (!cert_mac) 19 if (!cert_mac)
20 return; 20 return;
21 21
22 scoped_cftyperef<CFMutableArrayRef> certificates( 22 base::mac::ScopedCFTypeRef<CFMutableArrayRef> certificates(
23 CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); 23 CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
24 if (!certificates.get()) { 24 if (!certificates.get()) {
25 NOTREACHED(); 25 NOTREACHED();
26 return; 26 return;
27 } 27 }
28 CFArrayAppendValue(certificates, cert_mac); 28 CFArrayAppendValue(certificates, cert_mac);
29 29
30 // Server certificate must be first in the array; subsequent certificates 30 // Server certificate must be first in the array; subsequent certificates
31 // in the chain can be in any order. 31 // in the chain can be in any order.
32 const std::vector<SecCertificateRef>& ca_certs = 32 const std::vector<SecCertificateRef>& ca_certs =
33 cert->GetIntermediateCertificates(); 33 cert->GetIntermediateCertificates();
34 for (size_t i = 0; i < ca_certs.size(); ++i) 34 for (size_t i = 0; i < ca_certs.size(); ++i)
35 CFArrayAppendValue(certificates, ca_certs[i]); 35 CFArrayAppendValue(certificates, ca_certs[i]);
36 36
37 [[[SFCertificatePanel alloc] init] 37 [[[SFCertificatePanel alloc] init]
38 beginSheetForWindow:parent 38 beginSheetForWindow:parent
39 modalDelegate:nil 39 modalDelegate:nil
40 didEndSelector:NULL 40 didEndSelector:NULL
41 contextInfo:NULL 41 contextInfo:NULL
42 certificates:reinterpret_cast<NSArray*>(certificates.get()) 42 certificates:reinterpret_cast<NSArray*>(certificates.get())
43 showGroup:YES]; 43 showGroup:YES];
44 // The SFCertificatePanel releases itself when the sheet is dismissed. 44 // The SFCertificatePanel releases itself when the sheet is dismissed.
45 } 45 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/animatable_image.mm ('k') | chrome/browser/cocoa/download_started_animation_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698