| 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_WORKER_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_WORKER_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_WORKER_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_WORKER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class CONTENT_EXPORT DownloadWorker : public UrlDownloader::Delegate { | 25 class CONTENT_EXPORT DownloadWorker : public UrlDownloader::Delegate { |
| 26 public: | 26 public: |
| 27 class Delegate { | 27 class Delegate { |
| 28 public: | 28 public: |
| 29 // Called when the the byte stream is established after server response is | 29 // Called when the the byte stream is established after server response is |
| 30 // handled. The stream contains data starts from |offset| of the | 30 // handled. The stream contains data starts from |offset| of the |
| 31 // destination file. | 31 // destination file. |
| 32 virtual void OnByteStreamReady( | 32 virtual void OnByteStreamReady( |
| 33 DownloadWorker* worker, | 33 DownloadWorker* worker, |
| 34 std::unique_ptr<ByteStreamReader> stream_reader) = 0; | 34 std::unique_ptr<ByteStreamReader> stream_reader) = 0; |
| 35 // Called when there is an error caused by the server response. | |
| 36 virtual void OnServerResponseError(DownloadWorker* worker, | |
| 37 DownloadInterruptReason reason) = 0; | |
| 38 }; | 35 }; |
| 39 | 36 |
| 40 DownloadWorker(DownloadWorker::Delegate* delegate, | 37 DownloadWorker(DownloadWorker::Delegate* delegate, |
| 41 int64_t offset, | 38 int64_t offset, |
| 42 int64_t length); | 39 int64_t length); |
| 43 virtual ~DownloadWorker(); | 40 virtual ~DownloadWorker(); |
| 44 | 41 |
| 45 int64_t offset() const { return offset_; } | 42 int64_t offset() const { return offset_; } |
| 46 int64_t length() const { return length_; } | 43 int64_t length() const { return length_; } |
| 47 | 44 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 url_downloader_; | 82 url_downloader_; |
| 86 | 83 |
| 87 base::WeakPtrFactory<DownloadWorker> weak_factory_; | 84 base::WeakPtrFactory<DownloadWorker> weak_factory_; |
| 88 | 85 |
| 89 DISALLOW_COPY_AND_ASSIGN(DownloadWorker); | 86 DISALLOW_COPY_AND_ASSIGN(DownloadWorker); |
| 90 }; | 87 }; |
| 91 | 88 |
| 92 } // namespace content | 89 } // namespace content |
| 93 | 90 |
| 94 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_WORKER_H_ | 91 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_WORKER_H_ |
| OLD | NEW |