Commit 2c797624 authored by Robbie McElrath's avatar Robbie McElrath Committed by Commit Bot

[WebLayer] Move Site Settings QUIET_NOTIFICATION_PROMPTS feature check behind SiteSettingsClient

This CL moves QUIET_NOTIFICATION_PROMPTS Feature checks to
SiteSettingsClient, which removes the Site Settings UI's last use of
ChromeFeatureList. This feature wasn't moved into a separate
componentized *FeatureList class because it isn't specific to any one
component.

Bug: 1058597
Change-Id: Iaf293c477baa32b676214b996b9b106e24830aa7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144825
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759022}
parent 4d56c83a
...@@ -10,6 +10,7 @@ import android.graphics.Bitmap; ...@@ -10,6 +10,7 @@ import android.graphics.Bitmap;
import androidx.preference.Preference; import androidx.preference.Preference;
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.help.HelpAndFeedback; import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate; import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate;
...@@ -79,4 +80,9 @@ public class ChromeSiteSettingsClient implements SiteSettingsClient { ...@@ -79,4 +80,9 @@ public class ChromeSiteSettingsClient implements SiteSettingsClient {
mCallback.onResult(image); mCallback.onResult(image);
} }
} }
@Override
public boolean isQuietNotificationPromptsFeatureEnabled() {
return ChromeFeatureList.isEnabled(ChromeFeatureList.QUIET_NOTIFICATION_PROMPTS);
}
} }
...@@ -38,7 +38,6 @@ import org.chromium.base.ApiCompatibilityUtils; ...@@ -38,7 +38,6 @@ import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.browserservices.permissiondelegation.TrustedWebActivityPermissionManager; import org.chromium.chrome.browser.browserservices.permissiondelegation.TrustedWebActivityPermissionManager;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.preferences.PrefServiceBridge; import org.chromium.chrome.browser.preferences.PrefServiceBridge;
import org.chromium.chrome.browser.site_settings.FourStateCookieSettingsPreference.CookieSettingsState; import org.chromium.chrome.browser.site_settings.FourStateCookieSettingsPreference.CookieSettingsState;
...@@ -974,7 +973,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment ...@@ -974,7 +973,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
screen.removePreference(notificationsVibrate); screen.removePreference(notificationsVibrate);
} }
if (ChromeFeatureList.isEnabled(ChromeFeatureList.QUIET_NOTIFICATION_PROMPTS)) { if (getSiteSettingsClient().isQuietNotificationPromptsFeatureEnabled()) {
notificationsQuietUi.setOnPreferenceChangeListener(this); notificationsQuietUi.setOnPreferenceChangeListener(this);
} else { } else {
screen.removePreference(notificationsQuietUi); screen.removePreference(notificationsQuietUi);
...@@ -1111,7 +1110,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment ...@@ -1111,7 +1110,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
NOTIFICATIONS_VIBRATE_TOGGLE_KEY); NOTIFICATIONS_VIBRATE_TOGGLE_KEY);
if (vibrate_pref != null) vibrate_pref.setEnabled(categoryEnabled); if (vibrate_pref != null) vibrate_pref.setEnabled(categoryEnabled);
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.QUIET_NOTIFICATION_PROMPTS)) return; if (!getSiteSettingsClient().isQuietNotificationPromptsFeatureEnabled()) return;
// The notifications quiet ui checkbox. // The notifications quiet ui checkbox.
ChromeBaseCheckBoxPreference quiet_ui_pref = ChromeBaseCheckBoxPreference quiet_ui_pref =
......
...@@ -39,4 +39,9 @@ public interface SiteSettingsClient { ...@@ -39,4 +39,9 @@ public interface SiteSettingsClient {
*/ */
void getLocalFaviconImageForURL( void getLocalFaviconImageForURL(
String faviconUrl, int faviconSizePx, Callback<Bitmap> callback); String faviconUrl, int faviconSizePx, Callback<Bitmap> callback);
/**
* @return true if the QuietNotificationPrompts Feature is enabled.
*/
boolean isQuietNotificationPromptsFeatureEnabled();
} }
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