Commit 951d0abb authored by Bettina Dea's avatar Bettina Dea Committed by Commit Bot

Highlight the Enhanced Protection section.

If the Safe Browsing settings was reached to
from the Enhanced Protection promo from the
new tab page on Android, then the enhanced
protection radio button section should be
highlighted in Blue50.

Screenshot: http://screen/5MRDafWDYScPBac
Dark Mode: http://screen/AznVfBwK8AD8rN3

Bug: 1135808
Change-Id: Id9cdf2a42cf0c12bf1ee46c80cfdf79a288600ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2454490Reviewed-by: default avatarLijin Shen <lazzzis@google.com>
Reviewed-by: default avatarXinghui Lu <xinghuilu@chromium.org>
Reviewed-by: default avatarNatalie Chouinard <chouinard@chromium.org>
Commit-Queue: Bettina Dea <bdea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816698}
parent 95638f00
...@@ -50,13 +50,13 @@ public class EnhancedProtectionPromoController { ...@@ -50,13 +50,13 @@ public class EnhancedProtectionPromoController {
private EnhancedProtectionPromoStateListener mStateListener; private EnhancedProtectionPromoStateListener mStateListener;
private PromoCardCoordinator mPromoCoordinator; private PromoCardCoordinator mPromoCoordinator;
private PropertyModel mModel; private PropertyModel mModel;
private boolean mIsPromoShowing; private boolean mIsPromoShowing;
/** /**
* Build the EnhancedProtectionPromoController that handles the set up / tear down for the * Build the EnhancedProtectionPromoController that handles the set up / tear down for the
* enhanced protection promo. * enhanced protection promo.
* @param context Context from the activity. * @param context Context from the activity.
* @param profile Current user profile.
*/ */
public EnhancedProtectionPromoController(Context context, @Nullable Profile profile) { public EnhancedProtectionPromoController(Context context, @Nullable Profile profile) {
mContext = context; mContext = context;
......
...@@ -46,10 +46,12 @@ android_library("java") { ...@@ -46,10 +46,12 @@ android_library("java") {
"//components/prefs/android:java", "//components/prefs/android:java",
"//components/user_prefs/android:java", "//components/user_prefs/android:java",
"//third_party/android_deps:androidx_annotation_annotation_java", "//third_party/android_deps:androidx_annotation_annotation_java",
"//third_party/android_deps:androidx_core_core_java",
"//third_party/android_deps:androidx_fragment_fragment_java", "//third_party/android_deps:androidx_fragment_fragment_java",
"//third_party/android_deps:androidx_preference_preference_java", "//third_party/android_deps:androidx_preference_preference_java",
"//third_party/android_deps:androidx_vectordrawable_vectordrawable_java", "//third_party/android_deps:androidx_vectordrawable_vectordrawable_java",
"//ui/android:ui_full_java", "//ui/android:ui_full_java",
"//ui/android:ui_no_recycler_view_java",
] ]
annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
srcjar_deps = [ ":safe_browsing_enums" ] srcjar_deps = [ ":safe_browsing_enums" ]
......
...@@ -11,10 +11,12 @@ import android.widget.RadioGroup; ...@@ -11,10 +11,12 @@ import android.widget.RadioGroup;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.core.content.ContextCompat;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder; import androidx.preference.PreferenceViewHolder;
import org.chromium.chrome.browser.safe_browsing.SafeBrowsingState; import org.chromium.chrome.browser.safe_browsing.SafeBrowsingState;
import org.chromium.chrome.browser.safe_browsing.metrics.SettingsAccessPoint;
import org.chromium.components.browser_ui.settings.ManagedPreferenceDelegate; import org.chromium.components.browser_ui.settings.ManagedPreferenceDelegate;
import org.chromium.components.browser_ui.settings.ManagedPreferencesUtils; import org.chromium.components.browser_ui.settings.ManagedPreferencesUtils;
import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; import org.chromium.components.browser_ui.widget.RadioButtonWithDescription;
...@@ -53,6 +55,7 @@ public class RadioButtonGroupSafeBrowsingPreference extends Preference ...@@ -53,6 +55,7 @@ public class RadioButtonGroupSafeBrowsingPreference extends Preference
private RadioButtonWithDescription mNoProtection; private RadioButtonWithDescription mNoProtection;
private @SafeBrowsingState int mSafeBrowsingState; private @SafeBrowsingState int mSafeBrowsingState;
private boolean mIsEnhancedProtectionEnabled; private boolean mIsEnhancedProtectionEnabled;
private @SettingsAccessPoint int mAccessPoint;
private OnSafeBrowsingModeDetailsRequested mSafeBrowsingModeDetailsRequestedListener; private OnSafeBrowsingModeDetailsRequested mSafeBrowsingModeDetailsRequestedListener;
private ManagedPreferenceDelegate mManagedPrefDelegate; private ManagedPreferenceDelegate mManagedPrefDelegate;
...@@ -65,11 +68,13 @@ public class RadioButtonGroupSafeBrowsingPreference extends Preference ...@@ -65,11 +68,13 @@ public class RadioButtonGroupSafeBrowsingPreference extends Preference
* Set Safe Browsing state and Enhanced Protection state. Called before onBindViewHolder. * Set Safe Browsing state and Enhanced Protection state. Called before onBindViewHolder.
* @param safeBrowsingState The current Safe Browsing state. * @param safeBrowsingState The current Safe Browsing state.
* @param isEnhancedProtectionEnabled Whether to show the Enhanced Protection button. * @param isEnhancedProtectionEnabled Whether to show the Enhanced Protection button.
* @param accessPoint Where this preference was triggered to be created.
*/ */
public void init( public void init(@SafeBrowsingState int safeBrowsingState, boolean isEnhancedProtectionEnabled,
@SafeBrowsingState int safeBrowsingState, boolean isEnhancedProtectionEnabled) { @SettingsAccessPoint int accessPoint) {
mSafeBrowsingState = safeBrowsingState; mSafeBrowsingState = safeBrowsingState;
mIsEnhancedProtectionEnabled = isEnhancedProtectionEnabled; mIsEnhancedProtectionEnabled = isEnhancedProtectionEnabled;
mAccessPoint = accessPoint;
assert ((mSafeBrowsingState != SafeBrowsingState.ENHANCED_PROTECTION) assert ((mSafeBrowsingState != SafeBrowsingState.ENHANCED_PROTECTION)
|| mIsEnhancedProtectionEnabled) || mIsEnhancedProtectionEnabled)
: "Safe Browsing state shouldn't be enhanced protection when the flag is disabled."; : "Safe Browsing state shouldn't be enhanced protection when the flag is disabled.";
...@@ -95,6 +100,10 @@ public class RadioButtonGroupSafeBrowsingPreference extends Preference ...@@ -95,6 +100,10 @@ public class RadioButtonGroupSafeBrowsingPreference extends Preference
if (mIsEnhancedProtectionEnabled) { if (mIsEnhancedProtectionEnabled) {
mEnhancedProtection = (RadioButtonWithDescriptionAndAuxButton) holder.findViewById( mEnhancedProtection = (RadioButtonWithDescriptionAndAuxButton) holder.findViewById(
R.id.enhanced_protection); R.id.enhanced_protection);
if (mAccessPoint == SettingsAccessPoint.SURFACE_EXPLORER_PROMO_SLINGER) {
mEnhancedProtection.setBackgroundColor(ContextCompat.getColor(
getContext(), R.color.preference_highlighted_bg_color));
}
mEnhancedProtection.setVisibility(View.VISIBLE); mEnhancedProtection.setVisibility(View.VISIBLE);
mEnhancedProtection.setAuxButtonClickedListener(this); mEnhancedProtection.setAuxButtonClickedListener(this);
} }
......
...@@ -83,7 +83,8 @@ public class SafeBrowsingSettingsFragment extends SafeBrowsingSettingsFragmentBa ...@@ -83,7 +83,8 @@ public class SafeBrowsingSettingsFragment extends SafeBrowsingSettingsFragmentBa
mSafeBrowsingPreference = findPreference(PREF_SAFE_BROWSING); mSafeBrowsingPreference = findPreference(PREF_SAFE_BROWSING);
mSafeBrowsingPreference.init(SafeBrowsingBridge.getSafeBrowsingState(), mSafeBrowsingPreference.init(SafeBrowsingBridge.getSafeBrowsingState(),
ChromeFeatureList.isEnabled( ChromeFeatureList.isEnabled(
ChromeFeatureList.SAFE_BROWSING_ENHANCED_PROTECTION_ENABLED)); ChromeFeatureList.SAFE_BROWSING_ENHANCED_PROTECTION_ENABLED),
mAccessPoint);
mSafeBrowsingPreference.setSafeBrowsingModeDetailsRequestedListener(this); mSafeBrowsingPreference.setSafeBrowsingModeDetailsRequestedListener(this);
mSafeBrowsingPreference.setManagedPreferenceDelegate(managedPreferenceDelegate); mSafeBrowsingPreference.setManagedPreferenceDelegate(managedPreferenceDelegate);
mSafeBrowsingPreference.setOnPreferenceChangeListener(this); mSafeBrowsingPreference.setOnPreferenceChangeListener(this);
......
...@@ -75,4 +75,5 @@ ...@@ -75,4 +75,5 @@
<color name="omnibox_bg_color">@color/omnibox_bg_color_dark</color> <color name="omnibox_bg_color">@color/omnibox_bg_color_dark</color>
<color name="image_loading_color">@color/image_loading_color_light</color> <color name="image_loading_color">@color/image_loading_color_light</color>
<color name="promo_illustration_bg_color">@color/promo_illustration_bg_color_dark</color> <color name="promo_illustration_bg_color">@color/promo_illustration_bg_color_dark</color>
<color name="preference_highlighted_bg_color">@color/preference_highlighted_bg_color_light</color>
</resources> </resources>
...@@ -111,4 +111,5 @@ ...@@ -111,4 +111,5 @@
<color name="omnibox_bg_color" tools:ignore="UnusedResources">@color/omnibox_bg_color_light</color> <color name="omnibox_bg_color" tools:ignore="UnusedResources">@color/omnibox_bg_color_light</color>
<color name="image_loading_color" tools:ignore="UnusedResources">@color/image_loading_color_dark</color> <color name="image_loading_color" tools:ignore="UnusedResources">@color/image_loading_color_dark</color>
<color name="promo_illustration_bg_color" tools:ignore="UnusedResources">@color/promo_illustration_bg_color_light</color> <color name="promo_illustration_bg_color" tools:ignore="UnusedResources">@color/promo_illustration_bg_color_light</color>
<color name="preference_highlighted_bg_color">@color/preference_highlighted_bg_color_dark</color>
</resources> </resources>
...@@ -120,4 +120,8 @@ ...@@ -120,4 +120,8 @@
<color name="omnibox_bg_color_light">@color/modern_grey_100</color> <color name="omnibox_bg_color_light">@color/modern_grey_100</color>
<color name="omnibox_bg_color_dark">@color/modern_grey_800</color> <color name="omnibox_bg_color_dark">@color/modern_grey_800</color>
<color name="omnibox_bg_color_incognito" tools:ignore="UnusedResources">@color/black_alpha_38</color> <color name="omnibox_bg_color_incognito" tools:ignore="UnusedResources">@color/black_alpha_38</color>
<!-- Settings -->
<color name="preference_highlighted_bg_color_dark">@color/modern_blue_600_alpha_12</color>
<color name="preference_highlighted_bg_color_light">@color/white_alpha_24</color>
</resources> </resources>
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