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

Side by Side Diff: chrome/browser/android/preferences/pref_service_bridge.cc

Issue 2682863002: [Android] Explicitly request all needed runtime permissions. (Closed)
Patch Set: Address mlamouri@ comments Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698