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

Side by Side Diff: chrome/browser/download/download_commands.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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/download/download_commands.h" 5 #include "chrome/browser/download/download_commands.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 safe_browsing::SafeBrowsingService* sb_service = 293 safe_browsing::SafeBrowsingService* sb_service =
294 g_browser_process->safe_browsing_service(); 294 g_browser_process->safe_browsing_service();
295 // Compiles the uncommon download warning report. 295 // Compiles the uncommon download warning report.
296 safe_browsing::ClientSafeBrowsingReportRequest report; 296 safe_browsing::ClientSafeBrowsingReportRequest report;
297 report.set_type(safe_browsing::ClientSafeBrowsingReportRequest:: 297 report.set_type(safe_browsing::ClientSafeBrowsingReportRequest::
298 DANGEROUS_DOWNLOAD_WARNING); 298 DANGEROUS_DOWNLOAD_WARNING);
299 report.set_download_verdict( 299 report.set_download_verdict(
300 safe_browsing::ClientDownloadResponse::UNCOMMON); 300 safe_browsing::ClientDownloadResponse::UNCOMMON);
301 report.set_url(download_item_->GetURL().spec()); 301 report.set_url(download_item_->GetURL().spec());
302 report.set_did_proceed(true); 302 report.set_did_proceed(true);
303 std::string token =
304 safe_browsing::DownloadProtectionService::GetDownloadPingToken(
305 download_item_);
306 if (!token.empty())
307 report.set_token(token);
303 std::string serialized_report; 308 std::string serialized_report;
304 if (report.SerializeToString(&serialized_report)) { 309 if (report.SerializeToString(&serialized_report)) {
305 sb_service->SendSerializedDownloadReport(serialized_report); 310 sb_service->SendSerializedDownloadReport(serialized_report);
306 } else { 311 } else {
307 DCHECK(false) 312 DCHECK(false)
308 << "Unable to serialize the uncommon download warning report."; 313 << "Unable to serialize the uncommon download warning report.";
309 } 314 }
310 } 315 }
311 #endif 316 #endif
312 download_item_->ValidateDangerousDownload(); 317 download_item_->ValidateDangerousDownload();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 &mime) || 397 &mime) ||
393 !mime_util::IsSupportedImageMimeType(mime)) { 398 !mime_util::IsSupportedImageMimeType(mime)) {
394 // It seems a non-image file. 399 // It seems a non-image file.
395 return; 400 return;
396 } 401 }
397 } 402 }
398 403
399 base::FilePath file_path = download_item_->GetFullPath(); 404 base::FilePath file_path = download_item_->GetFullPath();
400 ImageClipboardCopyManager::Start(file_path); 405 ImageClipboardCopyManager::Start(file_path);
401 } 406 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698