OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/download/download_file.h" | 5 #include "chrome/browser/download/download_file.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 "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
11 #include "chrome/browser/browser_thread.h" | 11 #include "chrome/browser/browser_thread.h" |
12 #include "chrome/browser/download/download_manager.h" | 12 #include "chrome/browser/download/download_manager.h" |
13 #include "chrome/browser/download/download_util.h" | 13 #include "chrome/browser/download/download_util.h" |
14 #include "chrome/browser/history/download_create_info.h" | 14 #include "chrome/browser/history/download_create_info.h" |
15 | 15 |
16 DownloadFile::DownloadFile(const DownloadCreateInfo* info, | 16 DownloadFile::DownloadFile(const DownloadCreateInfo* info, |
17 DownloadManager* download_manager) | 17 DownloadManager* download_manager, |
| 18 bool calculate_hash) |
18 : BaseFile(info->save_info.file_path, | 19 : BaseFile(info->save_info.file_path, |
19 info->url, | 20 info->url, |
20 info->referrer_url, | 21 info->referrer_url, |
21 info->received_bytes, | 22 info->received_bytes, |
22 info->save_info.file_stream), | 23 info->save_info.file_stream, |
| 24 calculate_hash), |
23 id_(info->download_id), | 25 id_(info->download_id), |
24 child_id_(info->child_id), | 26 child_id_(info->child_id), |
25 request_id_(info->request_id), | 27 request_id_(info->request_id), |
26 download_manager_(download_manager) { | 28 download_manager_(download_manager) { |
27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
28 | |
29 } | 30 } |
30 | 31 |
31 DownloadFile::~DownloadFile() { | 32 DownloadFile::~DownloadFile() { |
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
33 } | 34 } |
34 | 35 |
35 void DownloadFile::DeleteCrDownload() { | 36 void DownloadFile::DeleteCrDownload() { |
36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
37 FilePath crdownload = download_util::GetCrDownloadPath(full_path_); | 38 FilePath crdownload = download_util::GetCrDownloadPath(full_path_); |
38 file_util::Delete(crdownload, false); | 39 file_util::Delete(crdownload, false); |
(...skipping 21 matching lines...) Expand all Loading... |
60 " child_id_ = " "%d" | 61 " child_id_ = " "%d" |
61 " request_id_ = " "%d" | 62 " request_id_ = " "%d" |
62 " Base File = %s" | 63 " Base File = %s" |
63 " }", | 64 " }", |
64 full_path_.value().c_str(), | 65 full_path_.value().c_str(), |
65 id_, | 66 id_, |
66 child_id_, | 67 child_id_, |
67 request_id_, | 68 request_id_, |
68 BaseFile::DebugString().c_str()); | 69 BaseFile::DebugString().c_str()); |
69 } | 70 } |
OLD | NEW |