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 // Each download is represented by a DownloadItem, and all DownloadItems | 5 // Each download is represented by a DownloadItem, and all DownloadItems |
6 // are owned by the DownloadManager which maintains a global list of all | 6 // are owned by the DownloadManager which maintains a global list of all |
7 // downloads. DownloadItems are created when a user initiates a download, | 7 // downloads. DownloadItems are created when a user initiates a download, |
8 // and exist for the duration of the browser life time. | 8 // and exist for the duration of the browser life time. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 virtual const std::string& GetLastModifiedTime() const = 0; | 194 virtual const std::string& GetLastModifiedTime() const = 0; |
195 virtual const std::string& GetETag() const = 0; | 195 virtual const std::string& GetETag() const = 0; |
196 virtual bool IsSavePackageDownload() const = 0; | 196 virtual bool IsSavePackageDownload() const = 0; |
197 | 197 |
198 // Destination State accessors -------------------------------------------- | 198 // Destination State accessors -------------------------------------------- |
199 | 199 |
200 // Full path to the downloaded or downloading file. This is the path to the | 200 // Full path to the downloaded or downloading file. This is the path to the |
201 // physical file, if one exists. It should be considered a hint; changes to | 201 // physical file, if one exists. It should be considered a hint; changes to |
202 // this value and renames of the file on disk are not atomic with each other. | 202 // this value and renames of the file on disk are not atomic with each other. |
203 // May be empty if the in-progress path hasn't been determined yet. | 203 // May be empty if the in-progress path hasn't been determined yet. |
204 virtual const FilePath& GetFullPath() const = 0; | 204 virtual const base::FilePath& GetFullPath() const = 0; |
205 | 205 |
206 // Target path of an in-progress download. We may be downloading to a | 206 // Target path of an in-progress download. We may be downloading to a |
207 // temporary or intermediate file (specified by GetFullPath()); this is the | 207 // temporary or intermediate file (specified by GetFullPath()); this is the |
208 // name we will use once the download completes. | 208 // name we will use once the download completes. |
209 // May be empty if the target path hasn't yet been determined. | 209 // May be empty if the target path hasn't yet been determined. |
210 virtual const FilePath& GetTargetFilePath() const = 0; | 210 virtual const base::FilePath& GetTargetFilePath() const = 0; |
211 | 211 |
212 // If the download forced a path rather than requesting name determination, | 212 // If the download forced a path rather than requesting name determination, |
213 // return the path requested. | 213 // return the path requested. |
214 virtual const FilePath& GetForcedFilePath() const = 0; | 214 virtual const base::FilePath& GetForcedFilePath() const = 0; |
215 | 215 |
216 // Returns the user-verified target file path for the download. | 216 // Returns the user-verified target file path for the download. |
217 // This returns the same path as GetTargetFilePath() for safe downloads | 217 // This returns the same path as GetTargetFilePath() for safe downloads |
218 // but does not for dangerous downloads until the name is verified. | 218 // but does not for dangerous downloads until the name is verified. |
219 virtual FilePath GetUserVerifiedFilePath() const = 0; | 219 virtual base::FilePath GetUserVerifiedFilePath() const = 0; |
220 | 220 |
221 // Returns the file-name that should be reported to the user. If a display | 221 // Returns the file-name that should be reported to the user. If a display |
222 // name has been explicitly set using SetDisplayName(), this function returns | 222 // name has been explicitly set using SetDisplayName(), this function returns |
223 // that display name. Otherwise returns the final target filename. | 223 // that display name. Otherwise returns the final target filename. |
224 virtual FilePath GetFileNameToReportUser() const = 0; | 224 virtual base::FilePath GetFileNameToReportUser() const = 0; |
225 | 225 |
226 virtual TargetDisposition GetTargetDisposition() const = 0; | 226 virtual TargetDisposition GetTargetDisposition() const = 0; |
227 | 227 |
228 // Final hash of completely downloaded file; not valid if | 228 // Final hash of completely downloaded file; not valid if |
229 // GetState() != COMPLETED. | 229 // GetState() != COMPLETED. |
230 virtual const std::string& GetHash() const = 0; | 230 virtual const std::string& GetHash() const = 0; |
231 | 231 |
232 // Intermediate hash state, for persisting partial downloads. | 232 // Intermediate hash state, for persisting partial downloads. |
233 virtual const std::string& GetHashState() const = 0; | 233 virtual const std::string& GetHashState() const = 0; |
234 | 234 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // Mark the download as temporary (not visible in persisted store or | 307 // Mark the download as temporary (not visible in persisted store or |
308 // SearchDownloads(), removed from main UI upon completion). | 308 // SearchDownloads(), removed from main UI upon completion). |
309 virtual void SetIsTemporary(bool temporary) = 0; | 309 virtual void SetIsTemporary(bool temporary) = 0; |
310 | 310 |
311 // Mark the download as having been opened (without actually opening it). | 311 // Mark the download as having been opened (without actually opening it). |
312 virtual void SetOpened(bool opened) = 0; | 312 virtual void SetOpened(bool opened) = 0; |
313 | 313 |
314 // Set a display name for the download that will be independent of the target | 314 // Set a display name for the download that will be independent of the target |
315 // filename. If |name| is not empty, then GetFileNameToReportUser() will | 315 // filename. If |name| is not empty, then GetFileNameToReportUser() will |
316 // return |name|. Has no effect on the final target filename. | 316 // return |name|. Has no effect on the final target filename. |
317 virtual void SetDisplayName(const FilePath& name) = 0; | 317 virtual void SetDisplayName(const base::FilePath& name) = 0; |
318 | 318 |
319 // Debug/testing ------------------------------------------------------------- | 319 // Debug/testing ------------------------------------------------------------- |
320 virtual std::string DebugString(bool verbose) const = 0; | 320 virtual std::string DebugString(bool verbose) const = 0; |
321 }; | 321 }; |
322 | 322 |
323 } // namespace content | 323 } // namespace content |
324 | 324 |
325 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 325 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |