Chromium Code Reviews| Index: chrome/browser/download/download_item_model.h |
| diff --git a/chrome/browser/download/download_item_model.h b/chrome/browser/download/download_item_model.h |
| index db81467280090dfde8fba954539d169c24d26d5d..5b79ed2cc7087abfa4fdca4978dcdbb23cd1fe5e 100644 |
| --- a/chrome/browser/download/download_item_model.h |
| +++ b/chrome/browser/download/download_item_model.h |
| @@ -18,8 +18,11 @@ namespace content { |
| class DownloadItem; |
| } |
| -// This class provides an interface for functions which have different behaviors |
| -// depending on the type of download. |
| +namespace gfx { |
| +class Font; |
| +} |
| + |
| +// This class is an abstraction for common UI tasks associated with a download. |
| class BaseDownloadItemModel { |
| public: |
| explicit BaseDownloadItemModel(content::DownloadItem* download) |
| @@ -32,6 +35,17 @@ class BaseDownloadItemModel { |
| // Get the status text to display. |
| virtual string16 GetStatusText() = 0; |
| + // Get the warning text to display for a dangerous download. The |base_width| |
| + // is the maximum width of an embedded filename (if there is one). The metrics |
| + // for the filename will be based on |font|. |
| + virtual string16 GetWarningText(const gfx::Font& font, int base_width) = 0; |
|
Randy Smith (Not in Mondays)
2012/03/01 21:34:45
When is this valid to call, in terms of IsDangerou
asanka
2012/03/01 21:55:33
It's only valid to call when IsDangerous() is true
|
| + |
| + // Is this considered a malicious download? |
| + virtual bool IsMalicious() = 0; |
| + |
| + // Is this considered a dangerous download? |
| + virtual bool IsDangerous() = 0; |
| + |
| content::DownloadItem* download() { return download_; } |
| protected: |
| @@ -46,11 +60,13 @@ class DownloadItemModel : public BaseDownloadItemModel { |
| explicit DownloadItemModel(content::DownloadItem* download); |
| virtual ~DownloadItemModel() { } |
| - // Cancel the downloading. |
| + // BaseDownloadItemModel |
| virtual void CancelTask() OVERRIDE; |
| - |
| - // Get downloading status text. |
| virtual string16 GetStatusText() OVERRIDE; |
| + virtual string16 GetWarningText(const gfx::Font& font, |
| + int base_width) OVERRIDE; |
| + virtual bool IsMalicious() OVERRIDE; |
| + virtual bool IsDangerous() OVERRIDE; |
| private: |
| DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |