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

Unified Diff: content/browser/download/download_item_impl.cc

Issue 2029903002: Add token field to ClientSafeBrowsingReportReqeust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak comments 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_item_impl.cc
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index 1689cfea5795512055a657bcda93c83c21f46d49..7d10537dc1bea7c17011eefda76f6a081762c0d5 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -106,6 +106,9 @@ const uint32_t DownloadItem::kInvalidId = 0;
// The maximum number of attempts we will make to resume automatically.
const int DownloadItemImpl::kMaxAutoResumeAttempts = 5;
+// The default token string for downloads with dangerous URLs.
+const char kDangerousDownloadUrlToken[] = "DANGEROUS_URL";
+
// Constructor for reading from the history service.
DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate,
const std::string& guid,
@@ -751,7 +754,8 @@ WebContents* DownloadItemImpl::GetWebContents() const {
return NULL;
}
-void DownloadItemImpl::OnContentCheckCompleted(DownloadDangerType danger_type) {
+void DownloadItemImpl::OnContentCheckCompleted(DownloadDangerType danger_type,
+ const std::string& token) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(AllDataSaved());
@@ -765,6 +769,7 @@ void DownloadItemImpl::OnContentCheckCompleted(DownloadDangerType danger_type) {
DVLOG(20) << __FUNCTION__ << " danger_type=" << danger_type
<< " download=" << DebugString(true);
SetDangerType(danger_type);
+ token_.assign(token);
UpdateObservers();
}
@@ -784,6 +789,10 @@ void DownloadItemImpl::SetDisplayName(const base::FilePath& name) {
display_name_ = name;
}
+std::string DownloadItemImpl::GetDownloadPingToken() const {
+ return token_;
+}
+
std::string DownloadItemImpl::DebugString(bool verbose) const {
std::string description =
base::StringPrintf("{ id = %d"
@@ -1278,6 +1287,8 @@ void DownloadItemImpl::OnDownloadTargetDetermined(
target_path_ = target_path;
target_disposition_ = disposition;
SetDangerType(danger_type);
+ if (danger_type == DOWNLOAD_DANGER_TYPE_DANGEROUS_URL)
+ token_.assign(kDangerousDownloadUrlToken);
// This was an interrupted download that was looking for a filename. Now that
// it has one, transition to interrupted.

Powered by Google App Engine
This is Rietveld 408576698