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

Side by Side Diff: net/cert/test_root_certs_mac.cc

Issue 16917011: mac: Replace base::mac::ScopedCFTypeRef with base::ScopedCFTypeRef. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with fixed off-by-1 in git-clang-format Created 7 years, 6 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/cert/test_root_certs.h ('k') | net/cert/x509_certificate_ios.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) 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/cert/test_root_certs.h" 5 #include "net/cert/test_root_certs.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_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 // Otherwise, both system trust and temporary_roots_ must be trusted. 89 // Otherwise, both system trust and temporary_roots_ must be trusted.
90 // Emulate the functionality of SecTrustSetAnchorCertificatesOnly by 90 // Emulate the functionality of SecTrustSetAnchorCertificatesOnly by
91 // creating a copy of the system roots and merging with temporary_roots_. 91 // creating a copy of the system roots and merging with temporary_roots_.
92 CFArrayRef system_roots = NULL; 92 CFArrayRef system_roots = NULL;
93 OSStatus status = SecTrustCopyAnchorCertificates(&system_roots); 93 OSStatus status = SecTrustCopyAnchorCertificates(&system_roots);
94 if (status) 94 if (status)
95 return status; 95 return status;
96 96
97 base::mac::ScopedCFTypeRef<CFArrayRef> scoped_system_roots(system_roots); 97 base::ScopedCFTypeRef<CFArrayRef> scoped_system_roots(system_roots);
98 base::mac::ScopedCFTypeRef<CFMutableArrayRef> scoped_roots( 98 base::ScopedCFTypeRef<CFMutableArrayRef> scoped_roots(
99 CFArrayCreateMutableCopy(kCFAllocatorDefault, 0, scoped_system_roots)); 99 CFArrayCreateMutableCopy(kCFAllocatorDefault, 0, scoped_system_roots));
100 CFArrayAppendArray(scoped_roots, temporary_roots_, 100 CFArrayAppendArray(scoped_roots, temporary_roots_,
101 CFRangeMake(0, CFArrayGetCount(temporary_roots_))); 101 CFRangeMake(0, CFArrayGetCount(temporary_roots_)));
102 return SecTrustSetAnchorCertificates(trust_ref, scoped_roots); 102 return SecTrustSetAnchorCertificates(trust_ref, scoped_roots);
103 } 103 }
104 104
105 void TestRootCerts::SetAllowSystemTrust(bool allow_system_trust) { 105 void TestRootCerts::SetAllowSystemTrust(bool allow_system_trust) {
106 allow_system_trust_ = allow_system_trust; 106 allow_system_trust_ = allow_system_trust;
107 } 107 }
108 108
109 TestRootCerts::~TestRootCerts() {} 109 TestRootCerts::~TestRootCerts() {}
110 110
111 void TestRootCerts::Init() { 111 void TestRootCerts::Init() {
112 temporary_roots_.reset(CFArrayCreateMutable(kCFAllocatorDefault, 0, 112 temporary_roots_.reset(CFArrayCreateMutable(kCFAllocatorDefault, 0,
113 &kCertArrayCallbacks)); 113 &kCertArrayCallbacks));
114 allow_system_trust_ = true; 114 allow_system_trust_ = true;
115 } 115 }
116 116
117 } // namespace net 117 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/test_root_certs.h ('k') | net/cert/x509_certificate_ios.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698