| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 bool IsMalicious() const; | 83 bool IsMalicious() const; |
| 84 | 84 |
| 85 // Returns |true| if this download should be displayed in the downloads shelf. | 85 // Returns |true| if this download should be displayed in the downloads shelf. |
| 86 bool ShouldShowInShelf() const; | 86 bool ShouldShowInShelf() const; |
| 87 | 87 |
| 88 // Change whether the download should be displayed on the downloads | 88 // Change whether the download should be displayed on the downloads |
| 89 // shelf. Setting this is only effective if the download hasn't already been | 89 // shelf. Setting this is only effective if the download hasn't already been |
| 90 // displayed in the shelf. | 90 // displayed in the shelf. |
| 91 void SetShouldShowInShelf(bool should_show); | 91 void SetShouldShowInShelf(bool should_show); |
| 92 | 92 |
| 93 // Returns |true| if the UI should be notified when the download is ready to |
| 94 // be presented in the UI. By default, this value is |false| and should be |
| 95 // changed explicitly using SetShouldNotifyUI(). Note that this is indpendent |
| 96 // of ShouldShowInShelf() since there might be actions other than showing in |
| 97 // the shelf that the UI must perform. |
| 98 bool ShouldNotifyUI() const; |
| 99 |
| 100 // Change what's returned by ShouldNotifyUI(). |
| 101 void SetShouldNotifyUI(bool should_notify); |
| 102 |
| 93 content::DownloadItem* download() { return download_; } | 103 content::DownloadItem* download() { return download_; } |
| 94 | 104 |
| 95 private: | 105 private: |
| 96 // Returns a string representations of the current download progress sizes. If | 106 // Returns a string representations of the current download progress sizes. If |
| 97 // the total size of the download is known, this string looks like: "100/200 | 107 // the total size of the download is known, this string looks like: "100/200 |
| 98 // MB" where the numerator is the transferred size and the denominator is the | 108 // MB" where the numerator is the transferred size and the denominator is the |
| 99 // total size. If the total isn't known, returns the transferred size as a | 109 // total size. If the total isn't known, returns the transferred size as a |
| 100 // string (e.g.: "100 MB"). | 110 // string (e.g.: "100 MB"). |
| 101 string16 GetProgressSizesString() const; | 111 string16 GetProgressSizesString() const; |
| 102 | 112 |
| 103 // Returns a string indicating the status of an in-progress download. | 113 // Returns a string indicating the status of an in-progress download. |
| 104 string16 GetInProgressStatusString() const; | 114 string16 GetInProgressStatusString() const; |
| 105 | 115 |
| 106 // The DownloadItem that this model represents. Note that DownloadItemModel | 116 // The DownloadItem that this model represents. Note that DownloadItemModel |
| 107 // itself shouldn't maintain any state since there can be more than one | 117 // itself shouldn't maintain any state since there can be more than one |
| 108 // DownloadItemModel in use with the same DownloadItem. | 118 // DownloadItemModel in use with the same DownloadItem. |
| 109 content::DownloadItem* download_; | 119 content::DownloadItem* download_; |
| 110 | 120 |
| 111 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 121 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
| 112 }; | 122 }; |
| 113 | 123 |
| 114 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 124 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
| OLD | NEW |