Commit 6db11f86 authored by Natalie Chouinard's avatar Natalie Chouinard Committed by Commit Bot

Jelly Bean cleanup of Site Settings

The Protected Content menu should always be visible now. Remove checks
that are no longer necessary now that we've ended JB support.

Bug: 923477
Change-Id: If9ef76e1399dbc754f31dbd9ceb23447b4cfcc97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1628995Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Natalie Chouinard <chouinard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663816}
parent f59e9de1
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
package org.chromium.chrome.browser.preferences.website; package org.chromium.chrome.browser.preferences.website;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.Preference; import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener; import android.preference.Preference.OnPreferenceClickListener;
...@@ -28,10 +27,9 @@ import java.util.List; ...@@ -28,10 +27,9 @@ import java.util.List;
* permissions that have been granted to websites, as well as enable or disable permissions * permissions that have been granted to websites, as well as enable or disable permissions
* browser-wide. * browser-wide.
* *
* Depending on version and which experiment is running, this class also handles showing the Media * TODO(chouinard): The media sub-menu no longer needs to be modified programmatically based on
* sub-menu, which contains Autoplay and Protected Content. To avoid the Media sub-menu having only * version/experiment so the organization of this menu should be simplified, probably by moving
* one sub-item, when either Autoplay or Protected Content should not be visible the other is shown * Media to its own dedicated PreferenceFragment rather than sharing this one.
* in the main setting instead (as opposed to under Media).
*/ */
public class SiteSettingsPreferences extends PreferenceFragment public class SiteSettingsPreferences extends PreferenceFragment
implements OnPreferenceClickListener { implements OnPreferenceClickListener {
...@@ -41,9 +39,6 @@ public class SiteSettingsPreferences extends PreferenceFragment ...@@ -41,9 +39,6 @@ public class SiteSettingsPreferences extends PreferenceFragment
static final String MEDIA_KEY = "media"; static final String MEDIA_KEY = "media";
static final String TRANSLATE_KEY = "translate"; static final String TRANSLATE_KEY = "translate";
// Whether the Protected Content menu is available for display.
boolean mProtectedContentMenuAvailable;
// Whether this class is handling showing the Media sub-menu (and not the main menu). // Whether this class is handling showing the Media sub-menu (and not the main menu).
boolean mMediaSubMenu; boolean mMediaSubMenu;
...@@ -53,8 +48,6 @@ public class SiteSettingsPreferences extends PreferenceFragment ...@@ -53,8 +48,6 @@ public class SiteSettingsPreferences extends PreferenceFragment
PreferenceUtils.addPreferencesFromResource(this, R.xml.site_settings_preferences); PreferenceUtils.addPreferencesFromResource(this, R.xml.site_settings_preferences);
getActivity().setTitle(R.string.prefs_site_settings); getActivity().setTitle(R.string.prefs_site_settings);
mProtectedContentMenuAvailable = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
if (getArguments() != null) { if (getArguments() != null) {
String category = String category =
getArguments().getString(SingleCategoryPreferences.EXTRA_CATEGORY, ""); getArguments().getString(SingleCategoryPreferences.EXTRA_CATEGORY, "");
...@@ -89,15 +82,10 @@ public class SiteSettingsPreferences extends PreferenceFragment ...@@ -89,15 +82,10 @@ public class SiteSettingsPreferences extends PreferenceFragment
getPreferenceScreen().removePreference(findPreference(MEDIA_KEY)); getPreferenceScreen().removePreference(findPreference(MEDIA_KEY));
getPreferenceScreen().removePreference(findPreference(TRANSLATE_KEY)); getPreferenceScreen().removePreference(findPreference(TRANSLATE_KEY));
} else { } else {
// If both Autoplay and Protected Content menus are available, they'll be tucked under // These will be tucked under the Media subkey, so don't show them on the main menu.
// the Media key. Otherwise, we can remove the Media menu entry. getPreferenceScreen().removePreference(findPreference(Type.AUTOPLAY));
if (!mProtectedContentMenuAvailable) {
getPreferenceScreen().removePreference(findPreference(MEDIA_KEY));
} else {
// This will be tucked under the Media subkey, so no reason to show them now.
getPreferenceScreen().removePreference(findPreference(Type.AUTOPLAY));
}
getPreferenceScreen().removePreference(findPreference(Type.PROTECTED_MEDIA)); getPreferenceScreen().removePreference(findPreference(Type.PROTECTED_MEDIA));
// TODO(csharrison): Remove this condition once the experimental UI lands. It is not // TODO(csharrison): Remove this condition once the experimental UI lands. It is not
// great to dynamically remove the preference in this way. // great to dynamically remove the preference in this way.
if (!SiteSettingsCategory.adsCategoryEnabled()) { if (!SiteSettingsCategory.adsCategoryEnabled()) {
...@@ -131,12 +119,6 @@ public class SiteSettingsPreferences extends PreferenceFragment ...@@ -131,12 +119,6 @@ public class SiteSettingsPreferences extends PreferenceFragment
websitePrefs.add(Type.ADS); websitePrefs.add(Type.ADS);
} }
websitePrefs.add(Type.AUTOMATIC_DOWNLOADS); websitePrefs.add(Type.AUTOMATIC_DOWNLOADS);
// When showing the main menu, if Protected Content is not available, only Autoplay
// will be visible.
if (!mProtectedContentMenuAvailable) {
websitePrefs.add(Type.AUTOPLAY);
}
websitePrefs.add(Type.BACKGROUND_SYNC); websitePrefs.add(Type.BACKGROUND_SYNC);
websitePrefs.add(Type.CAMERA); websitePrefs.add(Type.CAMERA);
if (!FeatureUtilities.isNoTouchModeEnabled()) { if (!FeatureUtilities.isNoTouchModeEnabled()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment