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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: Move permissions stuff to SensorProxy, remove aw related stuff Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java
index edad2354ef327539f6ed3196c05d72ee09c6728a..353b5da2a9f514459d93038dc7d2f6757a7e7455 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java
@@ -77,6 +77,7 @@ public class SingleWebsitePreferences extends PreferenceFragment
public static final String PREF_LOCATION_ACCESS = "location_access_list";
public static final String PREF_MIC_CAPTURE_PERMISSION = "microphone_permission_list";
public static final String PREF_MIDI_SYSEX_PERMISSION = "midi_sysex_permission_list";
+ public static final String PREF_SENSORS_PERMISSION = "sensors_permission_list";
public static final String PREF_NOTIFICATIONS_PERMISSION = "push_notifications_list";
public static final String PREF_POPUP_PERMISSION = "popup_permission_list";
public static final String PREF_PROTECTED_MEDIA_IDENTIFIER_PERMISSION =
@@ -85,18 +86,11 @@ public class SingleWebsitePreferences extends PreferenceFragment
// All permissions from the permissions preference category must be listed here.
// TODO(mvanouwerkerk): Use this array in more places to reduce verbosity.
private static final String[] PERMISSION_PREFERENCE_KEYS = {
- PREF_AUTOPLAY_PERMISSION,
- PREF_BACKGROUND_SYNC_PERMISSION,
- PREF_CAMERA_CAPTURE_PERMISSION,
- PREF_COOKIES_PERMISSION,
- PREF_JAVASCRIPT_PERMISSION,
- PREF_KEYGEN_PERMISSION,
- PREF_LOCATION_ACCESS,
- PREF_MIC_CAPTURE_PERMISSION,
- PREF_MIDI_SYSEX_PERMISSION,
- PREF_NOTIFICATIONS_PERMISSION,
- PREF_POPUP_PERMISSION,
- PREF_PROTECTED_MEDIA_IDENTIFIER_PERMISSION,
+ PREF_AUTOPLAY_PERMISSION, PREF_BACKGROUND_SYNC_PERMISSION,
+ PREF_CAMERA_CAPTURE_PERMISSION, PREF_COOKIES_PERMISSION, PREF_JAVASCRIPT_PERMISSION,
+ PREF_KEYGEN_PERMISSION, PREF_LOCATION_ACCESS, PREF_MIC_CAPTURE_PERMISSION,
+ PREF_MIDI_SYSEX_PERMISSION, PREF_NOTIFICATIONS_PERMISSION, PREF_POPUP_PERMISSION,
+ PREF_PROTECTED_MEDIA_IDENTIFIER_PERMISSION, PREF_SENSORS_PERMISSION,
};
// The website this page is displaying details about.
@@ -212,6 +206,10 @@ public class SingleWebsitePreferences extends PreferenceFragment
&& permissionInfoIsForTopLevelOrigin(other.getMidiInfo(), origin)) {
merged.setMidiInfo(other.getMidiInfo());
}
+ if (merged.getSensorInfo() == null && other.getSensorInfo() != null
+ && permissionInfoIsForTopLevelOrigin(other.getSensorInfo(), origin)) {
+ merged.setSensorInfo(other.getSensorInfo());
+ }
if (merged.getProtectedMediaIdentifierInfo() == null
&& other.getProtectedMediaIdentifierInfo() != null
&& permissionInfoIsForTopLevelOrigin(
@@ -312,6 +310,8 @@ public class SingleWebsitePreferences extends PreferenceFragment
setUpListPreference(preference, mSite.getMicrophonePermission());
} else if (PREF_MIDI_SYSEX_PERMISSION.equals(preference.getKey())) {
setUpListPreference(preference, mSite.getMidiPermission());
+ } else if (PREF_SENSORS_PERMISSION.equals(preference.getKey())) {
+ setUpListPreference(preference, mSite.getSensorsPermission());
} else if (PREF_NOTIFICATIONS_PERMISSION.equals(preference.getKey())) {
setUpListPreference(preference, mSite.getNotificationPermission());
} else if (PREF_POPUP_PERMISSION.equals(preference.getKey())) {
@@ -545,6 +545,8 @@ public class SingleWebsitePreferences extends PreferenceFragment
return ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC;
case PREF_MIDI_SYSEX_PERMISSION:
return ContentSettingsType.CONTENT_SETTINGS_TYPE_MIDI_SYSEX;
+ case PREF_SENSORS_PERMISSION:
+ return ContentSettingsType.CONTENT_SETTINGS_TYPE_SENSORS;
case PREF_NOTIFICATIONS_PERMISSION:
return ContentSettingsType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
case PREF_POPUP_PERMISSION:
@@ -607,6 +609,8 @@ public class SingleWebsitePreferences extends PreferenceFragment
mSite.setMicrophonePermission(permission);
} else if (PREF_MIDI_SYSEX_PERMISSION.equals(preference.getKey())) {
mSite.setMidiPermission(permission);
+ } else if (PREF_SENSORS_PERMISSION.equals(preference.getKey())) {
+ mSite.setSensorsPermission(permission);
} else if (PREF_NOTIFICATIONS_PERMISSION.equals(preference.getKey())) {
mSite.setNotificationPermission(permission);
} else if (PREF_POPUP_PERMISSION.equals(preference.getKey())) {
@@ -679,6 +683,7 @@ public class SingleWebsitePreferences extends PreferenceFragment
mSite.setKeygenPermission(ContentSetting.DEFAULT);
mSite.setMicrophonePermission(ContentSetting.DEFAULT);
mSite.setMidiPermission(ContentSetting.DEFAULT);
+ mSite.setSensorsPermission(ContentSetting.DEFAULT);
mSite.setNotificationPermission(ContentSetting.DEFAULT);
mSite.setPopupPermission(ContentSetting.DEFAULT);
mSite.setProtectedMediaIdentifierPermission(ContentSetting.DEFAULT);

Powered by Google App Engine
This is Rietveld 408576698