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

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

Issue 1550383002: Convert Pass()→std::move() in //components (Android edition) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
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 0d199c4fc7e19fb2fcd0ecddb02092ba11bf0793..6edbe708c0f22dabd46e8681cb40059a10ed5d55 100644
--- a/components/policy/core/browser/android/policy_converter.cc
+++ b/components/policy/core/browser/android/policy_converter.cc
@@ -4,6 +4,7 @@
#include "components/policy/core/browser/android/policy_converter.h"
+#include <utility>
#include <vector>
#include "base/android/jni_android.h"
@@ -41,9 +42,9 @@ PolicyConverter::~PolicyConverter() {
}
scoped_ptr<PolicyBundle> PolicyConverter::GetPolicyBundle() {
- scoped_ptr<PolicyBundle> filled_bundle(policy_bundle_.Pass());
+ scoped_ptr<PolicyBundle> filled_bundle(std::move(policy_bundle_));
policy_bundle_.reset(new PolicyBundle);
- return filled_bundle.Pass();
+ return filled_bundle;
}
base::android::ScopedJavaLocalRef<jobject> PolicyConverter::GetJavaObject() {
@@ -82,7 +83,7 @@ void PolicyConverter::SetPolicyStringArray(JNIEnv* env,
const JavaRef<jstring>& policyKey,
const JavaRef<jobjectArray>& array) {
SetPolicyValue(ConvertJavaStringToUTF8(env, policyKey),
- ConvertJavaStringArrayToListValue(env, array).Pass());
+ ConvertJavaStringArrayToListValue(env, array));
}
// static
@@ -100,7 +101,7 @@ scoped_ptr<base::ListValue> PolicyConverter::ConvertJavaStringArrayToListValue(
list_value->AppendString(ConvertJavaStringToUTF8(env, str));
}
- return list_value.Pass();
+ return list_value;
}
// static
@@ -108,7 +109,7 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema(
scoped_ptr<base::Value> value,
const Schema& schema) {
if (!schema.valid())
- return value.Pass();
+ return value;
switch (schema.type()) {
case base::Value::TYPE_NULL:
@@ -123,13 +124,13 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema(
if (string_value.compare("false") == 0)
return make_scoped_ptr(new base::FundamentalValue(false));
- return value.Pass();
+ return value;
}
int int_value = 0;
if (value->GetAsInteger(&int_value))
return make_scoped_ptr(new base::FundamentalValue(int_value != 0));
- return value.Pass();
+ return value;
}
case base::Value::TYPE_INTEGER: {
@@ -139,7 +140,7 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema(
if (base::StringToInt(string_value, &int_value))
return make_scoped_ptr(new base::FundamentalValue(int_value));
}
- return value.Pass();
+ return value;
}
case base::Value::TYPE_DOUBLE: {
@@ -149,12 +150,12 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema(
if (base::StringToDouble(string_value, &double_value))
return make_scoped_ptr(new base::FundamentalValue(double_value));
}
- return value.Pass();
+ return value;
}
// String can't be converted from other types.
case base::Value::TYPE_STRING: {
- return value.Pass();
+ return value;
}
// Binary is not a valid schema type.
@@ -171,9 +172,9 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema(
scoped_ptr<base::Value> decoded_value =
base::JSONReader::Read(string_value);
if (decoded_value)
- return decoded_value.Pass();
+ return decoded_value;
}
- return value.Pass();
+ return value;
}
}
@@ -190,10 +191,9 @@ void PolicyConverter::SetPolicyValue(const std::string& key,
scoped_ptr<base::Value> value) {
const Schema schema = policy_schema_->GetKnownProperty(key);
const PolicyNamespace ns(POLICY_DOMAIN_CHROME, std::string());
- policy_bundle_->Get(ns)
- .Set(key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_PLATFORM,
- ConvertValueToSchema(value.Pass(), schema).release(), nullptr);
+ policy_bundle_->Get(ns).Set(
+ key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM,
+ ConvertValueToSchema(std::move(value), schema).release(), nullptr);
}
} // namespace android

Powered by Google App Engine
This is Rietveld 408576698