summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_item_model.h
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-23 23:54:18 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-23 23:54:18 +0000
commitb47da7280c58ec3467a5f48c409db08072be8989 (patch)
tree29547400046f2027abe2c24732ad279280167be0 /chrome/browser/download/download_item_model.h
parente134a72dd5bc286a4ce3007817f53ff62d785055 (diff)
downloadchromium_src-b47da7280c58ec3467a5f48c409db08072be8989.zip
chromium_src-b47da7280c58ec3467a5f48c409db08072be8989.tar.gz
chromium_src-b47da7280c58ec3467a5f48c409db08072be8989.tar.bz2
Refactor BaseDownloadItemModel and its inheritors.
* Move BaseDownloadItemModel to download_item_model.h. Previously it was in a windows-specific file in chrome/browser/views/. * Move SavePageModel to download_item_model.{cc,h}. Review URL: http://codereview.chromium.org/28033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_item_model.h')
-rw-r--r--chrome/browser/download/download_item_model.h50
1 files changed, 44 insertions, 6 deletions
diff --git a/chrome/browser/download/download_item_model.h b/chrome/browser/download/download_item_model.h
index edeac1c..8c7fe83 100644
--- a/chrome/browser/download/download_item_model.h
+++ b/chrome/browser/download/download_item_model.h
@@ -2,17 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H__
-#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H__
+#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_
+#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_
-#include "chrome/browser/views/download_item_view.h"
+#include <string>
+
+#include "base/basictypes.h"
class DownloadItem;
+class SavePackage;
+
+// This class provides an interface for functions which have different behaviors
+// depending on the type of download.
+class BaseDownloadItemModel {
+ public:
+ // Cancel the task corresponding to the item.
+ virtual void CancelTask() = 0;
+
+ // Get the status text to display.
+ virtual std::wstring GetStatusText() = 0;
+};
// This class is a model class for DownloadItemView. It provides functionality
// for canceling the downloading, and also the text for displaying downloading
// status.
-class DownloadItemModel : public DownloadItemView::BaseDownloadItemModel {
+class DownloadItemModel : public BaseDownloadItemModel {
public:
DownloadItemModel(DownloadItem* download);
virtual ~DownloadItemModel() { }
@@ -27,8 +41,32 @@ class DownloadItemModel : public DownloadItemView::BaseDownloadItemModel {
// We query this item for status information.
DownloadItem* download_;
- DISALLOW_EVIL_CONSTRUCTORS(DownloadItemModel);
+ DISALLOW_COPY_AND_ASSIGN(DownloadItemModel);
+};
+
+// This class is a model class for DownloadItemView. It provides cancel
+// functionality for saving page, and also the text for displaying saving
+// status.
+class SavePageModel : public BaseDownloadItemModel {
+ public:
+ SavePageModel(SavePackage* save, DownloadItem* download);
+ virtual ~SavePageModel() { }
+
+ // Cancel the page saving.
+ virtual void CancelTask();
+
+ // Get page saving status text.
+ virtual std::wstring GetStatusText();
+
+ private:
+ // Saving page management.
+ SavePackage* save_;
+
+ // A fake download item for saving page use.
+ DownloadItem* download_;
+
+ DISALLOW_COPY_AND_ASSIGN(SavePageModel);
};
-#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H__
+#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_