| 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 17 matching lines...) Expand all Loading... |
| 28 const int kMaxTimeBlockingFileThreadMs = 1000; | 28 const int kMaxTimeBlockingFileThreadMs = 1000; |
| 29 | 29 |
| 30 DownloadFileImpl::DownloadFileImpl( | 30 DownloadFileImpl::DownloadFileImpl( |
| 31 const DownloadCreateInfo* info, | 31 const DownloadCreateInfo* info, |
| 32 scoped_ptr<content::ByteStreamReader> stream, | 32 scoped_ptr<content::ByteStreamReader> stream, |
| 33 DownloadRequestHandleInterface* request_handle, | 33 DownloadRequestHandleInterface* request_handle, |
| 34 scoped_refptr<DownloadManager> download_manager, | 34 scoped_refptr<DownloadManager> download_manager, |
| 35 bool calculate_hash, | 35 bool calculate_hash, |
| 36 scoped_ptr<content::PowerSaveBlocker> power_save_blocker, | 36 scoped_ptr<content::PowerSaveBlocker> power_save_blocker, |
| 37 const net::BoundNetLog& bound_net_log) | 37 const net::BoundNetLog& bound_net_log) |
| 38 : file_(info->save_info.file_path, | 38 : file_(info->default_download_directory, |
| 39 info->save_info.file_path, |
| 39 info->url(), | 40 info->url(), |
| 40 info->referrer_url, | 41 info->referrer_url, |
| 41 info->received_bytes, | 42 info->received_bytes, |
| 42 calculate_hash, | 43 calculate_hash, |
| 43 info->save_info.hash_state, | 44 info->save_info.hash_state, |
| 44 info->save_info.file_stream, | 45 info->save_info.file_stream, |
| 45 bound_net_log), | 46 bound_net_log), |
| 46 stream_reader_(stream.Pass()), | 47 stream_reader_(stream.Pass()), |
| 47 id_(info->download_id), | 48 id_(info->download_id), |
| 48 request_handle_(request_handle), | 49 request_handle_(request_handle), |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 295 } |
| 295 } | 296 } |
| 296 | 297 |
| 297 void DownloadFileImpl::SendUpdate() { | 298 void DownloadFileImpl::SendUpdate() { |
| 298 BrowserThread::PostTask( | 299 BrowserThread::PostTask( |
| 299 BrowserThread::UI, FROM_HERE, | 300 BrowserThread::UI, FROM_HERE, |
| 300 base::Bind(&DownloadManager::UpdateDownload, | 301 base::Bind(&DownloadManager::UpdateDownload, |
| 301 download_manager_, id_.local(), | 302 download_manager_, id_.local(), |
| 302 BytesSoFar(), CurrentSpeed(), GetHashState())); | 303 BytesSoFar(), CurrentSpeed(), GetHashState())); |
| 303 } | 304 } |
| OLD | NEW |