Index: chrome/browser/ui/cocoa/download/download_item_controller.mm |
diff --git a/chrome/browser/ui/cocoa/download/download_item_controller.mm b/chrome/browser/ui/cocoa/download/download_item_controller.mm |
index faac76d7ef690268f108ad453d8df683d24d9334..22bf80c5f63d45b531e78a2135bda1606496093d 100644 |
--- a/chrome/browser/ui/cocoa/download/download_item_controller.mm |
+++ b/chrome/browser/ui/cocoa/download/download_item_controller.mm |
@@ -44,6 +44,7 @@ const int kTextWidth = 140; // Pixels |
// The maximum width in pixels for the file name tooltip. |
const int kToolTipMaxWidth = 900; |
+const int kToolTipErrorMessageMaxHeight = kToolTipMaxWidth / 4; |
// Helper to widen a view. |
@@ -245,9 +246,35 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { |
} |
- (void)updateToolTip { |
- string16 elidedFilename = ui::ElideFilename( |
+ string16 tooltip_text = ui::ElideFilename( |
[self download]->GetFileNameToReportUser(), *font_, kToolTipMaxWidth); |
- [progressView_ setToolTip:base::SysUTF16ToNSString(elidedFilename)]; |
+ |
+ if ([self download]->GetState() == content::DownloadItem::INTERRUPTED) { |
+ content::DownloadInterruptReason reason = [self download]->GetLastReason(); |
+ DCHECK(reason != 0); |
+ |
+ // Split up the error description string as necessary. |
+ std::vector<string16> elidedMessages; |
+ ui::ElideRectangleText( |
+ DownloadItemModel::InterruptReasonMessage(reason), |
+ *font_, |
+ kToolTipMaxWidth, |
+ kToolTipErrorMessageMaxHeight, |
+ ui::IGNORE_LONG_WORDS, |
+ &elidedMessages); |
+ |
+ string16 new_line = ASCIIToUTF16("\n"); |
+ tooltip_text += new_line; |
+ |
+ for (size_t i = 0; i < elidedMessages.size(); ++i) { |
+ tooltip_text += elidedMessages[i]; |
+ tooltip_text += new_line; |
+ } |
+ |
+ tooltip_text += bridge_->download_model()->GetProgressText(); |
+ } |
+ |
+ [progressView_ setToolTip:base::SysUTF16ToNSString(tooltip_text)]; |
} |
- (void)clearDangerousMode { |