Chromium Code Reviews| Index: chrome/browser/download/download_commands.cc |
| diff --git a/chrome/browser/download/download_commands.cc b/chrome/browser/download/download_commands.cc |
| index 285ee4f0939f952edfd40cdcfac815c6d09aa92c..6e49f552105a813f4ee4362332589342411a1dd6 100644 |
| --- a/chrome/browser/download/download_commands.cc |
| +++ b/chrome/browser/download/download_commands.cc |
| @@ -23,6 +23,7 @@ |
| #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| +#include "chrome/common/safe_browsing/csd.pb.h" |
| #include "chrome/common/url_constants.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "components/google/core/browser/google_util.h" |
| @@ -278,6 +279,34 @@ void DownloadCommands::ExecuteCommand(Command command) { |
| download_item_->Remove(); |
| break; |
| case KEEP: |
| + // Only sends uncommon download accept report if : |
| + // 1. FULL_SAFE_BROWSING is enabled, and |
| + // 2. Download verdict is uncommon, and |
| + // 3. Download URL is not empty, and |
| + // 4. User is not in incognito mode. |
| +#if defined(FULL_SAFE_BROWSING) |
| + if (download_item_->GetDangerType() == |
| + content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT && |
|
Nathan Parker
2016/03/17 17:33:12
Remind me why this is just for uncommon downloads,
Nathan Parker
2016/03/17 17:34:39
Nevermind, just figured it out (only uncommon has
Jialiu Lin
2016/03/17 20:14:44
Yes, only uncommon has keep button.
|
| + !download_item_->GetURL().is_empty() && |
| + !download_item_->GetBrowserContext()->IsOffTheRecord()) { |
| + safe_browsing::SafeBrowsingService* sb_service = |
| + g_browser_process->safe_browsing_service(); |
| + // Compiles the uncommon download warning report. |
| + safe_browsing::ClientSafeBrowsingReportRequest report; |
| + report.set_type(safe_browsing::ClientSafeBrowsingReportRequest:: |
| + DANGEROUS_DOWNLOAD_WARNING); |
| + report.set_download_verdict( |
| + safe_browsing::ClientDownloadResponse::UNCOMMON); |
| + report.set_url(download_item_->GetURL().spec()); |
| + report.set_did_proceed(true); |
| + std::string serialized_report; |
| + if (report.SerializeToString(&serialized_report)) |
| + sb_service->SendSerializedDownloadReport(serialized_report); |
| + else |
| + DLOG(ERROR) |
|
Nathan Parker
2016/03/17 17:33:12
nit: if/else code > 1 line should have {}'s
You c
Jialiu Lin
2016/03/17 20:14:44
Done
|
| + << "Unable to serialize the uncommon download warning report."; |
| + } |
| +#endif |
| download_item_->ValidateDangerousDownload(); |
| break; |
| case LEARN_MORE_SCANNING: { |