OLD | NEW |
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 "chrome/browser/android/preferences/pref_service_bridge.h" | 5 #include "chrome/browser/android/preferences/pref_service_bridge.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 } | 1214 } |
1215 if (!it->second.empty()) | 1215 if (!it->second.empty()) |
1216 output_list.push_back(it->first + "-" + it->second); | 1216 output_list.push_back(it->first + "-" + it->second); |
1217 } | 1217 } |
1218 | 1218 |
1219 std::reverse(output_list.begin(), output_list.end()); | 1219 std::reverse(output_list.begin(), output_list.end()); |
1220 *accept_languages = base::JoinString(output_list, ","); | 1220 *accept_languages = base::JoinString(output_list, ","); |
1221 } | 1221 } |
1222 | 1222 |
1223 // static | 1223 // static |
1224 std::string PrefServiceBridge::GetAndroidPermissionForContentSetting( | 1224 void PrefServiceBridge::GetAndroidPermissionsForContentSetting( |
1225 ContentSettingsType content_type) { | 1225 ContentSettingsType content_type, std::vector<std::string>* out) { |
1226 JNIEnv* env = AttachCurrentThread(); | 1226 JNIEnv* env = AttachCurrentThread(); |
1227 base::android::ScopedJavaLocalRef<jstring> android_permission = | 1227 base::android::AppendJavaStringArrayToStringVector( |
1228 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( | 1228 env, |
1229 env, content_type); | 1229 Java_PrefServiceBridge_getAndroidPermissionsForContentSetting( |
1230 if (android_permission.is_null()) | 1230 env, content_type) |
1231 return std::string(); | 1231 .obj(), |
1232 | 1232 out); |
1233 return ConvertJavaStringToUTF8(android_permission); | |
1234 } | 1233 } |
1235 | 1234 |
1236 static void SetSupervisedUserId(JNIEnv* env, | 1235 static void SetSupervisedUserId(JNIEnv* env, |
1237 const JavaParamRef<jobject>& obj, | 1236 const JavaParamRef<jobject>& obj, |
1238 const JavaParamRef<jstring>& pref) { | 1237 const JavaParamRef<jstring>& pref) { |
1239 GetPrefService()->SetString(prefs::kSupervisedUserId, | 1238 GetPrefService()->SetString(prefs::kSupervisedUserId, |
1240 ConvertJavaStringToUTF8(env, pref)); | 1239 ConvertJavaStringToUTF8(env, pref)); |
1241 } | 1240 } |
OLD | NEW |