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

Unified Diff: components/policy/core/browser/android/policy_converter.cc

Issue 2252353002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 | « no previous file | components/policy/core/browser/autofill_policy_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/browser/android/policy_converter.cc
diff --git a/components/policy/core/browser/android/policy_converter.cc b/components/policy/core/browser/android/policy_converter.cc
index 972467e1f959b7d07816fc31c3cc020c88824fa2..35911c76bf070c10d3a35a9537a81ea3fb617c67 100644
--- a/components/policy/core/browser/android/policy_converter.cc
+++ b/components/policy/core/browser/android/policy_converter.cc
@@ -58,7 +58,7 @@ void PolicyConverter::SetPolicyBoolean(JNIEnv* env,
jboolean value) {
SetPolicyValue(
ConvertJavaStringToUTF8(env, policyKey),
- base::WrapUnique(new base::FundamentalValue(static_cast<bool>(value))));
+ base::MakeUnique<base::FundamentalValue>(static_cast<bool>(value)));
}
void PolicyConverter::SetPolicyInteger(JNIEnv* env,
@@ -67,16 +67,16 @@ void PolicyConverter::SetPolicyInteger(JNIEnv* env,
jint value) {
SetPolicyValue(
ConvertJavaStringToUTF8(env, policyKey),
- base::WrapUnique(new base::FundamentalValue(static_cast<int>(value))));
+ base::MakeUnique<base::FundamentalValue>(static_cast<int>(value)));
}
void PolicyConverter::SetPolicyString(JNIEnv* env,
const JavaRef<jobject>& obj,
const JavaRef<jstring>& policyKey,
const JavaRef<jstring>& value) {
- SetPolicyValue(ConvertJavaStringToUTF8(env, policyKey),
- base::WrapUnique(new base::StringValue(
- ConvertJavaStringToUTF8(env, value))));
+ SetPolicyValue(
+ ConvertJavaStringToUTF8(env, policyKey),
+ base::MakeUnique<base::StringValue>(ConvertJavaStringToUTF8(env, value)));
}
void PolicyConverter::SetPolicyStringArray(JNIEnv* env,
@@ -121,16 +121,16 @@ std::unique_ptr<base::Value> PolicyConverter::ConvertValueToSchema(
std::string string_value;
if (value->GetAsString(&string_value)) {
if (string_value.compare("true") == 0)
- return base::WrapUnique(new base::FundamentalValue(true));
+ return base::MakeUnique<base::FundamentalValue>(true);
if (string_value.compare("false") == 0)
- return base::WrapUnique(new base::FundamentalValue(false));
+ return base::MakeUnique<base::FundamentalValue>(false);
return value;
}
int int_value = 0;
if (value->GetAsInteger(&int_value))
- return base::WrapUnique(new base::FundamentalValue(int_value != 0));
+ return base::MakeUnique<base::FundamentalValue>(int_value != 0);
return value;
}
@@ -140,7 +140,7 @@ std::unique_ptr<base::Value> PolicyConverter::ConvertValueToSchema(
if (value->GetAsString(&string_value)) {
int int_value = 0;
if (base::StringToInt(string_value, &int_value))
- return base::WrapUnique(new base::FundamentalValue(int_value));
+ return base::MakeUnique<base::FundamentalValue>(int_value);
}
return value;
}
@@ -150,7 +150,7 @@ std::unique_ptr<base::Value> PolicyConverter::ConvertValueToSchema(
if (value->GetAsString(&string_value)) {
double double_value = 0;
if (base::StringToDouble(string_value, &double_value))
- return base::WrapUnique(new base::FundamentalValue(double_value));
+ return base::MakeUnique<base::FundamentalValue>(double_value);
}
return value;
}
« no previous file with comments | « no previous file | components/policy/core/browser/autofill_policy_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698