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

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

Issue 1929983002: Site Settings: Add Autoplay as a permission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head Created 4 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/SingleCategoryPreferences.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java
index 3d9092f09021db545bd67ddfd4ab88bf5a81273b..d5dc057e206e8403d1a310d0219d1149348f5b98 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleCategoryPreferences.java
@@ -207,7 +207,9 @@ public class SingleCategoryPreferences extends PreferenceFragment
*/
private boolean isOnBlockList(WebsitePreference website) {
// This list is ordered alphabetically by permission.
- if (mCategory.showBackgroundSyncSites()) {
+ if (mCategory.showAutoplaySites()) {
+ return website.site().getAutoplayPermission() == ContentSetting.BLOCK;
+ } else if (mCategory.showBackgroundSyncSites()) {
return website.site().getBackgroundSyncPermission() == ContentSetting.BLOCK;
} else if (mCategory.showCameraSites()) {
return website.site().getCameraPermission() == ContentSetting.BLOCK;
@@ -396,7 +398,9 @@ public class SingleCategoryPreferences extends PreferenceFragment
if (READ_WRITE_TOGGLE_KEY.equals(preference.getKey())) {
if (mCategory.isManaged()) return false;
- if (mCategory.showBackgroundSyncSites()) {
+ if (mCategory.showAutoplaySites()) {
+ PrefServiceBridge.getInstance().setAutoplayEnabled((boolean) newValue);
+ } else if (mCategory.showBackgroundSyncSites()) {
PrefServiceBridge.getInstance().setBackgroundSyncEnabled((boolean) newValue);
} else if (mCategory.showCameraSites()) {
PrefServiceBridge.getInstance().setCameraEnabled((boolean) newValue);
@@ -421,7 +425,8 @@ public class SingleCategoryPreferences extends PreferenceFragment
}
// Categories that support adding exceptions also manage the 'Add site' preference.
- if (mCategory.showJavaScriptSites() || mCategory.showBackgroundSyncSites()) {
+ if (mCategory.showAutoplaySites() || mCategory.showBackgroundSyncSites()
+ || mCategory.showJavaScriptSites()) {
if ((boolean) newValue) {
Preference addException = getPreferenceScreen().findPreference(
ADD_EXCEPTION_KEY);
@@ -448,10 +453,12 @@ public class SingleCategoryPreferences extends PreferenceFragment
private String getAddExceptionDialogMessage() {
int resource = 0;
- if (mCategory.showJavaScriptSites()) {
- resource = R.string.website_settings_add_site_description_javascript;
+ if (mCategory.showAutoplaySites()) {
+ resource = R.string.website_settings_add_site_description_autoplay;
} else if (mCategory.showBackgroundSyncSites()) {
resource = R.string.website_settings_add_site_description_background_sync;
+ } else if (mCategory.showJavaScriptSites()) {
+ resource = R.string.website_settings_add_site_description_javascript;
}
assert resource > 0;
return getResources().getString(resource);
@@ -503,7 +510,9 @@ public class SingleCategoryPreferences extends PreferenceFragment
configureGlobalToggles();
- if ((mCategory.showJavaScriptSites()
+ if ((mCategory.showAutoplaySites()
+ && !PrefServiceBridge.getInstance().isAutoplayEnabled())
+ || (mCategory.showJavaScriptSites()
&& !PrefServiceBridge.getInstance().javaScriptEnabled())
|| (mCategory.showBackgroundSyncSites()
&& !PrefServiceBridge.getInstance().isBackgroundSyncAllowed())) {
@@ -592,7 +601,10 @@ public class SingleCategoryPreferences extends PreferenceFragment
if (mCategory.isManaged() && !mCategory.isManagedByCustodian()) {
globalToggle.setIcon(R.drawable.controlled_setting_mandatory);
}
- if (mCategory.showBackgroundSyncSites()) {
+ if (mCategory.showAutoplaySites()) {
+ globalToggle.setChecked(
+ PrefServiceBridge.getInstance().isAutoplayEnabled());
+ } else if (mCategory.showBackgroundSyncSites()) {
globalToggle.setChecked(
PrefServiceBridge.getInstance().isBackgroundSyncAllowed());
} else if (mCategory.showCameraSites()) {

Powered by Google App Engine
This is Rietveld 408576698