| OLD | NEW |
| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util_proxy.h" | 10 #include "base/files/file_util_proxy.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // static | 170 // static |
| 171 void DownloadFeedbackService::BeginFeedbackOrDeleteFile( | 171 void DownloadFeedbackService::BeginFeedbackOrDeleteFile( |
| 172 const scoped_refptr<base::TaskRunner>& file_task_runner, | 172 const scoped_refptr<base::TaskRunner>& file_task_runner, |
| 173 const base::WeakPtr<DownloadFeedbackService>& service, | 173 const base::WeakPtr<DownloadFeedbackService>& service, |
| 174 const std::string& ping_request, | 174 const std::string& ping_request, |
| 175 const std::string& ping_response, | 175 const std::string& ping_response, |
| 176 const base::FilePath& path) { | 176 const base::FilePath& path) { |
| 177 if (service) { | 177 if (service) { |
| 178 service->BeginFeedback(ping_request, ping_response, path); | 178 service->BeginFeedback(ping_request, ping_response, path); |
| 179 } else { | 179 } else { |
| 180 base::FileUtilProxy::Delete(file_task_runner.get(), | 180 base::FileUtilProxy::DeleteFile(file_task_runner.get(), |
| 181 path, | 181 path, |
| 182 false, | 182 false, |
| 183 base::FileUtilProxy::StatusCallback()); | 183 base::FileUtilProxy::StatusCallback()); |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 | 186 |
| 187 void DownloadFeedbackService::StartPendingFeedback() { | 187 void DownloadFeedbackService::StartPendingFeedback() { |
| 188 DCHECK(!active_feedback_.empty()); | 188 DCHECK(!active_feedback_.empty()); |
| 189 active_feedback_.front()->Start(base::Bind( | 189 active_feedback_.front()->Start(base::Bind( |
| 190 &DownloadFeedbackService::FeedbackComplete, base::Unretained(this))); | 190 &DownloadFeedbackService::FeedbackComplete, base::Unretained(this))); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void DownloadFeedbackService::BeginFeedback( | 193 void DownloadFeedbackService::BeginFeedback( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 212 void DownloadFeedbackService::FeedbackComplete() { | 212 void DownloadFeedbackService::FeedbackComplete() { |
| 213 DVLOG(1) << __FUNCTION__; | 213 DVLOG(1) << __FUNCTION__; |
| 214 DCHECK(CalledOnValidThread()); | 214 DCHECK(CalledOnValidThread()); |
| 215 DCHECK(!active_feedback_.empty()); | 215 DCHECK(!active_feedback_.empty()); |
| 216 active_feedback_.erase(active_feedback_.begin()); | 216 active_feedback_.erase(active_feedback_.begin()); |
| 217 if (!active_feedback_.empty()) | 217 if (!active_feedback_.empty()) |
| 218 StartPendingFeedback(); | 218 StartPendingFeedback(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace safe_browsing | 221 } // namespace safe_browsing |
| OLD | NEW |