| 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)) { |
| 264 string16 new_line = ASCIIToUTF16("\n"); |
| 262 // Use two lines: The file name, and the message. | 265 // Use two lines: The file name, and the message. |
| 263 tooltip_text_ = download_->GetFileNameToReportUser().LossyDisplayName(); | 266 tooltip_text_ += new_line; |
| 264 tooltip_text_ += ASCIIToUTF16("\n"); | |
| 265 // The message is localized. | 267 // The message is localized. |
| 266 tooltip_text_ += DownloadItemModel::InterruptReasonMessage(reason); | 268 tooltip_text_ += DownloadItemModel::InterruptReasonMessage(reason); |
| 267 } else { | 269 tooltip_text_ += new_line; |
| 268 tooltip_text_ = download_->GetFileNameToReportUser().LossyDisplayName(); | 270 tooltip_text_ += model_->GetProgressText(); |
| 269 } | 271 } |
| 270 | 272 |
| 271 if (IsShowingWarningDialog() && !model_->IsDangerous()) { | 273 if (IsShowingWarningDialog() && !model_->IsDangerous()) { |
| 272 // We have been approved. | 274 // We have been approved. |
| 273 ClearWarningDialog(); | 275 ClearWarningDialog(); |
| 274 } else if (!IsShowingWarningDialog() && model_->IsDangerous()) { | 276 } else if (!IsShowingWarningDialog() && model_->IsDangerous()) { |
| 275 ShowWarningDialog(); | 277 ShowWarningDialog(); |
| 276 // Force the shelf to layout again as our size has changed. | 278 // Force the shelf to layout again as our size has changed. |
| 277 parent_->Layout(); | 279 parent_->Layout(); |
| 278 SchedulePaint(); | 280 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. | 1190 // Drop down button is glued to the left of the download shelf. |
| 1189 drop_down_x_left_ = 0; | 1191 drop_down_x_left_ = 0; |
| 1190 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); | 1192 drop_down_x_right_ = normal_drop_down_image_set_.top->width(); |
| 1191 } else { | 1193 } else { |
| 1192 // Drop down button is glued to the right of the download shelf. | 1194 // Drop down button is glued to the right of the download shelf. |
| 1193 drop_down_x_left_ = | 1195 drop_down_x_left_ = |
| 1194 size.width() - normal_drop_down_image_set_.top->width(); | 1196 size.width() - normal_drop_down_image_set_.top->width(); |
| 1195 drop_down_x_right_ = size.width(); | 1197 drop_down_x_right_ = size.width(); |
| 1196 } | 1198 } |
| 1197 } | 1199 } |
| OLD | NEW |