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.h" | 5 #include "chrome/browser/safe_browsing/download_feedback.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util_proxy.h" | 8 #include "base/files/file_util.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "base/task_runner.h" | 12 #include "base/task_runner.h" |
13 #include "chrome/common/safe_browsing/csd.pb.h" | 13 #include "chrome/common/safe_browsing/csd.pb.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 | 16 |
17 namespace safe_browsing { | 17 namespace safe_browsing { |
18 | 18 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 DownloadFeedbackImpl::~DownloadFeedbackImpl() { | 99 DownloadFeedbackImpl::~DownloadFeedbackImpl() { |
100 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 100 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
101 DVLOG(1) << "DownloadFeedback destructed " << this; | 101 DVLOG(1) << "DownloadFeedback destructed " << this; |
102 | 102 |
103 if (uploader_) { | 103 if (uploader_) { |
104 RecordUploadResult(UPLOAD_CANCELLED); | 104 RecordUploadResult(UPLOAD_CANCELLED); |
105 // Destroy the uploader before attempting to delete the file. | 105 // Destroy the uploader before attempting to delete the file. |
106 uploader_.reset(); | 106 uploader_.reset(); |
107 } | 107 } |
108 | 108 |
109 base::FileUtilProxy::DeleteFile(file_task_runner_.get(), | 109 file_task_runner_->PostTask( |
110 file_path_, | 110 FROM_HERE, |
111 false, | 111 base::Bind(base::IgnoreResult(&base::DeleteFile), file_path_, false)); |
112 base::FileUtilProxy::StatusCallback()); | |
113 } | 112 } |
114 | 113 |
115 void DownloadFeedbackImpl::Start(const base::Closure& finish_callback) { | 114 void DownloadFeedbackImpl::Start(const base::Closure& finish_callback) { |
116 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 115 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
117 DCHECK(!uploader_); | 116 DCHECK(!uploader_); |
118 | 117 |
119 ClientDownloadReport report_metadata; | 118 ClientDownloadReport report_metadata; |
120 | 119 |
121 bool r = report_metadata.mutable_download_request()->ParseFromString( | 120 bool r = report_metadata.mutable_download_request()->ParseFromString( |
122 ping_request_); | 121 ping_request_); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 new DownloadFeedbackImpl(request_context_getter, file_task_runner, | 211 new DownloadFeedbackImpl(request_context_getter, file_task_runner, |
213 file_path, ping_request, ping_response)); | 212 file_path, ping_request, ping_response)); |
214 } | 213 } |
215 return DownloadFeedback::factory_->CreateDownloadFeedback( | 214 return DownloadFeedback::factory_->CreateDownloadFeedback( |
216 request_context_getter, file_task_runner, file_path, ping_request, | 215 request_context_getter, file_task_runner, file_path, ping_request, |
217 ping_response); | 216 ping_response); |
218 } | 217 } |
219 | 218 |
220 } // namespace safe_browsing | 219 } // namespace safe_browsing |
221 | 220 |
OLD | NEW |