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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Change what's returned by WasUINotified(). | 130 // Change what's returned by WasUINotified(). |
131 void SetWasUINotified(bool should_notify); | 131 void SetWasUINotified(bool should_notify); |
132 | 132 |
133 // Returns |true| if opening in the browser is preferred for this download. If | 133 // Returns |true| if opening in the browser is preferred for this download. If |
134 // |false|, the download should be opened with the system default application. | 134 // |false|, the download should be opened with the system default application. |
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 // Mark that the download should be considered dangerous based on the file |
| 141 // type. This value may differ from the download's danger type in cases where |
| 142 // the SafeBrowsing service hasn't returned a verdict about the download. If |
| 143 // SafeBrowsing fails to return a decision, then the download should be |
| 144 // considered dangerous based on this flag. Defaults to false. |
| 145 bool IsDangerousFileBasedOnType() const; |
| 146 |
| 147 // Change what's returned by IsDangerousFileBasedOnType(). |
| 148 void SetIsDangerousFileBasedOnType(bool dangerous); |
| 149 |
140 // Open the download using the platform handler for the download. The behavior | 150 // Open the download using the platform handler for the download. The behavior |
141 // of this method will be different from DownloadItem::OpenDownload() if | 151 // of this method will be different from DownloadItem::OpenDownload() if |
142 // ShouldPreferOpeningInBrowser(). | 152 // ShouldPreferOpeningInBrowser(). |
143 void OpenUsingPlatformHandler(); | 153 void OpenUsingPlatformHandler(); |
144 | 154 |
145 content::DownloadItem* download() { return download_; } | 155 content::DownloadItem* download() { return download_; } |
146 | 156 |
147 private: | 157 private: |
148 // Returns a string representations of the current download progress sizes. If | 158 // 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 | 159 // 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 | 160 // 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 | 161 // total size. If the total isn't known, returns the transferred size as a |
152 // string (e.g.: "100 MB"). | 162 // string (e.g.: "100 MB"). |
153 base::string16 GetProgressSizesString() const; | 163 base::string16 GetProgressSizesString() const; |
154 | 164 |
155 // Returns a string indicating the status of an in-progress download. | 165 // Returns a string indicating the status of an in-progress download. |
156 base::string16 GetInProgressStatusString() const; | 166 base::string16 GetInProgressStatusString() const; |
157 | 167 |
158 // The DownloadItem that this model represents. Note that DownloadItemModel | 168 // The DownloadItem that this model represents. Note that DownloadItemModel |
159 // itself shouldn't maintain any state since there can be more than one | 169 // itself shouldn't maintain any state since there can be more than one |
160 // DownloadItemModel in use with the same DownloadItem. | 170 // DownloadItemModel in use with the same DownloadItem. |
161 content::DownloadItem* download_; | 171 content::DownloadItem* download_; |
162 | 172 |
163 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); | 173 DISALLOW_COPY_AND_ASSIGN(DownloadItemModel); |
164 }; | 174 }; |
165 | 175 |
166 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ | 176 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_MODEL_H_ |
OLD | NEW |