| 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_BASE_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // Abort the download and automatically close the file. | 66 // Abort the download and automatically close the file. |
| 67 void Cancel(); | 67 void Cancel(); |
| 68 | 68 |
| 69 // Indicate that the download has finished. No new data will be received. | 69 // Indicate that the download has finished. No new data will be received. |
| 70 void Finish(); | 70 void Finish(); |
| 71 | 71 |
| 72 // Informs the OS that this file came from the internet. Returns a | 72 // Informs the OS that this file came from the internet. Returns a |
| 73 // DownloadInterruptReason indicating the result of the operation. | 73 // DownloadInterruptReason indicating the result of the operation. |
| 74 DownloadInterruptReason AnnotateWithSourceInformation(); | 74 DownloadInterruptReason AnnotateWithSourceInformation(); |
| 75 | 75 |
| 76 // Calculate and return the current speed in bytes per second. | |
| 77 int64 CurrentSpeed() const; | |
| 78 | |
| 79 base::FilePath full_path() const { return full_path_; } | 76 base::FilePath full_path() const { return full_path_; } |
| 80 bool in_progress() const { return file_stream_.get() != NULL; } | 77 bool in_progress() const { return file_stream_.get() != NULL; } |
| 81 int64 bytes_so_far() const { return bytes_so_far_; } | 78 int64 bytes_so_far() const { return bytes_so_far_; } |
| 82 | 79 |
| 83 // Fills |hash| with the hash digest for the file. | 80 // Fills |hash| with the hash digest for the file. |
| 84 // Returns true if digest is successfully calculated. | 81 // Returns true if digest is successfully calculated. |
| 85 virtual bool GetHash(std::string* hash); | 82 virtual bool GetHash(std::string* hash); |
| 86 | 83 |
| 87 // Returns the current (intermediate) state of the hash as a byte string. | 84 // Returns the current (intermediate) state of the hash as a byte string. |
| 88 virtual std::string GetHashState(); | 85 virtual std::string GetHashState(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 bool detached_; | 165 bool detached_; |
| 169 | 166 |
| 170 net::BoundNetLog bound_net_log_; | 167 net::BoundNetLog bound_net_log_; |
| 171 | 168 |
| 172 DISALLOW_COPY_AND_ASSIGN(BaseFile); | 169 DISALLOW_COPY_AND_ASSIGN(BaseFile); |
| 173 }; | 170 }; |
| 174 | 171 |
| 175 } // namespace content | 172 } // namespace content |
| 176 | 173 |
| 177 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 174 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| OLD | NEW |