OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
Evan Stade
2010/12/28 21:23:09
year
Avi (use Gerrit)
2010/12/28 21:35:44
Done.
| |
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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/string16.h" | |
12 | 13 |
13 class DownloadItem; | 14 class DownloadItem; |
14 class SavePackage; | 15 class SavePackage; |
15 | 16 |
16 // This class provides an interface for functions which have different behaviors | 17 // This class provides an interface for functions which have different behaviors |
17 // depending on the type of download. | 18 // depending on the type of download. |
18 class BaseDownloadItemModel { | 19 class BaseDownloadItemModel { |
19 public: | 20 public: |
20 explicit BaseDownloadItemModel(DownloadItem* download) | 21 explicit BaseDownloadItemModel(DownloadItem* download) |
21 : download_(download) { } | 22 : download_(download) { } |
22 virtual ~BaseDownloadItemModel() { } | 23 virtual ~BaseDownloadItemModel() { } |
23 | 24 |
24 // Cancel the task corresponding to the item. | 25 // Cancel the task corresponding to the item. |
25 virtual void CancelTask() = 0; | 26 virtual void CancelTask() = 0; |
26 | 27 |
27 // Get the status text to display. | 28 // Get the status text to display. |
28 virtual std::wstring GetStatusText() = 0; | 29 virtual string16 GetStatusText() = 0; |
29 | 30 |
30 DownloadItem* download() { return download_; } | 31 DownloadItem* download() { return download_; } |
31 | 32 |
32 protected: | 33 protected: |
33 DownloadItem* download_; | 34 DownloadItem* download_; |
34 }; | 35 }; |
35 | 36 |
36 // This class is a model class for DownloadItemView. It provides functionality | 37 // This class is a model class for DownloadItemView. It provides functionality |
37 // for canceling the downloading, and also the text for displaying downloading | 38 // for canceling the downloading, and also the text for displaying downloading |
38 // status. | 39 // status. |
39 class DownloadItemModel : public BaseDownloadItemModel { | 40 class DownloadItemModel : public BaseDownloadItemModel { |
40 public: | 41 public: |
41 explicit DownloadItemModel(DownloadItem* download); | 42 explicit DownloadItemModel(DownloadItem* download); |
42 virtual ~DownloadItemModel() { } | 43 virtual ~DownloadItemModel() { } |
43 | 44 |
44 // Cancel the downloading. | 45 // Cancel the downloading. |
45 virtual void CancelTask(); | 46 virtual void CancelTask(); |
46 | 47 |
47 // Get downloading status text. | 48 // Get downloading status text. |
48 virtual std::wstring GetStatusText(); | 49 virtual string16 GetStatusText(); |
49 | 50 |
50 private: | 51 private: |
51 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 52 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
52 }; | 53 }; |
53 | 54 |
54 // This class is a model class for DownloadItemView. It provides cancel | 55 // This class is a model class for DownloadItemView. It provides cancel |
55 // functionality for saving page, and also the text for displaying saving | 56 // functionality for saving page, and also the text for displaying saving |
56 // status. | 57 // status. |
57 class SavePageModel : public BaseDownloadItemModel { | 58 class SavePageModel : public BaseDownloadItemModel { |
58 public: | 59 public: |
59 SavePageModel(SavePackage* save, DownloadItem* download); | 60 SavePageModel(SavePackage* save, DownloadItem* download); |
60 virtual ~SavePageModel() { } | 61 virtual ~SavePageModel() { } |
61 | 62 |
62 // Cancel the page saving. | 63 // Cancel the page saving. |
63 virtual void CancelTask(); | 64 virtual void CancelTask(); |
64 | 65 |
65 // Get page saving status text. | 66 // Get page saving status text. |
66 virtual std::wstring GetStatusText(); | 67 virtual string16 GetStatusText(); |
67 | 68 |
68 private: | 69 private: |
69 // Saving page management. | 70 // Saving page management. |
70 SavePackage* save_; | 71 SavePackage* save_; |
71 | 72 |
72 DISALLOW_COPY_AND_ASSIGN(SavePageModel); | 73 DISALLOW_COPY_AND_ASSIGN(SavePageModel); |
73 }; | 74 }; |
74 | 75 |
75 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 76 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
OLD | NEW |