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

Unified Diff: chrome/browser/safe_browsing/download_protection_service.cc

Issue 2847353002: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: fix Created 3 years, 8 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: chrome/browser/safe_browsing/download_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index 49091285d618f6ad6d70634018da12df3d4a7c70..f3ae51da85dc28c9b3590e82c0c1f6ccdefc604e 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -14,6 +14,7 @@
#include "base/compiler_specific.h"
#include "base/format_macros.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
@@ -300,10 +301,10 @@ class DownloadUrlSBClient
if (!item_)
return;
- item_->SetUserData(kDownloadReferrerChainDataKey,
- new ReferrerChainData(
- service_->IdentifyReferrerChain(
- item_->GetURL(), item_->GetWebContents())));
+ item_->SetUserData(
+ kDownloadReferrerChainDataKey,
+ base::MakeUnique<ReferrerChainData>(service_->IdentifyReferrerChain(
+ item_->GetURL(), item_->GetWebContents())));
}
void UpdateDownloadCheckStats(SBStatsType stat_type) {
@@ -1842,8 +1843,10 @@ void DownloadProtectionService::ShowDetailsForDownload(
void DownloadProtectionService::SetDownloadPingToken(
content::DownloadItem* item, const std::string& token) {
- if (item)
- item->SetUserData(kDownloadPingTokenKey, new DownloadPingToken(token));
+ if (item) {
+ item->SetUserData(kDownloadPingTokenKey,
+ base::MakeUnique<DownloadPingToken>(token));
+ }
}
std::string DownloadProtectionService::GetDownloadPingToken(

Powered by Google App Engine
This is Rietveld 408576698