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

Unified Diff: chrome/browser/ssl/security_state_tab_helper.cc

Issue 2499243002: Record time to navigation/tab-closed after HTTP-bad warning (Closed)
Patch Set: elawrence comments Created 4 years, 1 month 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: chrome/browser/ssl/security_state_tab_helper.cc
diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc
index 1bfae3b473283f2fc53934bf266d8c1e152f6940..8263d741827549291672fec7554271bbbf6ae9e6 100644
--- a/chrome/browser/ssl/security_state_tab_helper.cc
+++ b/chrome/browser/ssl/security_state_tab_helper.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/metrics/histogram_macros.h"
+#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/policy/policy_cert_service.h"
@@ -55,6 +56,9 @@ void SecurityStateTabHelper::VisibleSecurityStateChanged() {
return;
}
+ DCHECK(time_of_http_warning_on_current_navigation_.is_null());
+ time_of_http_warning_on_current_navigation_ = base::Time::Now();
+
std::string warning;
bool warning_is_user_visible = false;
switch (security_info.security_level) {
@@ -92,6 +96,26 @@ void SecurityStateTabHelper::VisibleSecurityStateChanged() {
}
}
+void SecurityStateTabHelper::DidStartNavigation(
+ content::NavigationHandle* navigation_handle) {
+ if (time_of_http_warning_on_current_navigation_.is_null() ||
+ !navigation_handle->IsInMainFrame() || navigation_handle->IsSamePage()) {
+ return;
+ }
+ // Record how quickly a user leaves a site after encountering an
+ // HTTP-bad warning. A navigation here only counts if it is a
+ // main-frame, not-same-page navigation, since it aims to measure how
+ // quickly a user leaves a site after seeing the HTTP warning.
+ UMA_HISTOGRAM_LONG_TIMES(
+ "Security.HTTPBad.NavigationStartedAfterUserWarnedAboutSensitiveInput",
+ base::Time::Now() - time_of_http_warning_on_current_navigation_);
+ // After recording the histogram, clear the time of the warning. A
+ // timing histogram will not be recorded again on this page, because
+ // the time is only set the first time the HTTP-bad warning is shown
+ // per page.
+ time_of_http_warning_on_current_navigation_ = base::Time();
+}
+
void SecurityStateTabHelper::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
if (navigation_handle->IsInMainFrame() && !navigation_handle->IsSamePage()) {
@@ -101,6 +125,18 @@ void SecurityStateTabHelper::DidFinishNavigation(
}
}
+void SecurityStateTabHelper::WebContentsDestroyed() {
+ if (time_of_http_warning_on_current_navigation_.is_null()) {
+ return;
+ }
+ // Record how quickly the tab is closed after a user encounters an
+ // HTTP-bad warning. This histogram will only be recorded if the
+ // WebContents is destroyed before another navigation begins.
+ UMA_HISTOGRAM_LONG_TIMES(
+ "Security.HTTPBad.WebContentsDestroyedAfterUserWarnedAboutSensitiveInput",
+ base::Time::Now() - time_of_http_warning_on_current_navigation_);
+}
+
bool SecurityStateTabHelper::UsedPolicyInstalledCertificate() const {
#if defined(OS_CHROMEOS)
policy::PolicyCertService* service =
« no previous file with comments | « chrome/browser/ssl/security_state_tab_helper.h ('k') | chrome/browser/ssl/security_state_tab_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698