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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java

Issue 2415863002: Use PermissionType instead of ContentSettingsType in Android permission infobars (Closed)
Patch Set: Merge branch 'master' into use_permission_type_for_infobar Created 4 years, 2 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 package org.chromium.chrome.browser.preferences; 5 package org.chromium.chrome.browser.preferences;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.SharedPreferences; 8 import android.content.SharedPreferences;
9 import android.util.Log; 9 import android.util.Log;
10 10
11 import org.chromium.base.ContextUtils; 11 import org.chromium.base.ContextUtils;
12 import org.chromium.base.ThreadUtils; 12 import org.chromium.base.ThreadUtils;
13 import org.chromium.base.VisibleForTesting; 13 import org.chromium.base.VisibleForTesting;
14 import org.chromium.base.annotations.CalledByNative; 14 import org.chromium.base.annotations.CalledByNative;
15 import org.chromium.chrome.browser.ContentSettingsType; 15 import org.chromium.chrome.browser.ContentSettingsType;
16 import org.chromium.chrome.browser.PermissionType;
16 import org.chromium.chrome.browser.preferences.website.ContentSetting; 17 import org.chromium.chrome.browser.preferences.website.ContentSetting;
17 import org.chromium.chrome.browser.preferences.website.ContentSettingException; 18 import org.chromium.chrome.browser.preferences.website.ContentSettingException;
18 import org.chromium.chrome.browser.preferences.website.GeolocationInfo; 19 import org.chromium.chrome.browser.preferences.website.GeolocationInfo;
19 import org.chromium.chrome.browser.preferences.website.WebsitePreferenceBridge; 20 import org.chromium.chrome.browser.preferences.website.WebsitePreferenceBridge;
20 import org.chromium.chrome.browser.search_engines.TemplateUrlService; 21 import org.chromium.chrome.browser.search_engines.TemplateUrlService;
21 22
22 import java.util.ArrayList; 23 import java.util.ArrayList;
23 import java.util.List; 24 import java.util.List;
24 25
25 /** 26 /**
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 contentSettingsType, pattern, ContentSetting.fromInt(contentSett ing), source); 235 contentSettingsType, pattern, ContentSetting.fromInt(contentSett ing), source);
235 list.add(exception); 236 list.add(exception);
236 } 237 }
237 238
238 /** 239 /**
239 * Return the android permission string for a given {@link ContentSettingsTy pe}. If there 240 * Return the android permission string for a given {@link ContentSettingsTy pe}. If there
240 * is no corresponding permission, then null will be returned. 241 * is no corresponding permission, then null will be returned.
241 * 242 *
242 * @param contentSettingType The content setting to get the android permissi on for. 243 * @param contentSettingType The content setting to get the android permissi on for.
243 * @return The android permission for the given content setting. 244 * @return The android permission for the given content setting.
245 *
246 * TODO(lshang): Remove this and migrate all call sites to use
247 * getAndroidPermissionForPermissionType() below, which takes PermissionType instead of
248 * ContentSettingsType.
244 */ 249 */
245 @CalledByNative 250 @CalledByNative
246 public static String getAndroidPermissionForContentSetting(int contentSettin gType) { 251 public static String getAndroidPermissionForContentSetting(int contentSettin gType) {
raymes 2016/10/17 01:11:12 Hmm it would be good to remove this asap. Besides
247 if (contentSettingType == ContentSettingsType.CONTENT_SETTINGS_TYPE_GEOL OCATION) { 252 if (contentSettingType == ContentSettingsType.CONTENT_SETTINGS_TYPE_GEOL OCATION) {
248 return android.Manifest.permission.ACCESS_FINE_LOCATION; 253 return android.Manifest.permission.ACCESS_FINE_LOCATION;
249 } 254 }
250 if (contentSettingType == ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDI ASTREAM_MIC) { 255 if (contentSettingType == ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDI ASTREAM_MIC) {
251 return android.Manifest.permission.RECORD_AUDIO; 256 return android.Manifest.permission.RECORD_AUDIO;
252 } 257 }
253 if (contentSettingType == ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDI ASTREAM_CAMERA) { 258 if (contentSettingType == ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDI ASTREAM_CAMERA) {
254 return android.Manifest.permission.CAMERA; 259 return android.Manifest.permission.CAMERA;
255 } 260 }
256 return null; 261 return null;
257 } 262 }
258 263
259 /** 264 /**
265 * Return the android permission string for a given {@link PermissionType}. If there
266 * is no corresponding permission, then null will be returned.
267 *
268 * @param permissionType The content setting to get the android permission f or.
269 * @return The android permission for the given content setting.
270 */
271 public static String getAndroidPermissionForPermissionType(int permissionTyp e) {
272 if (permissionType == PermissionType.GEOLOCATION) {
273 return android.Manifest.permission.ACCESS_FINE_LOCATION;
274 }
275 if (permissionType == PermissionType.AUDIO_CAPTURE) {
276 return android.Manifest.permission.RECORD_AUDIO;
277 }
278 if (permissionType == PermissionType.VIDEO_CAPTURE) {
279 return android.Manifest.permission.CAMERA;
280 }
281 return null;
282 }
283
284 /**
260 * @return whether autoplay is enabled. 285 * @return whether autoplay is enabled.
261 */ 286 */
262 public boolean isAutoplayEnabled() { 287 public boolean isAutoplayEnabled() {
263 return nativeGetAutoplayEnabled(); 288 return nativeGetAutoplayEnabled();
264 } 289 }
265 290
266 public boolean isAcceptCookiesEnabled() { 291 public boolean isAcceptCookiesEnabled() {
267 return nativeGetAcceptCookiesEnabled(); 292 return nativeGetAcceptCookiesEnabled();
268 } 293 }
269 294
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL( ); 1187 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL( );
1163 private native boolean nativeIsMetricsReportingEnabled(); 1188 private native boolean nativeIsMetricsReportingEnabled();
1164 private native void nativeSetMetricsReportingEnabled(boolean enabled); 1189 private native void nativeSetMetricsReportingEnabled(boolean enabled);
1165 private native boolean nativeIsMetricsReportingManaged(); 1190 private native boolean nativeIsMetricsReportingManaged();
1166 private native void nativeSetClickedUpdateMenuItem(boolean clicked); 1191 private native void nativeSetClickedUpdateMenuItem(boolean clicked);
1167 private native boolean nativeGetClickedUpdateMenuItem(); 1192 private native boolean nativeGetClickedUpdateMenuItem();
1168 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v ersion); 1193 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v ersion);
1169 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem(); 1194 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem();
1170 private native void nativeSetSupervisedUserId(String supervisedUserId); 1195 private native void nativeSetSupervisedUserId(String supervisedUserId);
1171 } 1196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698