blob: a65863633c401a32ebcc0b165bd039ad73d36da7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// 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_
#pragma once
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/string16.h"
class SavePackage;
namespace content {
class DownloadItem;
}
// This class provides an interface for functions which have different behaviors
// depending on the type of download.
class BaseDownloadItemModel {
public:
explicit BaseDownloadItemModel(content::DownloadItem* download)
: download_(download) { }
virtual ~BaseDownloadItemModel() { }
// Cancel the task corresponding to the item.
virtual void CancelTask() = 0;
// Get the status text to display.
virtual string16 GetStatusText() = 0;
content::DownloadItem* download() { return download_; }
protected:
content::DownloadItem* download_;
};
// 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 BaseDownloadItemModel {
public:
explicit DownloadItemModel(content::DownloadItem* download);
virtual ~DownloadItemModel() { }
// Cancel the downloading.
virtual void CancelTask() OVERRIDE;
// Get downloading status text.
virtual string16 GetStatusText() OVERRIDE;
private:
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, content::DownloadItem* download);
virtual ~SavePageModel() { }
// Cancel the page saving.
virtual void CancelTask() OVERRIDE;
// Get page saving status text.
virtual string16 GetStatusText() OVERRIDE;
private:
// Saving page management.
SavePackage* save_;
DISALLOW_COPY_AND_ASSIGN(SavePageModel);
};
#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_
|