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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // such, the caller is expected to ensure that the |download| passed into the | 28 // such, the caller is expected to ensure that the |download| passed into the |
29 // constructor outlives this |DownloadItemModel|. In addition, multiple | 29 // constructor outlives this |DownloadItemModel|. In addition, multiple |
30 // DownloadItemModel objects could be wrapping the same DownloadItem. | 30 // DownloadItemModel objects could be wrapping the same DownloadItem. |
31 class DownloadItemModel { | 31 class DownloadItemModel { |
32 public: | 32 public: |
33 // Constructs a DownloadItemModel. The caller must ensure that |download| | 33 // Constructs a DownloadItemModel. The caller must ensure that |download| |
34 // outlives this object. | 34 // outlives this object. |
35 explicit DownloadItemModel(content::DownloadItem* download); | 35 explicit DownloadItemModel(content::DownloadItem* download); |
36 ~DownloadItemModel(); | 36 ~DownloadItemModel(); |
37 | 37 |
38 // Cancel the task corresponding to the item. | |
39 void CancelTask(); | |
40 | |
41 // Returns a long descriptive string for a download that's in the INTERRUPTED | 38 // Returns a long descriptive string for a download that's in the INTERRUPTED |
42 // state. For other downloads, the returned string will be empty. | 39 // state. For other downloads, the returned string will be empty. |
43 string16 GetInterruptReasonText() const; | 40 string16 GetInterruptReasonText() const; |
44 | 41 |
45 // Returns a short one-line status string for the download. | 42 // Returns a short one-line status string for the download. |
46 string16 GetStatusText() const; | 43 string16 GetStatusText() const; |
47 | 44 |
48 // Returns a string suitable for use as a tooltip. For a regular download, the | 45 // Returns a string suitable for use as a tooltip. For a regular download, the |
49 // tooltip is the filename. For an interrupted download, the string states the | 46 // tooltip is the filename. For an interrupted download, the string states the |
50 // filename and a short description of the reason for interruption. For | 47 // filename and a short description of the reason for interruption. For |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 102 |
106 // The DownloadItem that this model represents. Note that DownloadItemModel | 103 // The DownloadItem that this model represents. Note that DownloadItemModel |
107 // itself shouldn't maintain any state since there can be more than one | 104 // itself shouldn't maintain any state since there can be more than one |
108 // DownloadItemModel in use with the same DownloadItem. | 105 // DownloadItemModel in use with the same DownloadItem. |
109 content::DownloadItem* download_; | 106 content::DownloadItem* download_; |
110 | 107 |
111 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 108 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
112 }; | 109 }; |
113 | 110 |
114 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 111 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
OLD | NEW |