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