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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "content/browser/download/download_create_info.h" | 10 #include "content/browser/download/download_create_info.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/download_manager.h" | 12 #include "content/public/browser/download_manager.h" |
13 | 13 |
14 using content::BrowserThread; | 14 using content::BrowserThread; |
15 using content::DownloadId; | 15 using content::DownloadId; |
16 using content::DownloadManager; | 16 using content::DownloadManager; |
17 | 17 |
18 DownloadFileImpl::DownloadFileImpl( | 18 DownloadFileImpl::DownloadFileImpl( |
19 const DownloadCreateInfo* info, | 19 const DownloadCreateInfo* info, |
20 DownloadRequestHandleInterface* request_handle, | 20 DownloadRequestHandleInterface* request_handle, |
21 DownloadManager* download_manager, | 21 DownloadManager* download_manager, |
22 bool calculate_hash) | 22 bool calculate_hash) |
23 : file_(info->save_info.file_path, | 23 : file_(info->save_info.file_path, |
24 info->url(), | 24 info->url(), |
25 info->referrer_url, | 25 info->referrer_url, |
26 info->received_bytes, | 26 info->received_bytes, |
27 calculate_hash, | 27 calculate_hash, |
28 info->save_info.hash_state, | 28 info->save_info.hash_state, |
29 info->save_info.file_stream), | 29 info->save_info.file_stream, |
30 id_(info->download_id), | 30 net::BoundNetLog()), |
31 request_handle_(request_handle), | 31 id_(info->download_id), |
32 download_manager_(download_manager) { | 32 request_handle_(request_handle), |
| 33 download_manager_(download_manager) { |
33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
34 } | 35 } |
35 | 36 |
36 DownloadFileImpl::~DownloadFileImpl() { | 37 DownloadFileImpl::~DownloadFileImpl() { |
37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
38 } | 39 } |
39 | 40 |
40 // BaseFile delegated functions. | 41 // BaseFile delegated functions. |
41 net::Error DownloadFileImpl::Initialize() { | 42 net::Error DownloadFileImpl::Initialize() { |
42 return file_.Initialize(); | 43 return file_.Initialize(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 std::string DownloadFileImpl::DebugString() const { | 114 std::string DownloadFileImpl::DebugString() const { |
114 return base::StringPrintf("{" | 115 return base::StringPrintf("{" |
115 " id_ = " "%d" | 116 " id_ = " "%d" |
116 " request_handle = %s" | 117 " request_handle = %s" |
117 " Base File = %s" | 118 " Base File = %s" |
118 " }", | 119 " }", |
119 id_.local(), | 120 id_.local(), |
120 request_handle_->DebugString().c_str(), | 121 request_handle_->DebugString().c_str(), |
121 file_.DebugString().c_str()); | 122 file_.DebugString().c_str()); |
122 } | 123 } |
OLD | NEW |