| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 bool ShouldPreferOpeningInBrowser() const; | 135 bool ShouldPreferOpeningInBrowser() const; |
| 136 | 136 |
| 137 // Change what's returned by ShouldPreferOpeningInBrowser to |preference|. | 137 // Change what's returned by ShouldPreferOpeningInBrowser to |preference|. |
| 138 void SetShouldPreferOpeningInBrowser(bool preference); | 138 void SetShouldPreferOpeningInBrowser(bool preference); |
| 139 | 139 |
| 140 // Open the download using the platform handler for the download. The behavior | 140 // Open the download using the platform handler for the download. The behavior |
| 141 // of this method will be different from DownloadItem::OpenDownload() if | 141 // of this method will be different from DownloadItem::OpenDownload() if |
| 142 // ShouldPreferOpeningInBrowser(). | 142 // ShouldPreferOpeningInBrowser(). |
| 143 void OpenUsingPlatformHandler(); | 143 void OpenUsingPlatformHandler(); |
| 144 | 144 |
| 145 // Changes what is returned by GetUserActed(). The download shelf uses this to |
| 146 // mark remaining downloads as acted when user manually closes the shelf. |
| 147 void SetUserActed(bool acted); |
| 148 |
| 149 // Returns |true| if user acted on download item (shown it in shell or |
| 150 // opened). Download shelf checks this to autohide. |
| 151 bool GetUserActed() const; |
| 152 |
| 145 content::DownloadItem* download() { return download_; } | 153 content::DownloadItem* download() { return download_; } |
| 146 | 154 |
| 147 private: | 155 private: |
| 148 // Returns a string representations of the current download progress sizes. If | 156 // Returns a string representations of the current download progress sizes. If |
| 149 // the total size of the download is known, this string looks like: "100/200 | 157 // the total size of the download is known, this string looks like: "100/200 |
| 150 // MB" where the numerator is the transferred size and the denominator is the | 158 // MB" where the numerator is the transferred size and the denominator is the |
| 151 // total size. If the total isn't known, returns the transferred size as a | 159 // total size. If the total isn't known, returns the transferred size as a |
| 152 // string (e.g.: "100 MB"). | 160 // string (e.g.: "100 MB"). |
| 153 base::string16 GetProgressSizesString() const; | 161 base::string16 GetProgressSizesString() const; |
| 154 | 162 |
| 155 // Returns a string indicating the status of an in-progress download. | 163 // Returns a string indicating the status of an in-progress download. |
| 156 base::string16 GetInProgressStatusString() const; | 164 base::string16 GetInProgressStatusString() const; |
| 157 | 165 |
| 158 // The DownloadItem that this model represents. Note that DownloadItemModel | 166 // The DownloadItem that this model represents. Note that DownloadItemModel |
| 159 // itself shouldn't maintain any state since there can be more than one | 167 // itself shouldn't maintain any state since there can be more than one |
| 160 // DownloadItemModel in use with the same DownloadItem. | 168 // DownloadItemModel in use with the same DownloadItem. |
| 161 content::DownloadItem* download_; | 169 content::DownloadItem* download_; |
| 162 | 170 |
| 163 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 171 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
| 164 }; | 172 }; |
| 165 | 173 |
| 166 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 174 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
| OLD | NEW |