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 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_ |
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/files/file.h" | 12 #include "base/files/file.h" |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
15 #include "crypto/secure_hash.h" | 16 #include "crypto/secure_hash.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 // Holds the information about how to save a download file. | 20 // Holds the information about how to save a download file. |
20 // In the case of download continuation, |file_path| is set to the current file | 21 // In the case of download continuation, |file_path| is set to the current file |
21 // name, |offset| is set to the point where we left off, and |hash_state| will | 22 // name, |offset| is set to the point where we left off, and |hash_state| will |
22 // hold the state of the hash algorithm where we left off. | 23 // hold the state of the hash algorithm where we left off. |
23 struct CONTENT_EXPORT DownloadSaveInfo { | 24 struct CONTENT_EXPORT DownloadSaveInfo { |
(...skipping 11 matching lines...) Expand all Loading... |
35 base::string16 suggested_name; | 36 base::string16 suggested_name; |
36 | 37 |
37 // If valid, contains the source data stream for the file contents. | 38 // If valid, contains the source data stream for the file contents. |
38 base::File file; | 39 base::File file; |
39 | 40 |
40 // The file offset at which to start the download. May be 0. | 41 // The file offset at which to start the download. May be 0. |
41 int64_t offset; | 42 int64_t offset; |
42 | 43 |
43 // The state of the hash. If specified, this hash state must indicate the | 44 // The state of the hash. If specified, this hash state must indicate the |
44 // state of the partial file for the first |offset| bytes. | 45 // state of the partial file for the first |offset| bytes. |
45 scoped_ptr<crypto::SecureHash> hash_state; | 46 std::unique_ptr<crypto::SecureHash> hash_state; |
46 | 47 |
47 // SHA-256 hash of the first |offset| bytes of the file. Only used if |offset| | 48 // SHA-256 hash of the first |offset| bytes of the file. Only used if |offset| |
48 // is non-zero and either |file_path| or |file| specifies the file which | 49 // is non-zero and either |file_path| or |file| specifies the file which |
49 // contains the |offset| number of bytes. Can be empty, in which case no | 50 // contains the |offset| number of bytes. Can be empty, in which case no |
50 // verification is done on the existing file. | 51 // verification is done on the existing file. |
51 std::string hash_of_partial_file; | 52 std::string hash_of_partial_file; |
52 | 53 |
53 // If |prompt_for_save_location| is true, and |file_path| is empty, then | 54 // If |prompt_for_save_location| is true, and |file_path| is empty, then |
54 // the user will be prompted for a location to save the download. Otherwise, | 55 // the user will be prompted for a location to save the download. Otherwise, |
55 // the location will be determined automatically using |file_path| as a | 56 // the location will be determined automatically using |file_path| as a |
56 // basis if |file_path| is not empty. | 57 // basis if |file_path| is not empty. |
57 // |prompt_for_save_location| defaults to false. | 58 // |prompt_for_save_location| defaults to false. |
58 bool prompt_for_save_location; | 59 bool prompt_for_save_location; |
59 | 60 |
60 private: | 61 private: |
61 DISALLOW_COPY_AND_ASSIGN(DownloadSaveInfo); | 62 DISALLOW_COPY_AND_ASSIGN(DownloadSaveInfo); |
62 }; | 63 }; |
63 | 64 |
64 } // namespace content | 65 } // namespace content |
65 | 66 |
66 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_ | 67 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_SAVE_INFO_H_ |
OLD | NEW |