| Index: chrome/browser/download/download_danger_prompt.cc
|
| diff --git a/chrome/browser/download/download_danger_prompt.cc b/chrome/browser/download/download_danger_prompt.cc
|
| index 4ec23bcc5304612a9b40624391a2df7e68b20c76..13d623b064bfdcc10fd524f0adcd9ecfad9ad38a 100644
|
| --- a/chrome/browser/download/download_danger_prompt.cc
|
| +++ b/chrome/browser/download/download_danger_prompt.cc
|
| @@ -9,6 +9,7 @@
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/download/chrome_download_manager_delegate.h"
|
| #include "chrome/browser/download/download_stats.h"
|
| +#include "chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h"
|
| #include "chrome/browser/ui/tab_modal_confirm_dialog.h"
|
| #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
|
| #include "content/public/browser/download_danger_type.h"
|
| @@ -17,6 +18,8 @@
|
| #include "grit/generated_resources.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
|
|
| +using extensions::ExperienceSamplingEvent;
|
| +
|
| namespace {
|
|
|
| // TODO(wittman): Create a native web contents modal dialog implementation of
|
| @@ -56,6 +59,8 @@ class DownloadDangerPromptImpl : public DownloadDangerPrompt,
|
| bool show_context_;
|
| OnDone done_;
|
|
|
| + scoped_ptr<ExperienceSamplingEvent> sampling_event_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DownloadDangerPromptImpl);
|
| };
|
|
|
| @@ -71,6 +76,14 @@ DownloadDangerPromptImpl::DownloadDangerPromptImpl(
|
| DCHECK(!done_.is_null());
|
| download_->AddObserver(this);
|
| RecordOpenedDangerousConfirmDialog(download_->GetDangerType());
|
| +
|
| + // ExperienceSampling: A malicious download warning is being shown to the
|
| + // user, so we start a new SamplingEvent and track it.
|
| + sampling_event_.reset(new ExperienceSamplingEvent(
|
| + ExperienceSamplingEvent::kDownloadDangerPrompt,
|
| + download->GetURL(),
|
| + download->GetReferrerUrl(),
|
| + download->GetBrowserContext()));
|
| }
|
|
|
| DownloadDangerPromptImpl::~DownloadDangerPromptImpl() {
|
| @@ -203,14 +216,20 @@ base::string16 DownloadDangerPromptImpl::GetCancelButtonTitle() {
|
| }
|
|
|
| void DownloadDangerPromptImpl::OnAccepted() {
|
| + // ExperienceSampling: User proceeded through the warning.
|
| + sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed);
|
| RunDone(ACCEPT);
|
| }
|
|
|
| void DownloadDangerPromptImpl::OnCanceled() {
|
| + // ExperienceSampling: User canceled the warning.
|
| + sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny);
|
| RunDone(CANCEL);
|
| }
|
|
|
| void DownloadDangerPromptImpl::OnClosed() {
|
| + // ExperienceSampling: User canceled the warning.
|
| + sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny);
|
| RunDone(DISMISS);
|
| }
|
|
|
|
|