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 #include "chrome/browser/ui/views/download/download_item_view.h" | 5 #include "chrome/browser/ui/views/download/download_item_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // DownloadObserver interface. | 250 // DownloadObserver interface. |
251 | 251 |
252 // Update the progress graphic on the icon and our text status label | 252 // Update the progress graphic on the icon and our text status label |
253 // to reflect our current bytes downloaded, time remaining. | 253 // to reflect our current bytes downloaded, time remaining. |
254 void DownloadItemView::OnDownloadUpdated(DownloadItem* download) { | 254 void DownloadItemView::OnDownloadUpdated(DownloadItem* download) { |
255 DCHECK(download == download_); | 255 DCHECK(download == download_); |
256 | 256 |
257 string16 old_tip = tooltip_text_; | 257 string16 old_tip = tooltip_text_; |
258 content::DownloadInterruptReason reason = download_->GetLastReason(); | 258 content::DownloadInterruptReason reason = download_->GetLastReason(); |
259 | 259 |
| 260 tooltip_text_ = download_->GetFileNameToReportUser().LossyDisplayName(); |
| 261 |
260 if ((download_->GetState() == DownloadItem::INTERRUPTED) && | 262 if ((download_->GetState() == DownloadItem::INTERRUPTED) && |
261 (reason != content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED)) { | 263 (reason != content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED)) { |
262 // Use two lines: The file name, and the message. | 264 // Use two lines: The file name, and the status. |
263 tooltip_text_ = download_->GetFileNameToReportUser().LossyDisplayName(); | |
264 tooltip_text_ += ASCIIToUTF16("\n"); | 265 tooltip_text_ += ASCIIToUTF16("\n"); |
265 // The message is localized. | 266 // The status is localized. |
266 tooltip_text_ += DownloadItemModel::InterruptReasonMessage(reason); | 267 tooltip_text_ += DownloadItemModel::InterruptReasonStatusMessage(reason); |
267 } else { | |
268 tooltip_text_ = download_->GetFileNameToReportUser().LossyDisplayName(); | |
269 } | 268 } |
270 | 269 |
271 if (IsShowingWarningDialog() && !model_->IsDangerous()) { | 270 if (IsShowingWarningDialog() && !model_->IsDangerous()) { |
272 // We have been approved. | 271 // We have been approved. |
273 ClearWarningDialog(); | 272 ClearWarningDialog(); |
274 } else if (!IsShowingWarningDialog() && model_->IsDangerous()) { | 273 } else if (!IsShowingWarningDialog() && model_->IsDangerous()) { |
275 ShowWarningDialog(); | 274 ShowWarningDialog(); |
276 // Force the shelf to layout again as our size has changed. | 275 // Force the shelf to layout again as our size has changed. |
277 parent_->Layout(); | 276 parent_->Layout(); |
278 SchedulePaint(); | 277 SchedulePaint(); |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 // Drop down button is glued to the left of the download shelf. | 1187 // Drop down button is glued to the left of the download shelf. |
1189 drop_down_x_left_ = 0; | 1188 drop_down_x_left_ = 0; |
1190 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); | 1189 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); |
1191 } else { | 1190 } else { |
1192 // Drop down button is glued to the right of the download shelf. | 1191 // Drop down button is glued to the right of the download shelf. |
1193 drop_down_x_left_ = | 1192 drop_down_x_left_ = |
1194 size.width() - normal_drop_down_image_set_.top->width(); | 1193 size.width() - normal_drop_down_image_set_.top->width(); |
1195 drop_down_x_right_ = size.width(); | 1194 drop_down_x_right_ = size.width(); |
1196 } | 1195 } |
1197 } | 1196 } |
OLD | NEW |