Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc

Issue 2889193003: [subresource_filter] Reland: Remove Forwarding NavigationThrottles (Closed)
Patch Set: Fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc
index 27c14506f56212c2ecb68add9a27b1a498cd77c5..4b9b3471e0bf1579f614dabc9c1a6dac9d5c4ddb 100644
--- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc
+++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc
@@ -82,11 +82,8 @@ SubresourceFilterSafeBrowsingActivationThrottle::WillRedirectRequest() {
content::NavigationThrottle::ThrottleCheckResult
SubresourceFilterSafeBrowsingActivationThrottle::WillProcessResponse() {
- if (!database_client_)
- return content::NavigationThrottle::PROCEED;
-
// No need to defer the navigation if the check already happened.
- if (check_results_.back().finished) {
+ if (!database_client_ || check_results_.back().finished) {
NotifyResult();
return content::NavigationThrottle::ThrottleCheckResult::PROCEED;
}
@@ -132,14 +129,20 @@ void SubresourceFilterSafeBrowsingActivationThrottle::NotifyResult() {
using subresource_filter::ContentSubresourceFilterDriverFactory;
- const SubresourceFilterSafeBrowsingClient::CheckResult& result =
- check_results_.back();
ContentSubresourceFilterDriverFactory* driver_factory =
ContentSubresourceFilterDriverFactory::FromWebContents(web_contents);
DCHECK(driver_factory);
- driver_factory->OnMainResourceMatchedSafeBrowsingBlacklist(
- navigation_handle()->GetURL(), result.threat_type, result.pattern_type);
+ auto threat_type = safe_browsing::SBThreatType::SB_THREAT_TYPE_SAFE;
+ auto pattern_type = safe_browsing::ThreatPatternType::NONE;
+ if (database_client_) {
+ DCHECK(!check_results_.empty());
+ DCHECK(check_results_.back().finished);
+ threat_type = check_results_.back().threat_type;
+ pattern_type = check_results_.back().pattern_type;
+ }
+ driver_factory->OnSafeBrowsingMatchComputed(navigation_handle(), threat_type,
+ pattern_type);
base::TimeDelta delay = defer_time_.is_null()
? base::TimeDelta::FromMilliseconds(0)
@@ -150,7 +153,7 @@ void SubresourceFilterSafeBrowsingActivationThrottle::NotifyResult() {
// speculatively checks URLs on WillStartRequest. This is only different from
// the actual delay if there was at least one redirect.
base::TimeDelta no_redirect_speculation_delay =
- check_results_.size() > 1 ? result.check_time : delay;
+ check_results_.size() > 1 ? check_results_.back().check_time : delay;
UMA_HISTOGRAM_TIMES(
"SubresourceFilter.PageLoad.SafeBrowsingDelay.NoRedirectSpeculation",
no_redirect_speculation_delay);

Powered by Google App Engine
This is Rietveld 408576698