| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FILE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 7 | 7 |
| 8 #include "content/browser/download/download_file.h" | 8 #include "content/browser/download/download_file.h" |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 void AddNewSlice(int64_t offset, int64_t length); | 196 void AddNewSlice(int64_t offset, int64_t length); |
| 197 | 197 |
| 198 // Check if download is completed. | 198 // Check if download is completed. |
| 199 bool IsDownloadCompleted(); | 199 bool IsDownloadCompleted(); |
| 200 | 200 |
| 201 // Return the total valid bytes received in the target file. | 201 // Return the total valid bytes received in the target file. |
| 202 // If the file is a sparse file, return the total number of valid bytes. | 202 // If the file is a sparse file, return the total number of valid bytes. |
| 203 // Otherwise, return the current file size. | 203 // Otherwise, return the current file size. |
| 204 int64_t TotalBytesReceived() const; | 204 int64_t TotalBytesReceived() const; |
| 205 | 205 |
| 206 // Helper method to handle stream error |
| 207 void HandleStreamError(SourceStream* source_stream, |
| 208 DownloadInterruptReason reason); |
| 209 |
| 206 net::NetLogWithSource net_log_; | 210 net::NetLogWithSource net_log_; |
| 207 | 211 |
| 208 // The base file instance. | 212 // The base file instance. |
| 209 BaseFile file_; | 213 BaseFile file_; |
| 210 | 214 |
| 211 // DownloadSaveInfo provided during construction. Since the DownloadFileImpl | 215 // DownloadSaveInfo provided during construction. Since the DownloadFileImpl |
| 212 // can be created on any thread, this holds the save_info_ until it can be | 216 // can be created on any thread, this holds the save_info_ until it can be |
| 213 // used to initialize file_ on the FILE thread. | 217 // used to initialize file_ on the FILE thread. |
| 214 std::unique_ptr<DownloadSaveInfo> save_info_; | 218 std::unique_ptr<DownloadSaveInfo> save_info_; |
| 215 | 219 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 244 | 248 |
| 245 base::WeakPtr<DownloadDestinationObserver> observer_; | 249 base::WeakPtr<DownloadDestinationObserver> observer_; |
| 246 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; | 250 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; |
| 247 | 251 |
| 248 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | 252 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
| 249 }; | 253 }; |
| 250 | 254 |
| 251 } // namespace content | 255 } // namespace content |
| 252 | 256 |
| 253 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 257 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| OLD | NEW |