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

Unified Diff: components/policy/core/common/mac_util.cc

Issue 1902633006: Convert //components/policy from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and use namespace alias Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/policy/core/common/mac_util.h ('k') | components/policy/core/common/mac_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/mac_util.cc
diff --git a/components/policy/core/common/mac_util.cc b/components/policy/core/common/mac_util.cc
index f5b4cebc5492d03ec78f44a299e542e2e456f451..2c477e0031ba2983dfc880e0e02c876c80c474c0 100644
--- a/components/policy/core/common/mac_util.cc
+++ b/components/policy/core/common/mac_util.cc
@@ -22,7 +22,7 @@ namespace {
// in the DictionaryValue in |context|.
void DictionaryEntryToValue(const void* key, const void* value, void* context) {
if (CFStringRef cf_key = CFCast<CFStringRef>(key)) {
- scoped_ptr<base::Value> converted =
+ std::unique_ptr<base::Value> converted =
PropertyToValue(static_cast<CFPropertyListRef>(value));
if (converted) {
const std::string string = base::SysCFStringRefToUTF8(cf_key);
@@ -36,7 +36,7 @@ void DictionaryEntryToValue(const void* key, const void* value, void* context) {
// CFArray that should be converted into an equivalent entry in the ListValue
// in |context|.
void ArrayEntryToValue(const void* value, void* context) {
- scoped_ptr<base::Value> converted =
+ std::unique_ptr<base::Value> converted =
PropertyToValue(static_cast<CFPropertyListRef>(value));
if (converted)
static_cast<base::ListValue *>(context)->Append(converted.release());
@@ -44,12 +44,12 @@ void ArrayEntryToValue(const void* value, void* context) {
} // namespace
-scoped_ptr<base::Value> PropertyToValue(CFPropertyListRef property) {
+std::unique_ptr<base::Value> PropertyToValue(CFPropertyListRef property) {
if (CFCast<CFNullRef>(property))
return base::Value::CreateNullValue();
if (CFBooleanRef boolean = CFCast<CFBooleanRef>(property)) {
- return scoped_ptr<base::Value>(new base::FundamentalValue(
+ return std::unique_ptr<base::Value>(new base::FundamentalValue(
static_cast<bool>(CFBooleanGetValue(boolean))));
}
@@ -59,30 +59,32 @@ scoped_ptr<base::Value> PropertyToValue(CFPropertyListRef property) {
if (CFNumberIsFloatType(number)) {
double double_value = 0.0;
if (CFNumberGetValue(number, kCFNumberDoubleType, &double_value)) {
- return scoped_ptr<base::Value>(
+ return std::unique_ptr<base::Value>(
new base::FundamentalValue(double_value));
}
} else {
int int_value = 0;
if (CFNumberGetValue(number, kCFNumberIntType, &int_value)) {
- return scoped_ptr<base::Value>(new base::FundamentalValue(int_value));
+ return std::unique_ptr<base::Value>(
+ new base::FundamentalValue(int_value));
}
}
}
if (CFStringRef string = CFCast<CFStringRef>(property)) {
- return scoped_ptr<base::Value>(
+ return std::unique_ptr<base::Value>(
new base::StringValue(base::SysCFStringRefToUTF8(string)));
}
if (CFDictionaryRef dict = CFCast<CFDictionaryRef>(property)) {
- scoped_ptr<base::DictionaryValue> dict_value(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> dict_value(
+ new base::DictionaryValue());
CFDictionaryApplyFunction(dict, DictionaryEntryToValue, dict_value.get());
return std::move(dict_value);
}
if (CFArrayRef array = CFCast<CFArrayRef>(property)) {
- scoped_ptr<base::ListValue> list_value(new base::ListValue());
+ std::unique_ptr<base::ListValue> list_value(new base::ListValue());
CFArrayApplyFunction(array,
CFRangeMake(0, CFArrayGetCount(array)),
ArrayEntryToValue,
« no previous file with comments | « components/policy/core/common/mac_util.h ('k') | components/policy/core/common/mac_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698