Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: chrome/browser/ui/gtk/download/download_item_gtk.cc

Issue 10169025: Show download interrupt reason in a tooltip (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/download/download_item_gtk.cc
diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.cc b/chrome/browser/ui/gtk/download/download_item_gtk.cc
index 92be0bb60486a668509acc632f2d1dd09b1f256f..e7cf68e9df0d9ff96a958b182d636a8735f1de9b 100644
--- a/chrome/browser/ui/gtk/download/download_item_gtk.cc
+++ b/chrome/browser/ui/gtk/download/download_item_gtk.cc
@@ -335,6 +335,7 @@ void DownloadItemGtk::OnDownloadUpdated(DownloadItem* download) {
break;
case DownloadItem::INTERRUPTED:
StopDownloadProgress();
+ UpdateTooltip();
complete_animation_.Show();
break;
@@ -476,11 +477,19 @@ void DownloadItemGtk::LoadIcon() {
}
void DownloadItemGtk::UpdateTooltip() {
- string16 elided_filename = ui::ElideFilename(
- get_download()->GetFileNameToReportUser(),
- gfx::Font(), kTooltipMaxWidth);
- gtk_widget_set_tooltip_text(body_.get(),
- UTF16ToUTF8(elided_filename).c_str());
+ string16 tooltip_text = ui::ElideFilename(
+ get_download()->GetFileNameToReportUser(), gfx::Font(), kTooltipMaxWidth);
+
+ if (get_download()->GetState() == content::DownloadItem::INTERRUPTED) {
+ content::DownloadInterruptReason reason = get_download()->GetLastReason();
+ DCHECK_NE(0, reason);
+
+ // Add the status on another line.
+ tooltip_text += ASCIIToUTF16("\n");
+ tooltip_text += DownloadItemModel::InterruptReasonStatusMessage(reason);
+ }
Nico 2012/04/23 23:25:04 This bit of code is very similar on all UIs. Maybe
+
+ gtk_widget_set_tooltip_text(body_.get(), UTF16ToUTF8(tooltip_text).c_str());
}
void DownloadItemGtk::UpdateNameLabel() {
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_item_mac.mm ('k') | chrome/browser/ui/views/download/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698