| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 bool ShouldShowDownloadStartedAnimation() const; | 98 bool ShouldShowDownloadStartedAnimation() const; |
| 99 | 99 |
| 100 // Returns |true| if this download should be displayed in the downloads shelf. | 100 // Returns |true| if this download should be displayed in the downloads shelf. |
| 101 bool ShouldShowInShelf() const; | 101 bool ShouldShowInShelf() const; |
| 102 | 102 |
| 103 // Change whether the download should be displayed on the downloads | 103 // Change whether the download should be displayed on the downloads |
| 104 // shelf. Setting this is only effective if the download hasn't already been | 104 // shelf. Setting this is only effective if the download hasn't already been |
| 105 // displayed in the shelf. | 105 // displayed in the shelf. |
| 106 void SetShouldShowInShelf(bool should_show); | 106 void SetShouldShowInShelf(bool should_show); |
| 107 | 107 |
| 108 // Returns |true| if the UI should be notified when the download is ready to |
| 109 // be presented in the UI. By default, this value is |false| and should be |
| 110 // changed explicitly using SetShouldNotifyUI(). Note that this is indpendent |
| 111 // of ShouldShowInShelf() since there might be actions other than showing in |
| 112 // the shelf that the UI must perform. |
| 113 bool ShouldNotifyUI() const; |
| 114 |
| 115 // Change what's returned by ShouldNotifyUI(). |
| 116 void SetShouldNotifyUI(bool should_notify); |
| 117 |
| 108 content::DownloadItem* download() { return download_; } | 118 content::DownloadItem* download() { return download_; } |
| 109 | 119 |
| 110 private: | 120 private: |
| 111 // Returns a string representations of the current download progress sizes. If | 121 // Returns a string representations of the current download progress sizes. If |
| 112 // the total size of the download is known, this string looks like: "100/200 | 122 // the total size of the download is known, this string looks like: "100/200 |
| 113 // MB" where the numerator is the transferred size and the denominator is the | 123 // MB" where the numerator is the transferred size and the denominator is the |
| 114 // total size. If the total isn't known, returns the transferred size as a | 124 // total size. If the total isn't known, returns the transferred size as a |
| 115 // string (e.g.: "100 MB"). | 125 // string (e.g.: "100 MB"). |
| 116 string16 GetProgressSizesString() const; | 126 string16 GetProgressSizesString() const; |
| 117 | 127 |
| 118 // Returns a string indicating the status of an in-progress download. | 128 // Returns a string indicating the status of an in-progress download. |
| 119 string16 GetInProgressStatusString() const; | 129 string16 GetInProgressStatusString() const; |
| 120 | 130 |
| 121 // The DownloadItem that this model represents. Note that DownloadItemModel | 131 // The DownloadItem that this model represents. Note that DownloadItemModel |
| 122 // itself shouldn't maintain any state since there can be more than one | 132 // itself shouldn't maintain any state since there can be more than one |
| 123 // DownloadItemModel in use with the same DownloadItem. | 133 // DownloadItemModel in use with the same DownloadItem. |
| 124 content::DownloadItem* download_; | 134 content::DownloadItem* download_; |
| 125 | 135 |
| 126 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 136 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
| 127 }; | 137 }; |
| 128 | 138 |
| 129 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 139 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
| OLD | NEW |