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

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

Issue 1084423002: Split Camera and Mic into two permissions on the Site Details page (under Site Settings). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polish Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsiteSettingsCategoryFilter.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsiteSettingsCategoryFilter.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsiteSettingsCategoryFilter.java
index b0b1bda761acc0b00c547c06ba819f3419275e05..d47e2512672f6e17c7e0bc8c65da407c000cbc70 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsiteSettingsCategoryFilter.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/WebsiteSettingsCategoryFilter.java
@@ -12,15 +12,16 @@ import org.chromium.chrome.browser.ContentSettingsType;
public class WebsiteSettingsCategoryFilter {
// The actual values for the keys for the category filter.
private static final String FILTER_ALL_SITES = "all_sites";
+ private static final String FILTER_CAMERA = "camera";
private static final String FILTER_COOKIES = "cookies";
- private static final String FILTER_CAMERA_MIC = "use_camera_or_mic";
- private static final String FILTER_JAVASCRIPT = "javascript";
private static final String FILTER_IMAGES = "images";
+ private static final String FILTER_JAVASCRIPT = "javascript";
private static final String FILTER_DEVICE_LOCATION = "device_location";
private static final String FILTER_FULLSCREEN = "fullscreen";
- private static final String FILTER_USE_STORAGE = "use_storage";
+ private static final String FILTER_MICROPHONE = "microphone";
private static final String FILTER_POPUPS = "popups";
public static final String FILTER_PUSH_NOTIFICATIONS = "push_notifications";
+ private static final String FILTER_USE_STORAGE = "use_storage";
public WebsiteSettingsCategoryFilter() {
}
@@ -29,22 +30,24 @@ public class WebsiteSettingsCategoryFilter {
* Converts a category filter key (see above) to content settings enum.
*/
public int toContentSettingsType(String key) {
- if (showCookiesSites(key)) {
+ if (showCameraSites(key)) {
+ return ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
+ } else if (showCookiesSites(key)) {
return ContentSettingsType.CONTENT_SETTINGS_TYPE_COOKIES;
- } else if (showCameraMicSites(key)) {
- return ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM;
- } else if (showPopupSites(key)) {
- return ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS;
+ } else if (showFullscreenSites(key)) {
+ return ContentSettingsType.CONTENT_SETTINGS_TYPE_FULLSCREEN;
} else if (showGeolocationSites(key)) {
return ContentSettingsType.CONTENT_SETTINGS_TYPE_GEOLOCATION;
} else if (showImagesSites(key)) {
return ContentSettingsType.CONTENT_SETTINGS_TYPE_IMAGES;
- } else if (showPushNotificationsSites(key)) {
- return ContentSettingsType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
} else if (showJavaScriptSites(key)) {
return ContentSettingsType.CONTENT_SETTINGS_TYPE_JAVASCRIPT;
- } else if (showFullscreenSites(key)) {
- return ContentSettingsType.CONTENT_SETTINGS_TYPE_FULLSCREEN;
+ } else if (showMicrophoneSites(key)) {
+ return ContentSettingsType.CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC;
+ } else if (showPopupSites(key)) {
+ return ContentSettingsType.CONTENT_SETTINGS_TYPE_POPUPS;
+ } else if (showPushNotificationsSites(key)) {
+ return ContentSettingsType.CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
}
return -1;
}
@@ -59,18 +62,10 @@ public class WebsiteSettingsCategoryFilter {
/**
* @param filterValue A category value.
- * @return Whether the category passed is the cookies category.
- */
- public boolean showCookiesSites(String filterValue) {
- return filterValue.equals(FILTER_COOKIES);
- }
-
- /**
- * @param filterValue A category value.
- * @return Whether the category passed is the camera/mic category.
+ * @return Whether the category passed is the camera category.
*/
- public boolean showCameraMicSites(String filterValue) {
- return filterValue.equals(FILTER_CAMERA_MIC);
+ public boolean showCameraSites(String filterValue) {
+ return filterValue.equals(FILTER_CAMERA);
}
/**
@@ -83,10 +78,10 @@ public class WebsiteSettingsCategoryFilter {
/**
* @param filterValue A category value.
- * @return Whether the category passed is the javascript category.
+ * @return Whether the category passed is the cookies category.
*/
- public boolean showJavaScriptSites(String filterValue) {
- return filterValue.equals(FILTER_JAVASCRIPT);
+ public boolean showCookiesSites(String filterValue) {
+ return filterValue.equals(FILTER_COOKIES);
}
/**
@@ -107,10 +102,18 @@ public class WebsiteSettingsCategoryFilter {
/**
* @param filterValue A category value.
- * @return Whether the category passed is the storage category.
+ * @return Whether the category passed is the javascript category.
*/
- public boolean showStorageSites(String filterValue) {
- return filterValue.equals(FILTER_USE_STORAGE);
+ public boolean showJavaScriptSites(String filterValue) {
+ return filterValue.equals(FILTER_JAVASCRIPT);
+ }
+
+ /**
+ * @param filterValue A category value.
+ * @return Whether the category passed is the microphone category.
+ */
+ public boolean showMicrophoneSites(String filterValue) {
+ return filterValue.equals(FILTER_MICROPHONE);
}
/**
@@ -128,4 +131,12 @@ public class WebsiteSettingsCategoryFilter {
public boolean showPushNotificationsSites(String filterValue) {
return filterValue.equals(FILTER_PUSH_NOTIFICATIONS);
}
+
+ /**
+ * @param filterValue A category value.
+ * @return Whether the category passed is the storage category.
+ */
+ public boolean showStorageSites(String filterValue) {
+ return filterValue.equals(FILTER_USE_STORAGE);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698