Commit 80016444 authored by Tim Volodine's avatar Tim Volodine Committed by Commit Bot

[WebLayer][AW] Add SafeBrowsing.BlockingPage.ResourceType UMA

Add UMA for logging the resource type that triggers the
Safe Browsing blocking page for WebLayer and Android WebView.

Currently this histogram is logged in chrome. It is useful
in order to be able to compare usage numbers across platforms
and to obtain overall Safe Browsing usage stats.

BUG=1136072

Change-Id: I3b09f631b51d242e0fe6ab9b2421b377e25806df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2456348
Commit-Queue: Tim Volodine <timvolodine@chromium.org>
Reviewed-by: default avatarXinghui Lu <xinghuilu@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814819}
parent cb4616fc
...@@ -93,6 +93,9 @@ AwSafeBrowsingBlockingPage* AwSafeBrowsingBlockingPage::CreateBlockingPage( ...@@ -93,6 +93,9 @@ AwSafeBrowsingBlockingPage* AwSafeBrowsingBlockingPage::CreateBlockingPage(
const GURL& main_frame_url, const GURL& main_frame_url,
const UnsafeResource& unsafe_resource, const UnsafeResource& unsafe_resource,
std::unique_ptr<AwWebResourceRequest> resource_request) { std::unique_ptr<AwWebResourceRequest> resource_request) {
// Log the resource type that triggers the safe browsing blocking page.
UMA_HISTOGRAM_ENUMERATION("SafeBrowsing.BlockingPage.ResourceType",
unsafe_resource.resource_type);
const UnsafeResourceList unsafe_resources{unsafe_resource}; const UnsafeResourceList unsafe_resources{unsafe_resource};
AwBrowserContext* browser_context = AwBrowserContext* browser_context =
AwBrowserContext::FromWebContents(web_contents); AwBrowserContext::FromWebContents(web_contents);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "weblayer/browser/safe_browsing/safe_browsing_blocking_page.h" #include "weblayer/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "base/metrics/histogram_macros.h"
#include "components/security_interstitials/content/security_interstitial_controller_client.h" #include "components/security_interstitials/content/security_interstitial_controller_client.h"
#include "components/security_interstitials/content/settings_page_helper.h" #include "components/security_interstitials/content/settings_page_helper.h"
#include "components/security_interstitials/content/unsafe_resource_util.h" #include "components/security_interstitials/content/unsafe_resource_util.h"
...@@ -35,11 +36,15 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( ...@@ -35,11 +36,15 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage(
std::move(controller_client), std::move(controller_client),
display_options) {} display_options) {}
// static
SafeBrowsingBlockingPage* SafeBrowsingBlockingPage::CreateBlockingPage( SafeBrowsingBlockingPage* SafeBrowsingBlockingPage::CreateBlockingPage(
SafeBrowsingUIManager* ui_manager, SafeBrowsingUIManager* ui_manager,
content::WebContents* web_contents, content::WebContents* web_contents,
const GURL& main_frame_url, const GURL& main_frame_url,
const UnsafeResource& unsafe_resource) { const UnsafeResource& unsafe_resource) {
// Log the resource type that triggers the safe browsing blocking page.
UMA_HISTOGRAM_ENUMERATION("SafeBrowsing.BlockingPage.ResourceType",
unsafe_resource.resource_type);
const UnsafeResourceList unsafe_resources{unsafe_resource}; const UnsafeResourceList unsafe_resources{unsafe_resource};
content::NavigationEntry* entry = content::NavigationEntry* entry =
security_interstitials::GetNavigationEntryForResource(unsafe_resource); security_interstitials::GetNavigationEntryForResource(unsafe_resource);
......
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