Commit 49f3d559 authored by abarth@chromium.org's avatar abarth@chromium.org

Add some histograms to see how often users click through blocking pages.

R=jar

Review URL: http://codereview.chromium.org/99020


git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15018 0039d316-1c4b-4281-b951-d872f2087c98
parent 558b6591
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "base/histogram.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/dom_operation_notification_details.h"
...@@ -49,6 +50,21 @@ static const char* const kLearnMoreCommand = "learnMore"; ...@@ -49,6 +50,21 @@ static const char* const kLearnMoreCommand = "learnMore";
static const char* const kProceedCommand = "proceed"; static const char* const kProceedCommand = "proceed";
static const char* const kTakeMeBackCommand = "takeMeBack"; static const char* const kTakeMeBackCommand = "takeMeBack";
namespace {
enum SafeBrowsingBlockingPageEvent {
SHOW,
PROCEED,
DONT_PROCEED,
};
void RecordSafeBrowsingBlockingPageStats(SafeBrowsingBlockingPageEvent event) {
static LinearHistogram histogram("interstial.safe_browsing", 0, 2, 3);
histogram.SetFlags(kUmaTargetedHistogramFlag);
histogram.Add(event);
}
} // namespace
// static // static
SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL;
...@@ -83,6 +99,7 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( ...@@ -83,6 +99,7 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage(
sb_service_(sb_service), sb_service_(sb_service),
is_main_frame_(IsMainPage(unsafe_resources)), is_main_frame_(IsMainPage(unsafe_resources)),
unsafe_resources_(unsafe_resources) { unsafe_resources_(unsafe_resources) {
RecordSafeBrowsingBlockingPageStats(SHOW);
if (!is_main_frame_) { if (!is_main_frame_) {
navigation_entry_index_to_remove_ = navigation_entry_index_to_remove_ =
tab()->controller().last_committed_entry_index(); tab()->controller().last_committed_entry_index();
...@@ -362,6 +379,8 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { ...@@ -362,6 +379,8 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) {
} }
void SafeBrowsingBlockingPage::Proceed() { void SafeBrowsingBlockingPage::Proceed() {
RecordSafeBrowsingBlockingPageStats(PROCEED);
NotifySafeBrowsingService(sb_service_, unsafe_resources_, true); NotifySafeBrowsingService(sb_service_, unsafe_resources_, true);
// Check to see if some new notifications of unsafe resources have been // Check to see if some new notifications of unsafe resources have been
...@@ -387,6 +406,8 @@ void SafeBrowsingBlockingPage::Proceed() { ...@@ -387,6 +406,8 @@ void SafeBrowsingBlockingPage::Proceed() {
} }
void SafeBrowsingBlockingPage::DontProceed() { void SafeBrowsingBlockingPage::DontProceed() {
RecordSafeBrowsingBlockingPageStats(DONT_PROCEED);
NotifySafeBrowsingService(sb_service_, unsafe_resources_, false); NotifySafeBrowsingService(sb_service_, unsafe_resources_, false);
// The user does not want to proceed, clear the queued unsafe resources // The user does not want to proceed, clear the queued unsafe resources
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ssl/ssl_blocking_page.h" #include "chrome/browser/ssl/ssl_blocking_page.h"
#include "base/histogram.h"
#include "base/string_piece.h" #include "base/string_piece.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/browser.h" #include "chrome/browser/browser.h"
...@@ -22,6 +23,22 @@ ...@@ -22,6 +23,22 @@
#include "grit/browser_resources.h" #include "grit/browser_resources.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
namespace {
enum SSLBlockingPageEvent {
SHOW,
PROCEED,
DONT_PROCEED,
};
void RecordSSLBlockingPageStats(SSLBlockingPageEvent event) {
static LinearHistogram histogram("interstial.ssl", 0, 2, 3);
histogram.SetFlags(kUmaTargetedHistogramFlag);
histogram.Add(event);
}
} // namespace
// Note that we always create a navigation entry with SSL errors. // Note that we always create a navigation entry with SSL errors.
// No error happening loading a sub-resource triggers an interstitial so far. // No error happening loading a sub-resource triggers an interstitial so far.
SSLBlockingPage::SSLBlockingPage(SSLManager::CertError* error, SSLBlockingPage::SSLBlockingPage(SSLManager::CertError* error,
...@@ -30,6 +47,7 @@ SSLBlockingPage::SSLBlockingPage(SSLManager::CertError* error, ...@@ -30,6 +47,7 @@ SSLBlockingPage::SSLBlockingPage(SSLManager::CertError* error,
error_(error), error_(error),
delegate_(delegate), delegate_(delegate),
delegate_has_been_notified_(false) { delegate_has_been_notified_(false) {
RecordSSLBlockingPageStats(SHOW);
} }
SSLBlockingPage::~SSLBlockingPage() { SSLBlockingPage::~SSLBlockingPage() {
...@@ -94,6 +112,8 @@ void SSLBlockingPage::CommandReceived(const std::string& command) { ...@@ -94,6 +112,8 @@ void SSLBlockingPage::CommandReceived(const std::string& command) {
} }
void SSLBlockingPage::Proceed() { void SSLBlockingPage::Proceed() {
RecordSSLBlockingPageStats(PROCEED);
// Accepting the certificate resumes the loading of the page. // Accepting the certificate resumes the loading of the page.
NotifyAllowCertificate(); NotifyAllowCertificate();
...@@ -102,11 +122,12 @@ void SSLBlockingPage::Proceed() { ...@@ -102,11 +122,12 @@ void SSLBlockingPage::Proceed() {
} }
void SSLBlockingPage::DontProceed() { void SSLBlockingPage::DontProceed() {
RecordSSLBlockingPageStats(DONT_PROCEED);
NotifyDenyCertificate(); NotifyDenyCertificate();
InterstitialPage::DontProceed(); InterstitialPage::DontProceed();
} }
void SSLBlockingPage::NotifyDenyCertificate() { void SSLBlockingPage::NotifyDenyCertificate() {
DCHECK(!delegate_has_been_notified_); DCHECK(!delegate_has_been_notified_);
......
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