Commit 6f6c394f authored by Daniel Rubery's avatar Daniel Rubery Committed by Commit Bot

Add reporting to SafeBrowsingNavigationThrottle

Reporting of interstitials shown was done in
SafeBrowsingBlockPage::ShowBlockingPage, but when committed interstitials
is enabled, this function is never called. So this CL adds a call to
report interstitials shown by the SafeBrowsingNavigationThrottle, which
will trigger when committed interstitials is enabled.

Bug: 1046525
Change-Id: I06e94f7ecd145352e3be55b3170931479604adf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2025930Reviewed-by: default avatarCarlos IL <carlosil@chromium.org>
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736171}
parent 5943a77e
......@@ -5,6 +5,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_navigation_throttle.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/interstitials/enterprise_util.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/ui_manager.h"
......@@ -38,6 +39,10 @@ SafeBrowsingNavigationThrottle::WillFailRequest() {
SafeBrowsingBlockingPage::CreateBlockingPage(
manager.get(), handle->GetWebContents(), handle->GetURL(), resource,
true);
MaybeTriggerSecurityInterstitialShownEvent(
handle->GetWebContents(), handle->GetURL(),
GetThreatTypeStringForInterstitial(resource.threat_type),
/*net_error_code=*/0);
std::string error_page_content = blocking_page->GetHTMLContents();
security_interstitials::SecurityInterstitialTabHelper::
AssociateBlockingPage(handle->GetWebContents(),
......
......@@ -225,6 +225,13 @@ BaseBlockingPage* SafeBrowsingUIManager::CreateBlockingPageForSubresource(
SafeBrowsingBlockingPage::CreateBlockingPage(
this, contents, blocked_url, unsafe_resource,
/*should_trigger_reporting=*/false);
// Report that we showed an interstitial.
MaybeTriggerSecurityInterstitialShownEvent(
contents, blocked_url,
GetThreatTypeStringForInterstitial(unsafe_resource.threat_type),
/*net_error_code=*/0);
return blocking_page;
}
......
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