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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Returns |true| if the UI should be notified when the download is ready to | 119 // Returns |true| if the UI should be notified when the download is ready to |
120 // be presented in the UI. By default, this value is |false| and should be | 120 // be presented in the UI. By default, this value is |false| and should be |
121 // changed explicitly using SetShouldNotifyUI(). Note that this is indpendent | 121 // changed explicitly using SetShouldNotifyUI(). Note that this is indpendent |
122 // of ShouldShowInShelf() since there might be actions other than showing in | 122 // of ShouldShowInShelf() since there might be actions other than showing in |
123 // the shelf that the UI must perform. | 123 // the shelf that the UI must perform. |
124 bool ShouldNotifyUI() const; | 124 bool ShouldNotifyUI() const; |
125 | 125 |
126 // Change what's returned by ShouldNotifyUI(). | 126 // Change what's returned by ShouldNotifyUI(). |
127 void SetShouldNotifyUI(bool should_notify); | 127 void SetShouldNotifyUI(bool should_notify); |
128 | 128 |
| 129 // Returns |true| if opening in the browser is preferred for this download. If |
| 130 // |false|, the download should be opened with the system default application. |
| 131 bool ShouldPreferOpeningInBrowser() const; |
| 132 |
| 133 // Change what's returned by ShouldPreferOpeningInBrowser to |preference|. |
| 134 void SetShouldPreferOpeningInBrowser(bool preference); |
| 135 |
| 136 // Open the download using the platform handler for the download. The behavior |
| 137 // of this method will be different from DownloadItem::OpenDownload() if |
| 138 // ShouldPreferOpeningInBrowser(). |
| 139 void OpenUsingPlatformHandler(); |
| 140 |
129 content::DownloadItem* download() { return download_; } | 141 content::DownloadItem* download() { return download_; } |
130 | 142 |
131 private: | 143 private: |
132 // Returns a string representations of the current download progress sizes. If | 144 // Returns a string representations of the current download progress sizes. If |
133 // the total size of the download is known, this string looks like: "100/200 | 145 // the total size of the download is known, this string looks like: "100/200 |
134 // MB" where the numerator is the transferred size and the denominator is the | 146 // MB" where the numerator is the transferred size and the denominator is the |
135 // total size. If the total isn't known, returns the transferred size as a | 147 // total size. If the total isn't known, returns the transferred size as a |
136 // string (e.g.: "100 MB"). | 148 // string (e.g.: "100 MB"). |
137 string16 GetProgressSizesString() const; | 149 string16 GetProgressSizesString() const; |
138 | 150 |
139 // Returns a string indicating the status of an in-progress download. | 151 // Returns a string indicating the status of an in-progress download. |
140 string16 GetInProgressStatusString() const; | 152 string16 GetInProgressStatusString() const; |
141 | 153 |
142 // The DownloadItem that this model represents. Note that DownloadItemModel | 154 // The DownloadItem that this model represents. Note that DownloadItemModel |
143 // itself shouldn't maintain any state since there can be more than one | 155 // itself shouldn't maintain any state since there can be more than one |
144 // DownloadItemModel in use with the same DownloadItem. | 156 // DownloadItemModel in use with the same DownloadItem. |
145 content::DownloadItem* download_; | 157 content::DownloadItem* download_; |
146 | 158 |
147 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 159 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
148 }; | 160 }; |
149 | 161 |
150 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 162 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
OLD | NEW |