[SubresourceCleanup] Remove is_subresource in SBErrorDisplayOptions
After subresource warnings are disabled, is_subresource is always set to false. It is redundant. TriggerManager set this field to true at the moment, but it is never used by TriggerManager. Bug: 324108312 Change-Id: Ia731334f3124b5a66ec9ed4021fdde2b507c116c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5596109 Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com> Reviewed-by: Nate Fischer <ntfschr@chromium.org> Commit-Queue: Xinghui Lu <xinghuilu@chromium.org> Reviewed-by: Ali Juma <ajuma@chromium.org> Reviewed-by: Carlos IL <carlosil@chromium.org> Reviewed-by: thefrog <thefrog@chromium.org> Cr-Commit-Position: refs/heads/main@{#1310663}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
fc76aef00f
commit
e6e26324ef
android_webview
chrome/browser/safe_browsing
components
safe_browsing
content
security_interstitials
security_interstitials_strings.grdpsecurity_interstitials_strings_grdp
ios/chrome/browser/safe_browsing/model
@ -108,7 +108,6 @@ AwSafeBrowsingBlockingPage* AwSafeBrowsingBlockingPage::CreateBlockingPage(
|
||||
BaseSafeBrowsingErrorUI::SBErrorDisplayOptions display_options =
|
||||
BaseSafeBrowsingErrorUI::SBErrorDisplayOptions(
|
||||
IsMainPageLoadPending(unsafe_resources),
|
||||
IsSubresource(unsafe_resources),
|
||||
safe_browsing::IsExtendedReportingOptInAllowed(*pref_service),
|
||||
browser_context->IsOffTheRecord(),
|
||||
safe_browsing::IsExtendedReportingEnabled(*pref_service),
|
||||
|
@ -17,11 +17,9 @@ IDS_SAFEBROWSING_OVERRIDABLE_SAFETY_BUTTON
|
||||
IDS_SAFEBROWSING_HEADING
|
||||
IDS_MALWARE_V3_PRIMARY_PARAGRAPH
|
||||
IDS_MALWARE_V3_EXPLANATION_PARAGRAPH
|
||||
IDS_MALWARE_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE
|
||||
IDS_MALWARE_V3_PROCEED_PARAGRAPH
|
||||
IDS_HARMFUL_V3_PRIMARY_PARAGRAPH
|
||||
IDS_HARMFUL_V3_EXPLANATION_PARAGRAPH
|
||||
IDS_HARMFUL_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE
|
||||
IDS_HARMFUL_V3_PROCEED_PARAGRAPH
|
||||
IDS_BILLING_TITLE
|
||||
IDS_BILLING_HEADING
|
||||
|
@ -56,7 +56,6 @@ ChromeSafeBrowsingBlockingPageFactory::CreateSafeBrowsingPage(
|
||||
|
||||
security_interstitials::BaseSafeBrowsingErrorUI::SBErrorDisplayOptions
|
||||
display_options(BaseBlockingPage::IsMainPageLoadPending(unsafe_resources),
|
||||
BaseBlockingPage::IsSubresource(unsafe_resources),
|
||||
is_extended_reporting_opt_in_allowed,
|
||||
web_contents->GetBrowserContext()->IsOffTheRecord(),
|
||||
IsExtendedReportingEnabled(*prefs),
|
||||
|
@ -555,7 +555,6 @@ class TestSafeBrowsingBlockingPageFactory
|
||||
|
||||
BaseSafeBrowsingErrorUI::SBErrorDisplayOptions display_options(
|
||||
BaseBlockingPage::IsMainPageLoadPending(unsafe_resources),
|
||||
BaseBlockingPage::IsSubresource(unsafe_resources),
|
||||
is_extended_reporting_opt_in_allowed,
|
||||
web_contents->GetBrowserContext()->IsOffTheRecord(),
|
||||
IsExtendedReportingEnabled(*prefs),
|
||||
|
@ -79,7 +79,7 @@ const security_interstitials::BaseSafeBrowsingErrorUI::SBErrorDisplayOptions
|
||||
BaseBlockingPage::CreateDefaultDisplayOptions(
|
||||
const UnsafeResourceList& unsafe_resources) {
|
||||
return BaseSafeBrowsingErrorUI::SBErrorDisplayOptions(
|
||||
IsMainPageLoadPending(unsafe_resources), IsSubresource(unsafe_resources),
|
||||
IsMainPageLoadPending(unsafe_resources),
|
||||
false, // kSafeBrowsingExtendedReportingOptInAllowed
|
||||
false, // is_off_the_record
|
||||
false, // is_extended_reporting
|
||||
@ -102,19 +102,6 @@ bool BaseBlockingPage::IsMainPageLoadPending(
|
||||
AsyncCheckTracker::IsMainPageLoadPending(unsafe_resources[0]);
|
||||
}
|
||||
|
||||
// static
|
||||
bool BaseBlockingPage::IsSubresource(
|
||||
const UnsafeResourceList& unsafe_resources) {
|
||||
// As long as there is one resource that is from subresource, the page is
|
||||
// considered unsafe due to a subresource.
|
||||
for (auto unsafe_resource : unsafe_resources) {
|
||||
if (unsafe_resource.is_subresource) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void BaseBlockingPage::SetThreatDetailsProceedDelayForTesting(int64_t delay) {
|
||||
threat_details_proceed_delay_ms_ = delay;
|
||||
}
|
||||
|
@ -46,10 +46,6 @@ class BaseBlockingPage
|
||||
// the main page.
|
||||
static bool IsMainPageLoadPending(const UnsafeResourceList& unsafe_resources);
|
||||
|
||||
// Returns true if one of the resources in |unsafe_resources| is from
|
||||
// subresource.
|
||||
static bool IsSubresource(const UnsafeResourceList& unsafe_resources);
|
||||
|
||||
// SecurityInterstitialPage method:
|
||||
void CommandReceived(const std::string& command) override;
|
||||
|
||||
|
@ -101,7 +101,6 @@ SBErrorOptions TriggerManager::GetSBErrorDisplayOptions(
|
||||
const PrefService& pref_service,
|
||||
content::WebContents* web_contents) {
|
||||
return SBErrorOptions(/*is_main_frame_load_pending=*/false,
|
||||
/*is_subresource=*/true,
|
||||
IsExtendedReportingOptInAllowed(pref_service),
|
||||
web_contents->GetBrowserContext()->IsOffTheRecord(),
|
||||
IsExtendedReportingEnabled(pref_service),
|
||||
|
@ -122,7 +122,6 @@ class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage {
|
||||
/*settings_helper=*/nullptr),
|
||||
BaseSafeBrowsingErrorUI::SBErrorDisplayOptions(
|
||||
BaseBlockingPage::IsMainPageLoadPending(unsafe_resources),
|
||||
BaseBlockingPage::IsSubresource(unsafe_resources),
|
||||
false, // is_extended_reporting_opt_in_allowed
|
||||
false, // is_off_the_record
|
||||
false, // is_extended_reporting_enabled
|
||||
|
@ -34,7 +34,6 @@ BaseSafeBrowsingErrorUI::~BaseSafeBrowsingErrorUI() {}
|
||||
|
||||
BaseSafeBrowsingErrorUI::SBErrorDisplayOptions::SBErrorDisplayOptions(
|
||||
bool is_main_frame_load_pending,
|
||||
bool is_subresource,
|
||||
bool is_extended_reporting_opt_in_allowed,
|
||||
bool is_off_the_record,
|
||||
bool is_extended_reporting_enabled,
|
||||
@ -47,7 +46,6 @@ BaseSafeBrowsingErrorUI::SBErrorDisplayOptions::SBErrorDisplayOptions(
|
||||
bool is_safe_browsing_managed,
|
||||
const std::string& help_center_article_link)
|
||||
: is_main_frame_load_pending(is_main_frame_load_pending),
|
||||
is_subresource(is_subresource),
|
||||
is_extended_reporting_opt_in_allowed(
|
||||
is_extended_reporting_opt_in_allowed),
|
||||
is_off_the_record(is_off_the_record),
|
||||
@ -66,7 +64,6 @@ BaseSafeBrowsingErrorUI::SBErrorDisplayOptions::SBErrorDisplayOptions(
|
||||
BaseSafeBrowsingErrorUI::SBErrorDisplayOptions::SBErrorDisplayOptions(
|
||||
const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& other)
|
||||
: is_main_frame_load_pending(other.is_main_frame_load_pending),
|
||||
is_subresource(other.is_subresource),
|
||||
is_extended_reporting_opt_in_allowed(
|
||||
other.is_extended_reporting_opt_in_allowed),
|
||||
is_off_the_record(other.is_off_the_record),
|
||||
|
@ -42,7 +42,6 @@ class BaseSafeBrowsingErrorUI {
|
||||
|
||||
struct SBErrorDisplayOptions {
|
||||
SBErrorDisplayOptions(bool is_main_frame_load_pending,
|
||||
bool is_subresource,
|
||||
bool is_extended_reporting_opt_in_allowed,
|
||||
bool is_off_the_record,
|
||||
bool is_extended_reporting_enabled,
|
||||
@ -61,9 +60,6 @@ class BaseSafeBrowsingErrorUI {
|
||||
// pending.
|
||||
bool is_main_frame_load_pending;
|
||||
|
||||
// Indicates if this SB interstitial is triggered by subresource.
|
||||
bool is_subresource;
|
||||
|
||||
// Indicates if user is allowed to opt-in extended reporting preference.
|
||||
bool is_extended_reporting_opt_in_allowed;
|
||||
|
||||
@ -122,8 +118,6 @@ class BaseSafeBrowsingErrorUI {
|
||||
return display_options_.is_main_frame_load_pending;
|
||||
}
|
||||
|
||||
bool is_subresource() const { return display_options_.is_subresource; }
|
||||
|
||||
bool is_extended_reporting_opt_in_allowed() const {
|
||||
return display_options_.is_extended_reporting_opt_in_allowed;
|
||||
}
|
||||
|
@ -263,11 +263,7 @@ void SafeBrowsingLoudErrorUI::PopulateMalwareLoadTimeData(
|
||||
IDS_MALWARE_V3_PRIMARY_PARAGRAPH));
|
||||
load_time_data.Set(
|
||||
"explanationParagraph",
|
||||
is_subresource()
|
||||
? l10n_util::GetStringFUTF16(
|
||||
IDS_MALWARE_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE,
|
||||
common_string_util::GetFormattedHostName(request_url()))
|
||||
: l10n_util::GetStringUTF16(IDS_MALWARE_V3_EXPLANATION_PARAGRAPH));
|
||||
l10n_util::GetStringUTF16(IDS_MALWARE_V3_EXPLANATION_PARAGRAPH));
|
||||
load_time_data.Set("finalParagraph", l10n_util::GetStringUTF16(
|
||||
IDS_MALWARE_V3_PROCEED_PARAGRAPH));
|
||||
}
|
||||
@ -281,11 +277,7 @@ void SafeBrowsingLoudErrorUI::PopulateHarmfulLoadTimeData(
|
||||
IDS_HARMFUL_V3_PRIMARY_PARAGRAPH));
|
||||
load_time_data.Set(
|
||||
"explanationParagraph",
|
||||
is_subresource()
|
||||
? l10n_util::GetStringFUTF16(
|
||||
IDS_HARMFUL_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE,
|
||||
common_string_util::GetFormattedHostName(request_url()))
|
||||
: l10n_util::GetStringUTF16(IDS_HARMFUL_V3_EXPLANATION_PARAGRAPH));
|
||||
l10n_util::GetStringUTF16(IDS_HARMFUL_V3_EXPLANATION_PARAGRAPH));
|
||||
load_time_data.Set("finalParagraph", l10n_util::GetStringUTF16(
|
||||
IDS_HARMFUL_V3_PROCEED_PARAGRAPH));
|
||||
}
|
||||
@ -300,11 +292,7 @@ void SafeBrowsingLoudErrorUI::PopulatePhishingLoadTimeData(
|
||||
l10n_util::GetStringUTF16(IDS_PHISHING_V4_PRIMARY_PARAGRAPH));
|
||||
load_time_data.Set(
|
||||
"explanationParagraph",
|
||||
is_subresource()
|
||||
? l10n_util::GetStringFUTF16(
|
||||
IDS_PHISHING_V4_EXPLANATION_PARAGRAPH_SUBRESOURCE,
|
||||
common_string_util::GetFormattedHostName(request_url()))
|
||||
: l10n_util::GetStringUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH));
|
||||
l10n_util::GetStringUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH));
|
||||
load_time_data.Set("finalParagraph", l10n_util::GetStringUTF16(
|
||||
IDS_PHISHING_V4_PROCEED_PARAGRAPH));
|
||||
}
|
||||
|
@ -257,9 +257,6 @@
|
||||
<message name="IDS_MALWARE_V3_EXPLANATION_PARAGRAPH" desc="The explanation of why Safe Browsing has blocked the page.">
|
||||
Chrome has built-in safety features to protect you while you browse — like Google Safe Browsing, which <ph name="BEGIN_LINK"><a href="#" id="diagnostic-link"></ph>recently found malware<ph name="END_LINK"></a></ph> on the site you're trying to visit.
|
||||
</message>
|
||||
<message name="IDS_MALWARE_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE" desc="The explanation of why Safe Browsing has blocked the page.">
|
||||
Chrome has built-in safety features to protect you while you browse, like Google Safe Browsing. Safe Browsing <ph name="BEGIN_LINK"><a href="#" id="diagnostic-link"></ph>recently found malware on <ph name="SITE">$1<ex>example.com</ex></ph><ph name="END_LINK"></a></ph>, which is embedded in the site you're trying to visit.
|
||||
</message>
|
||||
<message name="IDS_MALWARE_V3_PROCEED_PARAGRAPH" desc="The paragraph that lets the user skip the warning.">
|
||||
Even sites that are normally safe are sometimes compromised by attackers. Only visit <ph name="BEGIN_LINK"><a href="#" id="proceed-link"></ph>this unsafe site<ph name="END_LINK"></a></ph> if you're sure you understand the risks.
|
||||
</message>
|
||||
@ -279,10 +276,6 @@
|
||||
Chrome has built-in safety features to protect you while you browse — like Google Safe Browsing, which recently <ph name="BEGIN_LINK"><a href="#" id="diagnostic-link"></ph>found harmful software<ph name="END_LINK"></a></ph> on the site you're trying to visit.
|
||||
</message>
|
||||
|
||||
<message name="IDS_HARMFUL_V3_EXPLANATION_PARAGRAPH_SUBRESOURCE" desc="The explanation of why Safe Browsing has blocked the page.">
|
||||
Chrome has built-in safety features to protect you while you browse, like Google Safe Browsing. Safe Browsing recently <ph name="BEGIN_LINK"><a href="#" id="diagnostic-link"></ph>found harmful software on <ph name="SITE">$1<ex>example.com</ex></ph><ph name="END_LINK"></a></ph>, which is embedded in the site if you're trying to visit.
|
||||
</message>
|
||||
|
||||
<message name="IDS_HARMFUL_V3_PROCEED_PARAGRAPH" desc="The paragraph that lets the user skip the warning.">
|
||||
Even sites that are normally safe are sometimes compromised by attackers. Only visit <ph name="BEGIN_LINK"><a href="#" id="proceed-link"></ph>this unsafe site<ph name="END_LINK"></a></ph> if you're sure you understand the risks.
|
||||
</message>
|
||||
@ -294,9 +287,6 @@
|
||||
<message name="IDS_PHISHING_V4_EXPLANATION_PARAGRAPH" desc="The explanation of why Safe Browsing has blocked the page.">
|
||||
Chrome has built-in safety features to protect you while you browse — like Google Safe Browsing, which <ph name="BEGIN_LINK"><a href="#" id="diagnostic-link"></ph>recently found phishing<ph name="END_LINK"></a></ph> on the site you're trying to visit. Phishing sites pretend to be other sites to trick you.<ph name="NEW_LINE"><br/><br/></ph>Even sites that are normally safe are sometimes compromised by attackers. <ph name="BEGIN_ERROR_LINK"><a href="#" id="report-error-link"></ph>Let us know<ph name="END_ERROR_LINK"></a></ph> if you think there's been a mistake and that this site doesn't pose a danger.
|
||||
</message>
|
||||
<message name="IDS_PHISHING_V4_EXPLANATION_PARAGRAPH_SUBRESOURCE" desc="The explanation of why Safe Browsing has blocked the page.">
|
||||
Chrome has built-in safety features to protect you while you browse, like Google Safe Browsing. Safe Browsing recently <ph name="BEGIN_LINK"><a href="#" id="diagnostic-link"></ph>found phishing on <ph name="SITE">$1<ex>example.com</ex></ph><ph name="END_LINK"></a></ph>, which is embedded in the site you're trying to visit.<ph name="NEW_LINE"><br/><br/></ph>Even sites that are normally safe are sometimes compromised by attackers. <ph name="BEGIN_ERROR_LINK"><a href="#" id="report-error-link"></ph>Let us know<ph name="END_ERROR_LINK"></a></ph> if you think there's been a mistake and that this site doesn't pose a danger.
|
||||
</message>
|
||||
<message name="IDS_PHISHING_V4_PROCEED_PARAGRAPH" desc="The paragraph that lets the user skip the warning.">
|
||||
Only visit <ph name="BEGIN_LINK"><a href="#" id="proceed-link"></ph>this unsafe site<ph name="END_LINK"></a></ph> if you're sure you understand the risks.
|
||||
</message>
|
||||
|
@ -1 +0,0 @@
|
||||
0dbf9d2f49c2ce16042bdfc01affe7c1ae71b617
|
@ -1 +0,0 @@
|
||||
c065a00acbe95e6350a0111397a5a523bd484735
|
@ -1 +0,0 @@
|
||||
0e97e2f19f8d8f175558a9ff7680fd413171f6ca
|
@ -62,7 +62,7 @@ BaseSafeBrowsingErrorUI::SBErrorDisplayOptions GetDefaultDisplayOptions(
|
||||
SECURITY_SENSITIVE_SAFE_BROWSING_INTERSTITIAL);
|
||||
}
|
||||
return BaseSafeBrowsingErrorUI::SBErrorDisplayOptions(
|
||||
resource.IsMainPageLoadPendingWithSyncCheck(), resource.is_subresource,
|
||||
resource.IsMainPageLoadPendingWithSyncCheck(),
|
||||
/*is_extended_reporting_opt_in_allowed=*/false,
|
||||
/*is_off_the_record=*/false,
|
||||
/*is_extended_reporting=*/false,
|
||||
|
Reference in New Issue
Block a user