| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "components/policy/core/common/mac_util.h" | 5 #include "components/policy/core/common/mac_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 11 #include "base/values.h" | 12 #include "base/values.h" |
| 12 | 13 |
| 13 using base::mac::CFCast; | 14 using base::mac::CFCast; |
| 14 | 15 |
| 15 namespace policy { | 16 namespace policy { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 71 } |
| 71 | 72 |
| 72 if (CFStringRef string = CFCast<CFStringRef>(property)) { | 73 if (CFStringRef string = CFCast<CFStringRef>(property)) { |
| 73 return scoped_ptr<base::Value>( | 74 return scoped_ptr<base::Value>( |
| 74 new base::StringValue(base::SysCFStringRefToUTF8(string))); | 75 new base::StringValue(base::SysCFStringRefToUTF8(string))); |
| 75 } | 76 } |
| 76 | 77 |
| 77 if (CFDictionaryRef dict = CFCast<CFDictionaryRef>(property)) { | 78 if (CFDictionaryRef dict = CFCast<CFDictionaryRef>(property)) { |
| 78 scoped_ptr<base::DictionaryValue> dict_value(new base::DictionaryValue()); | 79 scoped_ptr<base::DictionaryValue> dict_value(new base::DictionaryValue()); |
| 79 CFDictionaryApplyFunction(dict, DictionaryEntryToValue, dict_value.get()); | 80 CFDictionaryApplyFunction(dict, DictionaryEntryToValue, dict_value.get()); |
| 80 return dict_value.Pass(); | 81 return std::move(dict_value); |
| 81 } | 82 } |
| 82 | 83 |
| 83 if (CFArrayRef array = CFCast<CFArrayRef>(property)) { | 84 if (CFArrayRef array = CFCast<CFArrayRef>(property)) { |
| 84 scoped_ptr<base::ListValue> list_value(new base::ListValue()); | 85 scoped_ptr<base::ListValue> list_value(new base::ListValue()); |
| 85 CFArrayApplyFunction(array, | 86 CFArrayApplyFunction(array, |
| 86 CFRangeMake(0, CFArrayGetCount(array)), | 87 CFRangeMake(0, CFArrayGetCount(array)), |
| 87 ArrayEntryToValue, | 88 ArrayEntryToValue, |
| 88 list_value.get()); | 89 list_value.get()); |
| 89 return list_value.Pass(); | 90 return std::move(list_value); |
| 90 } | 91 } |
| 91 | 92 |
| 92 return nullptr; | 93 return nullptr; |
| 93 } | 94 } |
| 94 | 95 |
| 95 } // namespace policy | 96 } // namespace policy |
| OLD | NEW |