| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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 CHROME_BROWSER_KEYCHAIN_MAC_H_ |
| 6 #define CHROME_BROWSER_KEYCHAIN_MAC_H_ |
| 7 |
| 8 #include <Security/Security.h> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 |
| 12 // Wraps the KeychainServices API in a very thin layer, to allow it to be |
| 13 // mocked out for testing. |
| 14 |
| 15 // See Keychain Services documentation for function documentation, as these call |
| 16 // through directly to their Keychain Services equivalents (Foo -> |
| 17 // SecKeychainFoo). The only exception is Free, which should be used for |
| 18 // anything returned from this class that would normally be freed with |
| 19 // CFRelease (to aid in testing). |
| 20 class MacKeychain { |
| 21 public: |
| 22 MacKeychain() {} |
| 23 virtual ~MacKeychain() {} |
| 24 |
| 25 virtual OSStatus ItemCopyAttributesAndData( |
| 26 SecKeychainItemRef itemRef, SecKeychainAttributeInfo *info, |
| 27 SecItemClass *itemClass, SecKeychainAttributeList **attrList, |
| 28 UInt32 *length, void **outData) const; |
| 29 |
| 30 virtual OSStatus ItemFreeAttributesAndData(SecKeychainAttributeList *attrList, |
| 31 void *data) const; |
| 32 |
| 33 virtual OSStatus SearchCreateFromAttributes( |
| 34 CFTypeRef keychainOrArray, SecItemClass itemClass, |
| 35 const SecKeychainAttributeList *attrList, |
| 36 SecKeychainSearchRef *searchRef) const; |
| 37 |
| 38 virtual OSStatus SearchCopyNext(SecKeychainSearchRef searchRef, |
| 39 SecKeychainItemRef *itemRef) const; |
| 40 |
| 41 // Calls CFRelease on the given ref, after checking that |ref| is non-NULL. |
| 42 virtual void Free(CFTypeRef ref) const; |
| 43 |
| 44 private: |
| 45 DISALLOW_COPY_AND_ASSIGN(MacKeychain); |
| 46 }; |
| 47 |
| 48 #endif // CHROME_BROWSER_KEYCHAIN_MAC_H_ |
| OLD | NEW |