Commit c94520a9 authored by Andy Paicu's avatar Andy Paicu Committed by Commit Bot

Reversed crowd deny preload list logic

The crowd deny preload list now contains sites with a site reputation
of UNSOLICITED_PROMPTS. If a site is not on the preload list the normal
UI is used, otherwise a safe browsing ping is made to ensure that the
preload list is accurate.

Unit tests and test-fixes in a follow-up CL: For the purposes of speed
I have removed the failing test, will be re-added in the follow-up CL
along with new tests to account for this logic change.

Bug: 1042611
Change-Id: I35e14d9b7cd8de5191291cd113a0e50a78e91f47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003849
Commit-Queue: Andy Paicu <andypaicu@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732363}
parent ef159383
...@@ -136,11 +136,12 @@ void ContextualNotificationPermissionUiSelector::EvaluateCrowdDenyTrigger( ...@@ -136,11 +136,12 @@ void ContextualNotificationPermissionUiSelector::EvaluateCrowdDenyTrigger(
base::Optional<UiToUse> ui_to_use = GetUiToUseBasedOnSiteReputation( base::Optional<UiToUse> ui_to_use = GetUiToUseBasedOnSiteReputation(
CrowdDenyPreloadData::GetInstance()->GetReputationDataForSite(origin)); CrowdDenyPreloadData::GetInstance()->GetReputationDataForSite(origin));
if (ui_to_use) { if (!ui_to_use || *ui_to_use == UiToUse::kQuietUi) {
OnCrowdDenyTriggerEvaluated(*ui_to_use); OnCrowdDenyTriggerEvaluated(UiToUse::kNormalUi);
return; return;
} }
// PreloadData suggests a spammy site, ping safe browsing to verify.
DCHECK(!safe_browsing_request_); DCHECK(!safe_browsing_request_);
DCHECK(g_browser_process->safe_browsing_service()); DCHECK(g_browser_process->safe_browsing_service());
......
...@@ -969,7 +969,8 @@ TEST_F(PermissionRequestManagerTest, TestWebKioskModeDifferentOrigin) { ...@@ -969,7 +969,8 @@ TEST_F(PermissionRequestManagerTest, TestWebKioskModeDifferentOrigin) {
} }
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
TEST_F(PermissionRequestManagerTest, TestCrowdDenyHoldbackChance) { // TODO(andypaicu): re-enable ASAP. crbug.com/1042611
TEST_F(PermissionRequestManagerTest, DISABLED_TestCrowdDenyHoldbackChance) {
const struct { const struct {
std::string holdback_chance; std::string holdback_chance;
bool enabled_in_prefs; bool enabled_in_prefs;
......
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