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

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

Issue 2682863002: [Android] Explicitly request all needed runtime permissions. (Closed)
Patch Set: Rebase 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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 } 1216 }
1217 if (!it->second.empty()) 1217 if (!it->second.empty())
1218 output_list.push_back(it->first + "-" + it->second); 1218 output_list.push_back(it->first + "-" + it->second);
1219 } 1219 }
1220 1220
1221 std::reverse(output_list.begin(), output_list.end()); 1221 std::reverse(output_list.begin(), output_list.end());
1222 *accept_languages = base::JoinString(output_list, ","); 1222 *accept_languages = base::JoinString(output_list, ",");
1223 } 1223 }
1224 1224
1225 // static 1225 // static
1226 std::string PrefServiceBridge::GetAndroidPermissionForContentSetting( 1226 void PrefServiceBridge::GetAndroidPermissionsForContentSetting(
1227 ContentSettingsType content_type) { 1227 ContentSettingsType content_type,
1228 std::vector<std::string>* out) {
1228 JNIEnv* env = AttachCurrentThread(); 1229 JNIEnv* env = AttachCurrentThread();
1229 base::android::ScopedJavaLocalRef<jstring> android_permission = 1230 base::android::AppendJavaStringArrayToStringVector(
1230 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( 1231 env, Java_PrefServiceBridge_getAndroidPermissionsForContentSetting(
1231 env, content_type); 1232 env, content_type)
1232 if (android_permission.is_null()) 1233 .obj(),
1233 return std::string(); 1234 out);
1234
1235 return ConvertJavaStringToUTF8(android_permission);
1236 } 1235 }
1237 1236
1238 static void SetSupervisedUserId(JNIEnv* env, 1237 static void SetSupervisedUserId(JNIEnv* env,
1239 const JavaParamRef<jobject>& obj, 1238 const JavaParamRef<jobject>& obj,
1240 const JavaParamRef<jstring>& pref) { 1239 const JavaParamRef<jstring>& pref) {
1241 GetPrefService()->SetString(prefs::kSupervisedUserId, 1240 GetPrefService()->SetString(prefs::kSupervisedUserId,
1242 ConvertJavaStringToUTF8(env, pref)); 1241 ConvertJavaStringToUTF8(env, pref));
1243 } 1242 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698