1 // Copyright 2014 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 COMPONENTS_POLICY_CORE_COMMON_MAC_UTIL_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_MAC_UTIL_H_ 7 8 #include <CoreFoundation/CoreFoundation.h> 9 10 #include "base/memory/scoped_ptr.h" 11 #include "components/policy/policy_export.h" 12 13 // This file contains utilities shared by both Mac OS X and iOS. 14 15 namespace base { 16 class Value; 17 } 18 19 namespace policy { 20 21 // Converts a CFPropertyListRef to the equivalent base::Value. CFDictionary 22 // entries whose key is not a CFStringRef are ignored. 23 // Returns NULL if an invalid CFType was found, such as CFDate or CFData. 24 // NSDictionary is toll-free bridged to CFDictionaryRef, which is a 25 // CFPropertyListRef, so it can also be passed directly here. Same for the 26 // other NS* classes that map to CF* properties. 27 POLICY_EXPORT scoped_ptr<base::Value> PropertyToValue( 28 CFPropertyListRef property); 29 30 } // namespace policy 31 32 #endif // COMPONENTS_POLICY_CORE_COMMON_MAC_UTIL_H_ 33