| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/download_file_impl.h" | 5 #include "content/browser/download/download_file_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void DownloadFileImpl::Detach(base::Closure callback) { | 132 void DownloadFileImpl::Detach(base::Closure callback) { |
| 133 // Doing the annotation here leaves a small window during | 133 // Doing the annotation here leaves a small window during |
| 134 // which the file has the final name but hasn't been marked with the | 134 // which the file has the final name but hasn't been marked with the |
| 135 // Mark Of The Web. However, it allows anti-virus scanners on Windows | 135 // Mark Of The Web. However, it allows anti-virus scanners on Windows |
| 136 // to actually see the data (http://crbug.com/127999), and the Window | 136 // to actually see the data (http://crbug.com/127999), and the Window |
| 137 // is pretty small (round trip to the UI thread). | 137 // is pretty small (round trip to the UI thread). |
| 138 AnnotateWithSourceInformation(); | 138 AnnotateWithSourceInformation(); |
| 139 | 139 |
| 140 file_.Detach(); | 140 file_.Detach(); |
| 141 | 141 |
| 142 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); | 142 if (!callback.is_null()) |
| 143 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); |
| 143 } | 144 } |
| 144 | 145 |
| 145 void DownloadFileImpl::Cancel() { | 146 void DownloadFileImpl::Cancel() { |
| 146 file_.Cancel(); | 147 file_.Cancel(); |
| 147 } | 148 } |
| 148 | 149 |
| 149 void DownloadFileImpl::AnnotateWithSourceInformation() { | 150 void DownloadFileImpl::AnnotateWithSourceInformation() { |
| 150 bound_net_log_.BeginEvent(net::NetLog::TYPE_DOWNLOAD_FILE_ANNOTATED); | 151 bound_net_log_.BeginEvent(net::NetLog::TYPE_DOWNLOAD_FILE_ANNOTATED); |
| 151 file_.AnnotateWithSourceInformation(); | 152 file_.AnnotateWithSourceInformation(); |
| 152 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_FILE_ANNOTATED); | 153 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_FILE_ANNOTATED); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 308 } |
| 308 } | 309 } |
| 309 | 310 |
| 310 void DownloadFileImpl::SendUpdate() { | 311 void DownloadFileImpl::SendUpdate() { |
| 311 BrowserThread::PostTask( | 312 BrowserThread::PostTask( |
| 312 BrowserThread::UI, FROM_HERE, | 313 BrowserThread::UI, FROM_HERE, |
| 313 base::Bind(&DownloadManager::UpdateDownload, | 314 base::Bind(&DownloadManager::UpdateDownload, |
| 314 download_manager_, id_.local(), | 315 download_manager_, id_.local(), |
| 315 BytesSoFar(), CurrentSpeed(), GetHashState())); | 316 BytesSoFar(), CurrentSpeed(), GetHashState())); |
| 316 } | 317 } |
| OLD | NEW |