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_BROWSER_DOWNLOAD_BASE_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // File being downloaded and saved to disk. This is a base class | 30 // File being downloaded and saved to disk. This is a base class |
31 // for DownloadFile and SaveFile, which keep more state information. BaseFile | 31 // for DownloadFile and SaveFile, which keep more state information. BaseFile |
32 // considers itself the owner of the physical file and will delete it when the | 32 // considers itself the owner of the physical file and will delete it when the |
33 // BaseFile object is destroyed unless the ownership is revoked via a call to | 33 // BaseFile object is destroyed unless the ownership is revoked via a call to |
34 // Detach(). | 34 // Detach(). |
35 class CONTENT_EXPORT BaseFile { | 35 class CONTENT_EXPORT BaseFile { |
36 public: | 36 public: |
37 // May be constructed on any thread. All other routines (including | 37 // May be constructed on any thread. All other routines (including |
38 // destruction) must occur on the FILE thread. | 38 // destruction) must occur on the FILE thread. |
39 BaseFile(const net::BoundNetLog& bound_net_log); | 39 BaseFile(const net::NetLogWithSource& net_log); |
40 ~BaseFile(); | 40 ~BaseFile(); |
41 | 41 |
42 // Returns DOWNLOAD_INTERRUPT_REASON_NONE on success, or a | 42 // Returns DOWNLOAD_INTERRUPT_REASON_NONE on success, or a |
43 // DownloadInterruptReason on failure. Upon success, the file at |full_path()| | 43 // DownloadInterruptReason on failure. Upon success, the file at |full_path()| |
44 // is assumed to be owned by the BaseFile. It will be deleted when the | 44 // is assumed to be owned by the BaseFile. It will be deleted when the |
45 // BaseFile object is destroyed unless Detach() is called before destroying | 45 // BaseFile object is destroyed unless Detach() is called before destroying |
46 // the BaseFile instance. | 46 // the BaseFile instance. |
47 // | 47 // |
48 // |full_path|: Full path to the download file. Can be empty, in which case | 48 // |full_path|: Full path to the download file. Can be empty, in which case |
49 // the rules described in |default_directory| will be used to generate a | 49 // the rules described in |default_directory| will be used to generate a |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // Used to calculate hash for the file when calculate_hash_ is set. | 216 // Used to calculate hash for the file when calculate_hash_ is set. |
217 std::unique_ptr<crypto::SecureHash> secure_hash_; | 217 std::unique_ptr<crypto::SecureHash> secure_hash_; |
218 | 218 |
219 // Start time for calculating speed. | 219 // Start time for calculating speed. |
220 base::TimeTicks start_tick_; | 220 base::TimeTicks start_tick_; |
221 | 221 |
222 // Indicates that this class no longer owns the associated file, and so | 222 // Indicates that this class no longer owns the associated file, and so |
223 // won't delete it on destruction. | 223 // won't delete it on destruction. |
224 bool detached_ = false; | 224 bool detached_ = false; |
225 | 225 |
226 net::BoundNetLog bound_net_log_; | 226 net::NetLogWithSource net_log_; |
227 | 227 |
228 DISALLOW_COPY_AND_ASSIGN(BaseFile); | 228 DISALLOW_COPY_AND_ASSIGN(BaseFile); |
229 }; | 229 }; |
230 | 230 |
231 } // namespace content | 231 } // namespace content |
232 | 232 |
233 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 233 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
OLD | NEW |