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

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

Issue 1129083003: More base::Values-related bare pointer -> scoped_ptr conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad merge Created 5 years, 7 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
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 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 27 matching lines...) Expand all
38 scoped_ptr<base::Value> converted = 38 scoped_ptr<base::Value> converted =
39 PropertyToValue(static_cast<CFPropertyListRef>(value)); 39 PropertyToValue(static_cast<CFPropertyListRef>(value));
40 if (converted) 40 if (converted)
41 static_cast<base::ListValue *>(context)->Append(converted.release()); 41 static_cast<base::ListValue *>(context)->Append(converted.release());
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 scoped_ptr<base::Value> PropertyToValue(CFPropertyListRef property) { 46 scoped_ptr<base::Value> PropertyToValue(CFPropertyListRef property) {
47 if (CFCast<CFNullRef>(property)) 47 if (CFCast<CFNullRef>(property))
48 return scoped_ptr<base::Value>(base::Value::CreateNullValue()); 48 return base::Value::CreateNullValue();
49 49
50 if (CFBooleanRef boolean = CFCast<CFBooleanRef>(property)) { 50 if (CFBooleanRef boolean = CFCast<CFBooleanRef>(property)) {
51 return scoped_ptr<base::Value>(new base::FundamentalValue( 51 return scoped_ptr<base::Value>(new base::FundamentalValue(
52 static_cast<bool>(CFBooleanGetValue(boolean)))); 52 static_cast<bool>(CFBooleanGetValue(boolean))));
53 } 53 }
54 54
55 if (CFNumberRef number = CFCast<CFNumberRef>(property)) { 55 if (CFNumberRef number = CFCast<CFNumberRef>(property)) {
56 // CFNumberGetValue() converts values implicitly when the conversion is not 56 // CFNumberGetValue() converts values implicitly when the conversion is not
57 // lossy. Check the type before trying to convert. 57 // lossy. Check the type before trying to convert.
58 if (CFNumberIsFloatType(number)) { 58 if (CFNumberIsFloatType(number)) {
(...skipping 27 matching lines...) Expand all
86 CFRangeMake(0, CFArrayGetCount(array)), 86 CFRangeMake(0, CFArrayGetCount(array)),
87 ArrayEntryToValue, 87 ArrayEntryToValue,
88 list_value.get()); 88 list_value.get());
89 return list_value.Pass(); 89 return list_value.Pass();
90 } 90 }
91 91
92 return nullptr; 92 return nullptr;
93 } 93 }
94 94
95 } // namespace policy 95 } // namespace policy
OLDNEW
« no previous file with comments | « components/json_schema/json_schema_validator_unittest_base.cc ('k') | components/policy/core/common/registry_dict_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698