| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 bool is_paused() const { return is_paused_; } | 34 bool is_paused() const { return is_paused_; } |
| 35 | 35 |
| 36 // Return the WebContents associated with the download. Usually used to | 36 // Return the WebContents associated with the download. Usually used to |
| 37 // associate a browser window for any UI that needs to be displayed to the | 37 // associate a browser window for any UI that needs to be displayed to the |
| 38 // user. | 38 // user. |
| 39 // Or return nullptr if the download is not associated with an active | 39 // Or return nullptr if the download is not associated with an active |
| 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. |
| 44 virtual bool UsesParallelRequests() const; |
| 45 |
| 43 protected: | 46 protected: |
| 44 void StartDownload() const; | 47 void StartDownload() const; |
| 45 void Interrupt(DownloadInterruptReason reason); | 48 void Interrupt(DownloadInterruptReason reason); |
| 46 | 49 |
| 47 // Add a byte stream to the download sink. | 50 // Add a byte stream to the download sink. |
| 48 void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, | 51 void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, |
| 49 int64_t offset, | 52 int64_t offset, |
| 50 int64_t length); | 53 int64_t length); |
| 51 | 54 |
| 52 DownloadItemImpl* download_item_; | 55 DownloadItemImpl* download_item_; |
| 53 | 56 |
| 54 private: | 57 private: |
| 55 // If the download progress is paused by the user. | 58 // If the download progress is paused by the user. |
| 56 bool is_paused_; | 59 bool is_paused_; |
| 57 | 60 |
| 58 DISALLOW_COPY_AND_ASSIGN(DownloadJob); | 61 DISALLOW_COPY_AND_ASSIGN(DownloadJob); |
| 59 }; | 62 }; |
| 60 | 63 |
| 61 } // namespace content | 64 } // namespace content |
| 62 | 65 |
| 63 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ | 66 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ |
| OLD | NEW |