| 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_DOWNLOAD_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Used to drop the request, when the byte stream reader should be closed on | 45 // Used to drop the request, when the byte stream reader should be closed on |
| 46 // FILE thread. | 46 // FILE thread. |
| 47 typedef base::Callback<void(int64_t offset)> CancelRequestCallback; | 47 typedef base::Callback<void(int64_t offset)> CancelRequestCallback; |
| 48 | 48 |
| 49 virtual ~DownloadFile() {} | 49 virtual ~DownloadFile() {} |
| 50 | 50 |
| 51 // Upon completion, |initialize_callback| will be called on the UI | 51 // Upon completion, |initialize_callback| will be called on the UI |
| 52 // thread as per the comment above, passing DOWNLOAD_INTERRUPT_REASON_NONE | 52 // thread as per the comment above, passing DOWNLOAD_INTERRUPT_REASON_NONE |
| 53 // on success, or a network download interrupt reason on failure. | 53 // on success, or a network download interrupt reason on failure. |
| 54 virtual void Initialize( | 54 virtual void Initialize(const InitializeCallback& initialize_callback, |
| 55 const InitializeCallback& initialize_callback, | 55 const CancelRequestCallback& cancel_request_callback, |
| 56 const CancelRequestCallback& cancel_request_callback, | 56 const DownloadItem::ReceivedSlices& received_slices, |
| 57 const DownloadItem::ReceivedSlices& received_slices) = 0; | 57 bool is_parallelizable) = 0; |
| 58 | 58 |
| 59 // Add a byte stream reader to write into a slice of the file, used for | 59 // Add a byte stream reader to write into a slice of the file, used for |
| 60 // parallel download. Called on the file thread. | 60 // parallel download. Called on the file thread. |
| 61 virtual void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, | 61 virtual void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, |
| 62 int64_t offset, | 62 int64_t offset, |
| 63 int64_t length) = 0; | 63 int64_t length) = 0; |
| 64 | 64 |
| 65 // Rename the download file to |full_path|. If that file exists | 65 // Rename the download file to |full_path|. If that file exists |
| 66 // |full_path| will be uniquified by suffixing " (<number>)" to the | 66 // |full_path| will be uniquified by suffixing " (<number>)" to the |
| 67 // file name before the extension. | 67 // file name before the extension. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 92 virtual void SetPotentialFileLength(int64_t length) = 0; | 92 virtual void SetPotentialFileLength(int64_t length) = 0; |
| 93 | 93 |
| 94 virtual const base::FilePath& FullPath() const = 0; | 94 virtual const base::FilePath& FullPath() const = 0; |
| 95 virtual bool InProgress() const = 0; | 95 virtual bool InProgress() const = 0; |
| 96 virtual void WasPaused() = 0; | 96 virtual void WasPaused() = 0; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace content | 99 } // namespace content |
| 100 | 100 |
| 101 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 101 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
| OLD | NEW |