| 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/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/download_danger_type.h" | 12 #include "content/public/browser/download_danger_type.h" |
| 12 #include "content/public/browser/download_interrupt_reasons.h" | 13 #include "content/public/browser/download_interrupt_reasons.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 class DownloadItemImpl; | 17 class DownloadItemImpl; |
| 17 class WebContents; | 18 class WebContents; |
| 18 | 19 |
| 19 // DownloadJob lives on UI thread and subclasses implement actual download logic | 20 // DownloadJob lives on UI thread and subclasses implement actual download logic |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 // Return the WebContents associated with the download. Usually used to | 36 // Return the WebContents associated with the download. Usually used to |
| 36 // 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 |
| 37 // user. | 38 // user. |
| 38 // 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 |
| 39 // WebContents. | 40 // WebContents. |
| 40 virtual WebContents* GetWebContents() const = 0; | 41 virtual WebContents* GetWebContents() const = 0; |
| 41 | 42 |
| 42 protected: | 43 protected: |
| 43 void StartDownload() const; | 44 void StartDownload() const; |
| 44 | 45 |
| 46 // Add a byte stream to the download sink. |
| 47 void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, |
| 48 int64_t offset, |
| 49 int64_t length); |
| 50 |
| 45 DownloadItemImpl* download_item_; | 51 DownloadItemImpl* download_item_; |
| 46 | 52 |
| 47 private: | 53 private: |
| 48 // If the download progress is paused by the user. | 54 // If the download progress is paused by the user. |
| 49 bool is_paused_; | 55 bool is_paused_; |
| 50 | 56 |
| 51 DISALLOW_COPY_AND_ASSIGN(DownloadJob); | 57 DISALLOW_COPY_AND_ASSIGN(DownloadJob); |
| 52 }; | 58 }; |
| 53 | 59 |
| 54 } // namespace content | 60 } // namespace content |
| 55 | 61 |
| 56 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ | 62 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ |
| OLD | NEW |