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..255c7287feb2cbde9d990be2f34de9e4804dab85 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 uncommand download accept report if : |
|
asanka
2016/03/16 01:29:51
*uncommon
Jialiu Lin
2016/03/16 02:43:43
Done.
|
| +// 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. |
|
asanka
2016/03/16 01:29:50
Is the indentation due to clang-format?
Jialiu Lin
2016/03/16 02:43:43
hmm, git cl format did funny thing again. Let me c
|
| +#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 |
| + DLOG(ERROR) |
| + << "Unable to serialize the uncommon download warning report."; |
| + } |
| +#endif |
| download_item_->ValidateDangerousDownload(); |
| break; |
| case LEARN_MORE_SCANNING: { |