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 | |
141 content::DownloadItem* download() { return download_; } | 129 content::DownloadItem* download() { return download_; } |
142 | 130 |
143 private: | 131 private: |
144 // Returns a string representations of the current download progress sizes. If | 132 // Returns a string representations of the current download progress sizes. If |
145 // the total size of the download is known, this string looks like: "100/200 | 133 // the total size of the download is known, this string looks like: "100/200 |
146 // MB" where the numerator is the transferred size and the denominator is the | 134 // MB" where the numerator is the transferred size and the denominator is the |
147 // total size. If the total isn't known, returns the transferred size as a | 135 // total size. If the total isn't known, returns the transferred size as a |
148 // string (e.g.: "100 MB"). | 136 // string (e.g.: "100 MB"). |
149 string16 GetProgressSizesString() const; | 137 string16 GetProgressSizesString() const; |
150 | 138 |
151 // Returns a string indicating the status of an in-progress download. | 139 // Returns a string indicating the status of an in-progress download. |
152 string16 GetInProgressStatusString() const; | 140 string16 GetInProgressStatusString() const; |
153 | 141 |
154 // The DownloadItem that this model represents. Note that DownloadItemModel | 142 // The DownloadItem that this model represents. Note that DownloadItemModel |
155 // itself shouldn't maintain any state since there can be more than one | 143 // itself shouldn't maintain any state since there can be more than one |
156 // DownloadItemModel in use with the same DownloadItem. | 144 // DownloadItemModel in use with the same DownloadItem. |
157 content::DownloadItem* download_; | 145 content::DownloadItem* download_; |
158 | 146 |
159 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 147 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
160 }; | 148 }; |
161 | 149 |
162 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 150 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
OLD | NEW |