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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc

Issue 399773002: Experience sampling insturmentation for SSL and Safe Browsing interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sampling-api
Patch Set: Add blocking/nonblocking and NetError type string to event name Created 6 years, 5 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: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
index 81c3f2a116fdd9cee692ebffd320a0c4f6fadf70..bb55aefde13ddd2e7925982ba38e6e744b3bc202 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -22,6 +22,7 @@
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_preferences_util.h"
@@ -53,6 +54,7 @@ using content::InterstitialPage;
using content::OpenURLParams;
using content::Referrer;
using content::WebContents;
+using extensions::SamplingEvent;
namespace {
@@ -310,6 +312,24 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage(
ui_manager_, web_contents, unsafe_resources[0]);
}
+ // ExperienceSampling: Set up new sampling event for this interstitial.
+ // This needs to handle all types of warnings this insterstitial can show.
+ std::string event_name;
+ if (interstitial_type_ == TYPE_MALWARE_AND_PHISHING)
+ event_name = "malware_and_phishing_interstitial";
felt 2014/07/18 21:13:59 use a switch statement for this, and also put stri
Chris Thompson 2014/07/23 22:45:38 Done.
+ else if (interstitial_type_ == TYPE_MALWARE)
+ event_name = "malware_interstitial";
+ else if (interstitial_type_ == TYPE_PHISHING)
+ event_name = "phishing_interstitial";
+ else
+ event_name = "other_safe_browsing_interstitial";
+
+ sampling_event_ = make_scoped_ptr(new SamplingEvent(
+ event_name,
+ url_.possibly_invalid_spec(),
+ web_contents_->GetLastCommittedURL().possibly_invalid_spec(),
+ web_contents_->GetBrowserContext()));
+
interstitial_page_ = InterstitialPage::Create(
web_contents, IsMainPageLoadBlocked(unsafe_resources), url_, this);
}
@@ -549,6 +569,9 @@ void SafeBrowsingBlockingPage::OnProceed() {
unsafe_resource_map->erase(iter);
}
+ // ExperienceSampling: Notify that user decided to proceed.
+ sampling_event_->CreateUserDecisionEvent("proceed");
+
// Now that this interstitial is gone, we can show the new one.
if (blocking_page)
blocking_page->interstitial_page_->Show();
@@ -592,6 +615,10 @@ void SafeBrowsingBlockingPage::OnDontProceed() {
navigation_entry_index_to_remove_));
navigation_entry_index_to_remove_ = -1;
}
+
+ // ExperienceSampling: Notify that user decided to go back.
+ // This also occurs if the user navigates away or closes the tab.
+ sampling_event_->CreateUserDecisionEvent("deny");
}
void SafeBrowsingBlockingPage::OnGotHistoryCount(bool success,

Powered by Google App Engine
This is Rietveld 408576698