#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 "chrome/grit/chromium_strings.h"
+#include "chrome/grit/generated_resources.h"
#include "content/public/browser/download_danger_type.h"
#include "content/public/browser/download_item.h"
-#include "grit/chromium_strings.h"
-#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
bool show_context_;
OnDone done_;
+ scoped_ptr<ExperienceSamplingEvent> sampling_event_;
+
DISALLOW_COPY_AND_ASSIGN(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() {
}
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);
}