| 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..0b6e1d740e63b071522074eba33334afedbff202 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,35 @@ 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 &&
|
| + !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 {
|
| + DCHECK(false)
|
| + << "Unable to serialize the uncommon download warning report.";
|
| + }
|
| + }
|
| +#endif
|
| download_item_->ValidateDangerousDownload();
|
| break;
|
| case LEARN_MORE_SCANNING: {
|
|
|