| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 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/compiler_specific.h" |
| 12 #include "base/string16.h" | 13 #include "base/string16.h" |
| 13 | 14 |
| 14 class DownloadItem; | 15 class DownloadItem; |
| 15 class SavePackage; | 16 class SavePackage; |
| 16 | 17 |
| 17 // This class provides an interface for functions which have different behaviors | 18 // This class provides an interface for functions which have different behaviors |
| 18 // depending on the type of download. | 19 // depending on the type of download. |
| 19 class BaseDownloadItemModel { | 20 class BaseDownloadItemModel { |
| 20 public: | 21 public: |
| 21 explicit BaseDownloadItemModel(DownloadItem* download) | 22 explicit BaseDownloadItemModel(DownloadItem* download) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 | 37 |
| 37 // This class is a model class for DownloadItemView. It provides functionality | 38 // This class is a model class for DownloadItemView. It provides functionality |
| 38 // for canceling the downloading, and also the text for displaying downloading | 39 // for canceling the downloading, and also the text for displaying downloading |
| 39 // status. | 40 // status. |
| 40 class DownloadItemModel : public BaseDownloadItemModel { | 41 class DownloadItemModel : public BaseDownloadItemModel { |
| 41 public: | 42 public: |
| 42 explicit DownloadItemModel(DownloadItem* download); | 43 explicit DownloadItemModel(DownloadItem* download); |
| 43 virtual ~DownloadItemModel() { } | 44 virtual ~DownloadItemModel() { } |
| 44 | 45 |
| 45 // Cancel the downloading. | 46 // Cancel the downloading. |
| 46 virtual void CancelTask(); | 47 virtual void CancelTask() OVERRIDE; |
| 47 | 48 |
| 48 // Get downloading status text. | 49 // Get downloading status text. |
| 49 virtual string16 GetStatusText(); | 50 virtual string16 GetStatusText() OVERRIDE; |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 53 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 // This class is a model class for DownloadItemView. It provides cancel | 56 // This class is a model class for DownloadItemView. It provides cancel |
| 56 // functionality for saving page, and also the text for displaying saving | 57 // functionality for saving page, and also the text for displaying saving |
| 57 // status. | 58 // status. |
| 58 class SavePageModel : public BaseDownloadItemModel { | 59 class SavePageModel : public BaseDownloadItemModel { |
| 59 public: | 60 public: |
| 60 SavePageModel(SavePackage* save, DownloadItem* download); | 61 SavePageModel(SavePackage* save, DownloadItem* download); |
| 61 virtual ~SavePageModel() { } | 62 virtual ~SavePageModel() { } |
| 62 | 63 |
| 63 // Cancel the page saving. | 64 // Cancel the page saving. |
| 64 virtual void CancelTask(); | 65 virtual void CancelTask() OVERRIDE; |
| 65 | 66 |
| 66 // Get page saving status text. | 67 // Get page saving status text. |
| 67 virtual string16 GetStatusText(); | 68 virtual string16 GetStatusText() OVERRIDE; |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 // Saving page management. | 71 // Saving page management. |
| 71 SavePackage* save_; | 72 SavePackage* save_; |
| 72 | 73 |
| 73 DISALLOW_COPY_AND_ASSIGN(SavePageModel); | 74 DISALLOW_COPY_AND_ASSIGN(SavePageModel); |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 77 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
| OLD | NEW |