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..7a962fee2114a216a1eaa24cac6780baf5a6e3ea 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::ExperienceSamplingEvent; |
// TODO(paulg): These may need to be adjusted when download progress |
// animation is added, and also possibly to take into account |
@@ -230,6 +232,12 @@ DownloadItemView::DownloadItemView(DownloadItem* download_item, |
DownloadItemView::~DownloadItemView() { |
StopDownloadProgress(); |
download()->RemoveObserver(this); |
+ |
+ // ExperienceSampling: If the user took no action to remove the warning |
+ // before it disappeared, then the user effectively dismissed the download |
+ // without keeping it. |
+ if (mode_ == DANGEROUS_MODE || mode_ == MALICIOUS_MODE) |
+ sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kIgnore); |
} |
// Progress animation handlers. |
@@ -1127,6 +1135,9 @@ void DownloadItemView::ClearWarningDialog() { |
body_state_ = NORMAL; |
drop_down_state_ = NORMAL; |
+ // ExperienceSampling: User proceeded through the warning. |
+ sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed); |
msw
2014/08/14 01:48:33
Can the user explicitly deny in Views like Cocoa's
Chris Thompson
2014/08/14 15:43:44
The dismiss button is handled in DownloadItemView:
Chris Thompson
2014/08/14 17:19:16
I've also reworked the instrumentation here a litt
msw
2014/08/14 17:56:44
Cool, the the latest patch set looks more complete
|
+ |
// Remove the views used by the warning dialog. |
if (save_button_) { |
RemoveChildView(save_button_); |
@@ -1170,6 +1181,18 @@ 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() |
+ ? ExperienceSamplingEvent::kEventNameMaliciousDownload |
+ : ExperienceSamplingEvent::kEventNameDangerousDownload; |
+ sampling_event_.reset( |
+ new ExperienceSamplingEvent(event_name, |
+ download()->GetURL(), |
+ download()->GetReferrerUrl(), |
+ download()->GetBrowserContext())); |
+ |
body_state_ = NORMAL; |
drop_down_state_ = NORMAL; |
if (mode_ == DANGEROUS_MODE) { |