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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // This state indicates that the download has been interrupted. | 67 // This state indicates that the download has been interrupted. |
68 INTERRUPTED, | 68 INTERRUPTED, |
69 | 69 |
70 // Maximum value. | 70 // Maximum value. |
71 MAX_DOWNLOAD_STATE | 71 MAX_DOWNLOAD_STATE |
72 }; | 72 }; |
73 | 73 |
74 // How the final target path should be used. | 74 // How the final target path should be used. |
75 enum TargetDisposition { | 75 enum TargetDisposition { |
76 TARGET_DISPOSITION_OVERWRITE, // Overwrite if the target already exists. | 76 TARGET_DISPOSITION_OVERWRITE, // Overwrite if the target already exists. |
77 TARGET_DISPOSITION_PROMPT // Prompt the user for the actual | 77 TARGET_DISPOSITION_PROMPT // Prompt the user for the actual |
78 // target. Implies | 78 // target. Implies |
79 // TARGET_DISPOSITION_OVERWRITE. | 79 // TARGET_DISPOSITION_OVERWRITE. |
80 }; | 80 }; |
81 | 81 |
82 // Callback used with AcquireFileAndDeleteDownload(). | 82 // Callback used with AcquireFileAndDeleteDownload(). |
83 typedef base::Callback<void(const base::FilePath&)> AcquireFileCallback; | 83 typedef base::Callback<void(const base::FilePath&)> AcquireFileCallback; |
84 | 84 |
85 // Used to represent an invalid download ID. | 85 // Used to represent an invalid download ID. |
86 static const uint32_t kInvalidId; | 86 static const uint32_t kInvalidId; |
87 | 87 |
88 // Interface that observers of a particular download must implement in order | 88 // Interface that observers of a particular download must implement in order |
89 // to receive updates to the download's status. | 89 // to receive updates to the download's status. |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // renderer. | 387 // renderer. |
388 virtual WebContents* GetWebContents() const = 0; | 388 virtual WebContents* GetWebContents() const = 0; |
389 | 389 |
390 // External state transitions/setters ---------------------------------------- | 390 // External state transitions/setters ---------------------------------------- |
391 | 391 |
392 // TODO(rdsmith): These should all be removed; the download item should | 392 // TODO(rdsmith): These should all be removed; the download item should |
393 // control its own state transitions. | 393 // control its own state transitions. |
394 | 394 |
395 // Called if a check of the download contents was performed and the results of | 395 // Called if a check of the download contents was performed and the results of |
396 // the test are available. This should only be called after AllDataSaved() is | 396 // the test are available. This should only be called after AllDataSaved() is |
397 // true. | 397 // true. If |block_file| is true, then the download file should be blocked. |
398 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; | 398 virtual void OnContentCheckCompleted(DownloadDangerType danger_type, |
| 399 bool block_file) = 0; |
399 | 400 |
400 // Mark the download to be auto-opened when completed. | 401 // Mark the download to be auto-opened when completed. |
401 virtual void SetOpenWhenComplete(bool open) = 0; | 402 virtual void SetOpenWhenComplete(bool open) = 0; |
402 | 403 |
403 // Mark the download as having been opened (without actually opening it). | 404 // Mark the download as having been opened (without actually opening it). |
404 virtual void SetOpened(bool opened) = 0; | 405 virtual void SetOpened(bool opened) = 0; |
405 | 406 |
406 // Set a display name for the download that will be independent of the target | 407 // Set a display name for the download that will be independent of the target |
407 // filename. If |name| is not empty, then GetFileNameToReportUser() will | 408 // filename. If |name| is not empty, then GetFileNameToReportUser() will |
408 // return |name|. Has no effect on the final target filename. | 409 // return |name|. Has no effect on the final target filename. |
409 virtual void SetDisplayName(const base::FilePath& name) = 0; | 410 virtual void SetDisplayName(const base::FilePath& name) = 0; |
410 | 411 |
411 // Debug/testing ------------------------------------------------------------- | 412 // Debug/testing ------------------------------------------------------------- |
412 virtual std::string DebugString(bool verbose) const = 0; | 413 virtual std::string DebugString(bool verbose) const = 0; |
413 }; | 414 }; |
414 | 415 |
415 } // namespace content | 416 } // namespace content |
416 | 417 |
417 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 418 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |