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

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

Issue 2029903002: Add token field to ClientSafeBrowsingReportReqeust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit in test Created 4 years, 6 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 cb3f6ceefe63571ecde13d3f360119d88c59f225..33cae7c39cda7917863cab969ec9b618cf878413 100644
--- a/chrome/browser/ui/views/download/download_danger_prompt_views.cc
+++ b/chrome/browser/ui/views/download/download_danger_prompt_views.cc
@@ -27,6 +27,7 @@
#include "url/gurl.h"
using extensions::ExperienceSamplingEvent;
+using safe_browsing::ClientSafeBrowsingReportRequest;
namespace {
@@ -71,6 +72,9 @@ class DownloadDangerPromptViews : public DownloadDangerPrompt,
void RunDone(Action action);
content::DownloadItem* download_;
+ // If show_context_ is true, this is a download confirmation dialog by
+ // download API, otherwise it is download recovery dialog from a regular
+ // download.
bool show_context_;
sky 2016/06/08 16:12:17 Would it make more sense to have this be ClientSaf
Jialiu Lin 2016/06/08 17:46:29 Hmm... probably not. Report type does depend on sh
OnDone done_;
@@ -330,14 +334,18 @@ void DownloadDangerPromptViews::RunDone(Action action) {
OnDone done = done_;
done_.Reset();
if (download_ != NULL) {
- // If this download is no longer dangerous, or is already canceled or
+ // If this download is no longer dangerous, is already canceled or
// completed, don't send any report.
if (download_->IsDangerous() && !download_->IsDone()) {
const bool accept = action == DownloadDangerPrompt::ACCEPT;
RecordDownloadDangerPrompt(accept, *download_);
if (!download_->GetURL().is_empty() &&
!download_->GetBrowserContext()->IsOffTheRecord()) {
- SendSafeBrowsingDownloadRecoveryReport(accept, *download_);
+ ClientSafeBrowsingReportRequest::ReportType report_type
+ = show_context_ ?
+ ClientSafeBrowsingReportRequest::DANGEROUS_DOWNLOAD_BY_API :
+ ClientSafeBrowsingReportRequest::DANGEROUS_DOWNLOAD_RECOVERY;
+ SendSafeBrowsingDownloadReport(report_type, accept, *download_);
}
}
download_->RemoveObserver(this);
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_danger_prompt_impl.cc ('k') | chrome/common/safe_browsing/csd.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698