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 #include <utility> |
9 | 9 |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 // Callback function for CFArrayApplyFunction. |value| is an entry of the | 36 // Callback function for CFArrayApplyFunction. |value| is an entry of the |
37 // CFArray that should be converted into an equivalent entry in the ListValue | 37 // CFArray that should be converted into an equivalent entry in the ListValue |
38 // in |context|. | 38 // in |context|. |
39 void ArrayEntryToValue(const void* value, void* context) { | 39 void ArrayEntryToValue(const void* value, void* context) { |
40 std::unique_ptr<base::Value> converted = | 40 std::unique_ptr<base::Value> converted = |
41 PropertyToValue(static_cast<CFPropertyListRef>(value)); | 41 PropertyToValue(static_cast<CFPropertyListRef>(value)); |
42 if (converted) | 42 if (converted) |
43 static_cast<base::ListValue *>(context)->Append(converted.release()); | 43 static_cast<base::ListValue*>(context)->Append(std::move(converted)); |
44 } | 44 } |
45 | 45 |
46 } // namespace | 46 } // namespace |
47 | 47 |
48 std::unique_ptr<base::Value> PropertyToValue(CFPropertyListRef property) { | 48 std::unique_ptr<base::Value> PropertyToValue(CFPropertyListRef property) { |
49 if (CFCast<CFNullRef>(property)) | 49 if (CFCast<CFNullRef>(property)) |
50 return base::MakeUnique<base::Value>(); | 50 return base::MakeUnique<base::Value>(); |
51 | 51 |
52 if (CFBooleanRef boolean = CFCast<CFBooleanRef>(property)) { | 52 if (CFBooleanRef boolean = CFCast<CFBooleanRef>(property)) { |
53 return std::unique_ptr<base::Value>( | 53 return std::unique_ptr<base::Value>( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 CFRangeMake(0, CFArrayGetCount(array)), | 88 CFRangeMake(0, CFArrayGetCount(array)), |
89 ArrayEntryToValue, | 89 ArrayEntryToValue, |
90 list_value.get()); | 90 list_value.get()); |
91 return std::move(list_value); | 91 return std::move(list_value); |
92 } | 92 } |
93 | 93 |
94 return nullptr; | 94 return nullptr; |
95 } | 95 } |
96 | 96 |
97 } // namespace policy | 97 } // namespace policy |
OLD | NEW |