Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: components/policy/core/common/mac_util.cc

Issue 2817603003: Remove ListValue::Append(raw ptr) on Mac and iOS (Closed)
Patch Set: Comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/values.cc ('k') | components/policy/core/common/mac_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « base/values.cc ('k') | components/policy/core/common/mac_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698