| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_JOB_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "content/browser/byte_stream.h" | 10 #include "content/browser/byte_stream.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Returns whether the download is parallelizable. The download may not send | 43 // Returns whether the download is parallelizable. The download may not send |
| 44 // parallel requests as it can be disabled through flags. | 44 // parallel requests as it can be disabled through flags. |
| 45 virtual bool IsParallelizable() const; | 45 virtual bool IsParallelizable() const; |
| 46 | 46 |
| 47 // Cancel a particular request starts from |offset|, while the download is not | 47 // Cancel a particular request starts from |offset|, while the download is not |
| 48 // canceled. Used in parallel download. | 48 // canceled. Used in parallel download. |
| 49 virtual void CancelRequestWithOffset(int64_t offset); | 49 virtual void CancelRequestWithOffset(int64_t offset); |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 void StartDownload() const; | 52 void StartDownload() const; |
| 53 void Interrupt(DownloadInterruptReason reason); | |
| 54 | 53 |
| 55 // Add a byte stream to the download sink. Return false if we start to | 54 // Add a byte stream to the download sink. Return false if we start to |
| 56 // destroy download file. | 55 // destroy download file. |
| 57 bool AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, | 56 bool AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, |
| 58 int64_t offset, | 57 int64_t offset, |
| 59 int64_t length); | 58 int64_t length); |
| 60 | 59 |
| 61 // Sets the potential length of the file. | |
| 62 void SetPotentialFileLength(int64_t length); | |
| 63 | |
| 64 DownloadItemImpl* download_item_; | 60 DownloadItemImpl* download_item_; |
| 65 | 61 |
| 66 private: | 62 private: |
| 67 // If the download progress is paused by the user. | 63 // If the download progress is paused by the user. |
| 68 bool is_paused_; | 64 bool is_paused_; |
| 69 | 65 |
| 70 DISALLOW_COPY_AND_ASSIGN(DownloadJob); | 66 DISALLOW_COPY_AND_ASSIGN(DownloadJob); |
| 71 }; | 67 }; |
| 72 | 68 |
| 73 } // namespace content | 69 } // namespace content |
| 74 | 70 |
| 75 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ | 71 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ |
| OLD | NEW |