1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_BASE_SCOPED_CERT_CHAIN_CONTEXT_H_ 6 #define NET_BASE_SCOPED_CERT_CHAIN_CONTEXT_H_ 7 #pragma once 8 9 #include <windows.h> 10 #include <wincrypt.h> 11 12 #include "base/memory/scoped_ptr.h" 13 14 namespace net { 15 16 // This class wraps the CertFreeCertificateChain function in a class that can 17 // be passed as a template argument to scoped_ptr_malloc. 18 class ScopedPtrMallocFreeCertChain { 19 public: operator()20 void operator()(const CERT_CHAIN_CONTEXT* x) const { 21 CertFreeCertificateChain(x); 22 } 23 }; 24 25 typedef scoped_ptr_malloc<const CERT_CHAIN_CONTEXT, 26 ScopedPtrMallocFreeCertChain> ScopedCertChainContext; 27 28 } // namespace net 29 30 #endif // NET_BASE_SCOPED_CERT_CHAIN_CONTEXT_H_ 31