| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void StreamActive(SourceStream* source_stream); | 188 void StreamActive(SourceStream* source_stream); |
| 189 | 189 |
| 190 // Register callback and start to read data from the stream. | 190 // Register callback and start to read data from the stream. |
| 191 void RegisterAndActivateStream(SourceStream* source_stream); | 191 void RegisterAndActivateStream(SourceStream* source_stream); |
| 192 | 192 |
| 193 // Adds a new slice to |received_slices_| and update the existing entries in | 193 // Adds a new slice to |received_slices_| and update the existing entries in |
| 194 // |source_streams_| as their lengths will change. | 194 // |source_streams_| as their lengths will change. |
| 195 // TODO(qinmin): add a test for this function. | 195 // TODO(qinmin): add a test for this function. |
| 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. |
| 199 bool IsDownloadCompleted(); |
| 200 |
| 198 // Return the total valid bytes received in the target file. | 201 // Return the total valid bytes received in the target file. |
| 199 // 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. |
| 200 // Otherwise, return the current file size. | 203 // Otherwise, return the current file size. |
| 201 int64_t TotalBytesReceived() const; | 204 int64_t TotalBytesReceived() const; |
| 202 | 205 |
| 203 net::NetLogWithSource net_log_; | 206 net::NetLogWithSource net_log_; |
| 204 | 207 |
| 205 // The base file instance. | 208 // The base file instance. |
| 206 BaseFile file_; | 209 BaseFile file_; |
| 207 | 210 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 244 |
| 242 base::WeakPtr<DownloadDestinationObserver> observer_; | 245 base::WeakPtr<DownloadDestinationObserver> observer_; |
| 243 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; | 246 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; |
| 244 | 247 |
| 245 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | 248 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
| 246 }; | 249 }; |
| 247 | 250 |
| 248 } // namespace content | 251 } // namespace content |
| 249 | 252 |
| 250 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 253 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| OLD | NEW |