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

Unified Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 402293002: Experience sampling instrumentation for dangerous downloads warnings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sampling-api
Patch Set: rebase-update 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
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/download/download_item_view.cc
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index d1f91a1e62d79c50c789a8be8cc63a18a74b932b..0d8d6578becbba8b91f9ed82e001a05cb2b02d4a 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_stats.h"
#include "chrome/browser/download/drag_download_item.h"
+#include "chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/download_feedback_service.h"
#include "chrome/browser/safe_browsing/download_protection_service.h"
@@ -54,6 +55,7 @@
#include "ui/views/widget/widget.h"
using content::DownloadItem;
+using extensions::SamplingEvent;
// TODO(paulg): These may need to be adjusted when download progress
// animation is added, and also possibly to take into account
@@ -230,6 +232,11 @@ DownloadItemView::DownloadItemView(DownloadItem* download_item,
DownloadItemView::~DownloadItemView() {
StopDownloadProgress();
download()->RemoveObserver(this);
+
+ // Experience Sampling: If view was removed and was dangerous, then the user
+ // dismissed the download.
+ if (mode_ == DANGEROUS_MODE || mode_ == MALICIOUS_MODE)
+ sampling_event_->CreateUserDecisionEvent("deny");
felt 2014/07/25 17:36:49 Can you update the comment to say something like:
Chris Thompson 2014/08/11 19:35:15 Done.
}
// Progress animation handlers.
@@ -1127,6 +1134,9 @@ void DownloadItemView::ClearWarningDialog() {
body_state_ = NORMAL;
drop_down_state_ = NORMAL;
+ // ExperienceSampling: User proceeded through the warning.
+ sampling_event_->CreateUserDecisionEvent("proceed");
felt 2014/07/25 21:23:21 P.S. remember that you defined constants for "proc
Chris Thompson 2014/08/11 19:35:15 Done.
+
// Remove the views used by the warning dialog.
if (save_button_) {
RemoveChildView(save_button_);
@@ -1170,6 +1180,17 @@ void DownloadItemView::ShowWarningDialog() {
#endif
mode_ = model_.MightBeMalicious() ? MALICIOUS_MODE : DANGEROUS_MODE;
+ // ExperienceSampling: Dangerous or malicious download warning is being shown
+ // to the user, so we start a new SamplingEvent and track it.
+ std::string event_name = model_.MightBeMalicious() ?
+ "download_warning_malicious"
+ : "download_warning_dangerous";
+ sampling_event_.reset(new SamplingEvent(
+ event_name,
+ download()->GetURL(),
+ download()->GetReferrerUrl(),
+ download()->GetBrowserContext()));
+
body_state_ = NORMAL;
drop_down_state_ = NORMAL;
if (mode_ == DANGEROUS_MODE) {
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698