| 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/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Detach the file so it is not deleted on destruction. | 63 // Detach the file so it is not deleted on destruction. |
| 64 virtual void Detach(); | 64 virtual void Detach(); |
| 65 | 65 |
| 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. | 72 // Informs the OS that this file came from the internet. Returns a |
| 73 void AnnotateWithSourceInformation(); | 73 // DownloadInterruptReason indicating the result of the operation. |
| 74 DownloadInterruptReason AnnotateWithSourceInformation(); |
| 74 | 75 |
| 75 // Calculate and return the current speed in bytes per second. | 76 // Calculate and return the current speed in bytes per second. |
| 76 int64 CurrentSpeed() const; | 77 int64 CurrentSpeed() const; |
| 77 | 78 |
| 78 FilePath full_path() const { return full_path_; } | 79 FilePath full_path() const { return full_path_; } |
| 79 bool in_progress() const { return file_stream_.get() != NULL; } | 80 bool in_progress() const { return file_stream_.get() != NULL; } |
| 80 int64 bytes_so_far() const { return bytes_so_far_; } | 81 int64 bytes_so_far() const { return bytes_so_far_; } |
| 81 | 82 |
| 82 // Fills |hash| with the hash digest for the file. | 83 // Fills |hash| with the hash digest for the file. |
| 83 // Returns true if digest is successfully calculated. | 84 // Returns true if digest is successfully calculated. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 bool detached_; | 168 bool detached_; |
| 168 | 169 |
| 169 net::BoundNetLog bound_net_log_; | 170 net::BoundNetLog bound_net_log_; |
| 170 | 171 |
| 171 DISALLOW_COPY_AND_ASSIGN(BaseFile); | 172 DISALLOW_COPY_AND_ASSIGN(BaseFile); |
| 172 }; | 173 }; |
| 173 | 174 |
| 174 } // namespace content | 175 } // namespace content |
| 175 | 176 |
| 176 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 177 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| OLD | NEW |