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

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

Issue 2528193002: Remove FileUtilProxy:DeleteFile(). (Closed)
Patch Set: fix build error Created 4 years 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 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/files/file_util_proxy.h"
13 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
14 #include "base/supports_user_data.h" 13 #include "base/supports_user_data.h"
15 #include "base/task_runner.h" 14 #include "base/task_runner.h"
16 #include "chrome/browser/safe_browsing/download_feedback.h" 15 #include "chrome/browser/safe_browsing/download_feedback.h"
17 #include "content/public/browser/download_danger_type.h" 16 #include "content/public/browser/download_danger_type.h"
18 #include "content/public/browser/download_item.h" 17 #include "content/public/browser/download_item.h"
19 18
20 namespace safe_browsing { 19 namespace safe_browsing {
21 20
22 namespace { 21 namespace {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const std::string& ping_response, 168 const std::string& ping_response,
170 const base::FilePath& path) { 169 const base::FilePath& path) {
171 if (service) { 170 if (service) {
172 bool is_path_empty = path.empty(); 171 bool is_path_empty = path.empty();
173 UMA_HISTOGRAM_BOOLEAN("SBDownloadFeedback.EmptyFilePathFailure", 172 UMA_HISTOGRAM_BOOLEAN("SBDownloadFeedback.EmptyFilePathFailure",
174 is_path_empty); 173 is_path_empty);
175 if (is_path_empty) 174 if (is_path_empty)
176 return; 175 return;
177 service->BeginFeedback(ping_request, ping_response, path); 176 service->BeginFeedback(ping_request, ping_response, path);
178 } else { 177 } else {
179 base::FileUtilProxy::DeleteFile(file_task_runner.get(), 178 file_task_runner->PostTask(
180 path, 179 FROM_HERE,
181 false, 180 base::Bind(base::IgnoreResult(&base::DeleteFile), path, false));
182 base::FileUtilProxy::StatusCallback());
183 } 181 }
184 } 182 }
185 183
186 void DownloadFeedbackService::StartPendingFeedback() { 184 void DownloadFeedbackService::StartPendingFeedback() {
187 DCHECK(!active_feedback_.empty()); 185 DCHECK(!active_feedback_.empty());
188 active_feedback_.front()->Start(base::Bind( 186 active_feedback_.front()->Start(base::Bind(
189 &DownloadFeedbackService::FeedbackComplete, base::Unretained(this))); 187 &DownloadFeedbackService::FeedbackComplete, base::Unretained(this)));
190 } 188 }
191 189
192 void DownloadFeedbackService::BeginFeedback(const std::string& ping_request, 190 void DownloadFeedbackService::BeginFeedback(const std::string& ping_request,
(...skipping 14 matching lines...) Expand all
207 void DownloadFeedbackService::FeedbackComplete() { 205 void DownloadFeedbackService::FeedbackComplete() {
208 DVLOG(1) << __func__; 206 DVLOG(1) << __func__;
209 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 207 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
210 DCHECK(!active_feedback_.empty()); 208 DCHECK(!active_feedback_.empty());
211 active_feedback_.pop(); 209 active_feedback_.pop();
212 if (!active_feedback_.empty()) 210 if (!active_feedback_.empty())
213 StartPendingFeedback(); 211 StartPendingFeedback();
214 } 212 }
215 213
216 } // namespace safe_browsing 214 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/download_feedback.cc ('k') | chrome/browser/ui/libgtkui/print_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698