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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 // This class is an abstraction for common UI tasks associated with a download. | 25 // This class is an abstraction for common UI tasks associated with a download. |
26 class BaseDownloadItemModel { | 26 class BaseDownloadItemModel { |
27 public: | 27 public: |
28 explicit BaseDownloadItemModel(content::DownloadItem* download) | 28 explicit BaseDownloadItemModel(content::DownloadItem* download) |
29 : download_(download) { } | 29 : download_(download) { } |
30 virtual ~BaseDownloadItemModel() { } | 30 virtual ~BaseDownloadItemModel() { } |
31 | 31 |
32 // Cancel the task corresponding to the item. | 32 // Cancel the task corresponding to the item. |
33 virtual void CancelTask() = 0; | 33 virtual void CancelTask() = 0; |
34 | 34 |
35 // Get the progress text to display. | |
asanka
2012/04/04 17:27:04
Consider adding some example text here.
ahendrickson
2012/04/04 17:49:32
Done.
| |
36 virtual string16 GetProgressText() = 0; | |
37 | |
35 // Get the status text to display. | 38 // Get the status text to display. |
36 virtual string16 GetStatusText() = 0; | 39 virtual string16 GetStatusText() = 0; |
37 | 40 |
38 // Rough percent complete. Returns -1 if the progress is unknown. | 41 // Rough percent complete. Returns -1 if the progress is unknown. |
39 virtual int PercentComplete() const = 0; | 42 virtual int PercentComplete() const = 0; |
40 | 43 |
41 // Get the warning text to display for a dangerous download. The |base_width| | 44 // Get the warning text to display for a dangerous download. The |base_width| |
42 // is the maximum width of an embedded filename (if there is one). The metrics | 45 // is the maximum width of an embedded filename (if there is one). The metrics |
43 // for the filename will be based on |font|. Should only be called if | 46 // for the filename will be based on |font|. Should only be called if |
44 // IsDangerous() is true. | 47 // IsDangerous() is true. |
(...skipping 22 matching lines...) Expand all Loading... | |
67 }; | 70 }; |
68 | 71 |
69 // Concrete implementation of BaseDownloadItemModel. | 72 // Concrete implementation of BaseDownloadItemModel. |
70 class DownloadItemModel : public BaseDownloadItemModel { | 73 class DownloadItemModel : public BaseDownloadItemModel { |
71 public: | 74 public: |
72 explicit DownloadItemModel(content::DownloadItem* download); | 75 explicit DownloadItemModel(content::DownloadItem* download); |
73 virtual ~DownloadItemModel() { } | 76 virtual ~DownloadItemModel() { } |
74 | 77 |
75 // BaseDownloadItemModel | 78 // BaseDownloadItemModel |
76 virtual void CancelTask() OVERRIDE; | 79 virtual void CancelTask() OVERRIDE; |
80 virtual string16 GetProgressText() OVERRIDE; | |
77 virtual string16 GetStatusText() OVERRIDE; | 81 virtual string16 GetStatusText() OVERRIDE; |
78 virtual int PercentComplete() const OVERRIDE; | 82 virtual int PercentComplete() const OVERRIDE; |
79 virtual string16 GetWarningText(const gfx::Font& font, | 83 virtual string16 GetWarningText(const gfx::Font& font, |
80 int base_width) OVERRIDE; | 84 int base_width) OVERRIDE; |
81 virtual string16 GetWarningConfirmButtonText() OVERRIDE; | 85 virtual string16 GetWarningConfirmButtonText() OVERRIDE; |
82 virtual bool IsMalicious() OVERRIDE; | 86 virtual bool IsMalicious() OVERRIDE; |
83 virtual bool IsDangerous() OVERRIDE; | 87 virtual bool IsDangerous() OVERRIDE; |
84 | 88 |
85 private: | 89 private: |
90 bool GetStatusData(int64* size_return, | |
sky
2012/04/04 16:55:34
Add a description of this, including what the retu
ahendrickson
2012/04/04 17:49:32
Done.
| |
91 int64* total_return, | |
92 string16* simple_size_return, | |
93 string16* simple_total_return); | |
94 | |
86 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 95 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
87 }; | 96 }; |
88 | 97 |
89 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 98 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
OLD | NEW |