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

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

Issue 1943993006: Create test fixture for SafeBrowsingService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 7 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
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_danger_prompt_impl.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 050d591035ada262e89f03b2544727ea9f2496be..cb3f6ceefe63571ecde13d3f360119d88c59f225 100644
--- a/chrome/browser/ui/views/download/download_danger_prompt_views.cc
+++ b/chrome/browser/ui/views/download/download_danger_prompt_views.cc
@@ -330,11 +330,15 @@ void DownloadDangerPromptViews::RunDone(Action action) {
OnDone done = done_;
done_.Reset();
if (download_ != NULL) {
- const bool accept = action == DownloadDangerPrompt::ACCEPT;
- RecordDownloadDangerPrompt(accept, *download_);
- if (!download_->GetURL().is_empty() &&
- !download_->GetBrowserContext()->IsOffTheRecord()) {
- SendSafeBrowsingDownloadRecoveryReport(accept, *download_);
+ // If this download is no longer dangerous, or 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_);
+ }
}
download_->RemoveObserver(this);
download_ = NULL;
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_danger_prompt_impl.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698