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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "chrome/browser/download/base_file.h" | 13 #include "chrome/browser/download/base_file.h" |
14 #include "chrome/browser/download/download_types.h" | 14 #include "chrome/browser/download/download_types.h" |
15 | 15 |
16 struct DownloadCreateInfo; | 16 struct DownloadCreateInfo; |
17 class DownloadManager; | 17 class DownloadManager; |
18 class ResourceDispatcherHost; | 18 class ResourceDispatcherHost; |
19 | 19 |
20 // These objects live exclusively on the download thread and handle the writing | 20 // These objects live exclusively on the download thread and handle the writing |
21 // operations for one download. These objects live only for the duration that | 21 // operations for one download. These objects live only for the duration that |
22 // the download is 'in progress': once the download has been completed or | 22 // the download is 'in progress': once the download has been completed or |
23 // cancelled, the DownloadFile is destroyed. | 23 // cancelled, the DownloadFile is destroyed. |
24 class DownloadFile : public BaseFile { | 24 class DownloadFile : public BaseFile { |
25 public: | 25 public: |
26 DownloadFile(const DownloadCreateInfo* info, | 26 DownloadFile(const DownloadCreateInfo* info, |
27 DownloadManager* download_manager); | 27 DownloadManager* download_manager, |
| 28 bool calculate_hash); |
28 virtual ~DownloadFile(); | 29 virtual ~DownloadFile(); |
29 | 30 |
30 // Deletes its .crdownload intermediate file. | 31 // Deletes its .crdownload intermediate file. |
31 // Marked virtual for testing. | 32 // Marked virtual for testing. |
32 virtual void DeleteCrDownload(); | 33 virtual void DeleteCrDownload(); |
33 | 34 |
34 // Cancels the download request associated with this file. | 35 // Cancels the download request associated with this file. |
35 void CancelDownloadRequest(ResourceDispatcherHost* rdh); | 36 void CancelDownloadRequest(ResourceDispatcherHost* rdh); |
36 | 37 |
37 int id() const { return id_; } | 38 int id() const { return id_; } |
(...skipping 12 matching lines...) Expand all Loading... |
50 // Handle for informing the ResourceDispatcherHost of a UI based cancel. | 51 // Handle for informing the ResourceDispatcherHost of a UI based cancel. |
51 int request_id_; | 52 int request_id_; |
52 | 53 |
53 // DownloadManager this download belongs to. | 54 // DownloadManager this download belongs to. |
54 scoped_refptr<DownloadManager> download_manager_; | 55 scoped_refptr<DownloadManager> download_manager_; |
55 | 56 |
56 DISALLOW_COPY_AND_ASSIGN(DownloadFile); | 57 DISALLOW_COPY_AND_ASSIGN(DownloadFile); |
57 }; | 58 }; |
58 | 59 |
59 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 60 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
OLD | NEW |