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

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

Issue 402293002: Experience sampling instrumentation for dangerous downloads warnings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sampling-api
Patch Set: Add default actions for tests Created 6 years, 4 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/ui/views/download/download_danger_prompt_views.cc
diff --git a/chrome/browser/ui/views/download/download_danger_prompt_views.cc b/chrome/browser/ui/views/download/download_danger_prompt_views.cc
index 31f1441574edca0e5ad71a37db1fa8b104b03941..6008dc04b7c8220ce6a7aeba441b7d7115169ddc 100644
--- a/chrome/browser/ui/views/download/download_danger_prompt_views.cc
+++ b/chrome/browser/ui/views/download/download_danger_prompt_views.cc
@@ -5,6 +5,7 @@
#include "base/compiler_specific.h"
#include "chrome/browser/download/download_danger_prompt.h"
#include "chrome/browser/download/download_stats.h"
+#include "chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
@@ -21,6 +22,8 @@
#include "ui/views/window/dialog_client_view.h"
#include "ui/views/window/dialog_delegate.h"
+using extensions::ExperienceSamplingEvent;
+
namespace {
const int kMessageWidth = 320;
@@ -69,6 +72,8 @@ class DownloadDangerPromptViews : public DownloadDangerPrompt,
bool show_context_;
OnDone done_;
+ scoped_ptr<ExperienceSamplingEvent> sampling_event_;
+
views::View* contents_view_;
};
@@ -117,6 +122,14 @@ DownloadDangerPromptViews::DownloadDangerPromptViews(
layout->AddView(message_body_label);
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,
+ item->GetURL(),
+ item->GetReferrerUrl(),
+ item->GetBrowserContext()));
}
// DownloadDangerPrompt methods:
@@ -170,18 +183,24 @@ ui::ModalType DownloadDangerPromptViews::GetModalType() const {
bool DownloadDangerPromptViews::Cancel() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ // ExperienceSampling: User canceled the warning.
+ sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny);
RunDone(CANCEL);
return true;
}
bool DownloadDangerPromptViews::Accept() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ // ExperienceSampling: User proceeded through the warning.
+ sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed);
RunDone(ACCEPT);
return true;
}
bool DownloadDangerPromptViews::Close() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ // ExperienceSampling: User canceled the warning.
+ sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny);
RunDone(DISMISS);
return true;
}
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_item_controller.mm ('k') | chrome/browser/ui/views/download/download_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698