| 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 29 matching lines...) Expand all Loading... |
| 40 // WebContents. | 40 // WebContents. |
| 41 virtual WebContents* GetWebContents() const = 0; | 41 virtual WebContents* GetWebContents() const = 0; |
| 42 | 42 |
| 43 // Returns whether the download uses parallel requests. | 43 // Returns whether the download uses parallel requests. |
| 44 virtual bool UsesParallelRequests() const; | 44 virtual bool UsesParallelRequests() const; |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 void StartDownload() const; | 47 void StartDownload() const; |
| 48 void Interrupt(DownloadInterruptReason reason); | 48 void Interrupt(DownloadInterruptReason reason); |
| 49 | 49 |
| 50 // Add a byte stream to the download sink. | 50 // Add a byte stream to the download sink. Return false if we start to |
| 51 void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, | 51 // destroy download file. |
| 52 bool AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, |
| 52 int64_t offset, | 53 int64_t offset, |
| 53 int64_t length); | 54 int64_t length); |
| 54 | 55 |
| 55 DownloadItemImpl* download_item_; | 56 DownloadItemImpl* download_item_; |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 // If the download progress is paused by the user. | 59 // If the download progress is paused by the user. |
| 59 bool is_paused_; | 60 bool is_paused_; |
| 60 | 61 |
| 61 DISALLOW_COPY_AND_ASSIGN(DownloadJob); | 62 DISALLOW_COPY_AND_ASSIGN(DownloadJob); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace content | 65 } // namespace content |
| 65 | 66 |
| 66 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ | 67 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ |
| OLD | NEW |