| 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 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 // Set the client guid which will be used to identify the app to the |
| 73 // system AV scanning function. Should be called before |
| 74 // AnnotateWithSourceInformation() to take effect. |
| 75 void SetClientGuid(const std::string& guid); |
| 76 |
| 72 // Informs the OS that this file came from the internet. Returns a | 77 // Informs the OS that this file came from the internet. Returns a |
| 73 // DownloadInterruptReason indicating the result of the operation. | 78 // DownloadInterruptReason indicating the result of the operation. |
| 79 // Note: SetClientGuid() should be called before this function on |
| 80 // Windows to ensure the correct app client ID is available. |
| 74 DownloadInterruptReason AnnotateWithSourceInformation(); | 81 DownloadInterruptReason AnnotateWithSourceInformation(); |
| 75 | 82 |
| 76 base::FilePath full_path() const { return full_path_; } | 83 base::FilePath full_path() const { return full_path_; } |
| 77 bool in_progress() const { return file_stream_.get() != NULL; } | 84 bool in_progress() const { return file_stream_.get() != NULL; } |
| 78 int64 bytes_so_far() const { return bytes_so_far_; } | 85 int64 bytes_so_far() const { return bytes_so_far_; } |
| 79 | 86 |
| 80 // Fills |hash| with the hash digest for the file. | 87 // Fills |hash| with the hash digest for the file. |
| 81 // Returns true if digest is successfully calculated. | 88 // Returns true if digest is successfully calculated. |
| 82 virtual bool GetHash(std::string* hash); | 89 virtual bool GetHash(std::string* hash); |
| 83 | 90 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 142 |
| 136 // Full path to the file including the file name. | 143 // Full path to the file including the file name. |
| 137 base::FilePath full_path_; | 144 base::FilePath full_path_; |
| 138 | 145 |
| 139 // Source URL for the file being downloaded. | 146 // Source URL for the file being downloaded. |
| 140 GURL source_url_; | 147 GURL source_url_; |
| 141 | 148 |
| 142 // The URL where the download was initiated. | 149 // The URL where the download was initiated. |
| 143 GURL referrer_url_; | 150 GURL referrer_url_; |
| 144 | 151 |
| 152 std::string client_guid_; |
| 153 |
| 145 // OS file stream for writing | 154 // OS file stream for writing |
| 146 scoped_ptr<net::FileStream> file_stream_; | 155 scoped_ptr<net::FileStream> file_stream_; |
| 147 | 156 |
| 148 // Amount of data received up so far, in bytes. | 157 // Amount of data received up so far, in bytes. |
| 149 int64 bytes_so_far_; | 158 int64 bytes_so_far_; |
| 150 | 159 |
| 151 // Start time for calculating speed. | 160 // Start time for calculating speed. |
| 152 base::TimeTicks start_tick_; | 161 base::TimeTicks start_tick_; |
| 153 | 162 |
| 154 // Indicates if hash should be calculated for the file. | 163 // Indicates if hash should be calculated for the file. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 165 bool detached_; | 174 bool detached_; |
| 166 | 175 |
| 167 net::BoundNetLog bound_net_log_; | 176 net::BoundNetLog bound_net_log_; |
| 168 | 177 |
| 169 DISALLOW_COPY_AND_ASSIGN(BaseFile); | 178 DISALLOW_COPY_AND_ASSIGN(BaseFile); |
| 170 }; | 179 }; |
| 171 | 180 |
| 172 } // namespace content | 181 } // namespace content |
| 173 | 182 |
| 174 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ | 183 #endif // CONTENT_BROWSER_DOWNLOAD_BASE_FILE_H_ |
| OLD | NEW |