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

Side by Side Diff: chrome/browser/safe_browsing/download_feedback_service.cc

Issue 2847353002: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: fix Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/safe_browsing/download_feedback_service.h" 5 #include "chrome/browser/safe_browsing/download_feedback_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/memory/ptr_util.h"
12 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
13 #include "base/supports_user_data.h" 14 #include "base/supports_user_data.h"
14 #include "base/task_runner.h" 15 #include "base/task_runner.h"
15 #include "chrome/browser/safe_browsing/download_feedback.h" 16 #include "chrome/browser/safe_browsing/download_feedback.h"
16 #include "content/public/browser/download_danger_type.h" 17 #include "content/public/browser/download_danger_type.h"
17 #include "content/public/browser/download_item.h" 18 #include "content/public/browser/download_item.h"
18 19
19 namespace safe_browsing { 20 namespace safe_browsing {
20 21
21 namespace { 22 namespace {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const std::string& ping_response) 56 const std::string& ping_response)
56 : ping_request_(ping_request), 57 : ping_request_(ping_request),
57 ping_response_(ping_response) { 58 ping_response_(ping_response) {
58 } 59 }
59 60
60 // static 61 // static
61 void DownloadFeedbackPings::CreateForDownload( 62 void DownloadFeedbackPings::CreateForDownload(
62 content::DownloadItem* download, 63 content::DownloadItem* download,
63 const std::string& ping_request, 64 const std::string& ping_request,
64 const std::string& ping_response) { 65 const std::string& ping_response) {
65 DownloadFeedbackPings* pings = new DownloadFeedbackPings(ping_request, 66 download->SetUserData(kPingKey, base::MakeUnique<DownloadFeedbackPings>(
66 ping_response); 67 ping_request, ping_response));
67 download->SetUserData(kPingKey, pings);
68 } 68 }
69 69
70 // static 70 // static
71 DownloadFeedbackPings* DownloadFeedbackPings::FromDownload( 71 DownloadFeedbackPings* DownloadFeedbackPings::FromDownload(
72 const content::DownloadItem& download) { 72 const content::DownloadItem& download) {
73 return static_cast<DownloadFeedbackPings*>(download.GetUserData(kPingKey)); 73 return static_cast<DownloadFeedbackPings*>(download.GetUserData(kPingKey));
74 } 74 }
75 75
76 } // namespace 76 } // namespace
77 77
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 void DownloadFeedbackService::FeedbackComplete() { 205 void DownloadFeedbackService::FeedbackComplete() {
206 DVLOG(1) << __func__; 206 DVLOG(1) << __func__;
207 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 207 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
208 DCHECK(!active_feedback_.empty()); 208 DCHECK(!active_feedback_.empty());
209 active_feedback_.pop(); 209 active_feedback_.pop();
210 if (!active_feedback_.empty()) 210 if (!active_feedback_.empty())
211 StartPendingFeedback(); 211 StartPendingFeedback();
212 } 212 }
213 213
214 } // namespace safe_browsing 214 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698