Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1611)

Unified Diff: chrome/browser/download/download_item_model.h

Issue 9569011: Refactor dangerous download warning text generation into DownloadItemModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use ui::ElideText() Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/download/download_item_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | chrome/browser/download/download_item_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698