| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/android/policy_converter.h" | 5 #include "components/policy/core/browser/android/policy_converter.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 SetPolicyValue(ConvertJavaStringToUTF8(env, policyKey), | 67 SetPolicyValue(ConvertJavaStringToUTF8(env, policyKey), |
| 68 base::MakeUnique<base::Value>(static_cast<int>(value))); | 68 base::MakeUnique<base::Value>(static_cast<int>(value))); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void PolicyConverter::SetPolicyString(JNIEnv* env, | 71 void PolicyConverter::SetPolicyString(JNIEnv* env, |
| 72 const JavaRef<jobject>& obj, | 72 const JavaRef<jobject>& obj, |
| 73 const JavaRef<jstring>& policyKey, | 73 const JavaRef<jstring>& policyKey, |
| 74 const JavaRef<jstring>& value) { | 74 const JavaRef<jstring>& value) { |
| 75 SetPolicyValue( | 75 SetPolicyValue( |
| 76 ConvertJavaStringToUTF8(env, policyKey), | 76 ConvertJavaStringToUTF8(env, policyKey), |
| 77 base::MakeUnique<base::StringValue>(ConvertJavaStringToUTF8(env, value))); | 77 base::MakeUnique<base::Value>(ConvertJavaStringToUTF8(env, value))); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void PolicyConverter::SetPolicyStringArray(JNIEnv* env, | 80 void PolicyConverter::SetPolicyStringArray(JNIEnv* env, |
| 81 const JavaRef<jobject>& obj, | 81 const JavaRef<jobject>& obj, |
| 82 const JavaRef<jstring>& policyKey, | 82 const JavaRef<jstring>& policyKey, |
| 83 const JavaRef<jobjectArray>& array) { | 83 const JavaRef<jobjectArray>& array) { |
| 84 SetPolicyValue(ConvertJavaStringToUTF8(env, policyKey), | 84 SetPolicyValue(ConvertJavaStringToUTF8(env, policyKey), |
| 85 ConvertJavaStringArrayToListValue(env, array)); | 85 ConvertJavaStringArrayToListValue(env, array)); |
| 86 } | 86 } |
| 87 | 87 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 std::unique_ptr<base::Value> value) { | 191 std::unique_ptr<base::Value> value) { |
| 192 const Schema schema = policy_schema_->GetKnownProperty(key); | 192 const Schema schema = policy_schema_->GetKnownProperty(key); |
| 193 const PolicyNamespace ns(POLICY_DOMAIN_CHROME, std::string()); | 193 const PolicyNamespace ns(POLICY_DOMAIN_CHROME, std::string()); |
| 194 policy_bundle_->Get(ns).Set( | 194 policy_bundle_->Get(ns).Set( |
| 195 key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, | 195 key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, |
| 196 ConvertValueToSchema(std::move(value), schema), nullptr); | 196 ConvertValueToSchema(std::move(value), schema), nullptr); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace android | 199 } // namespace android |
| 200 } // namespace policy | 200 } // namespace policy |
| OLD | NEW |