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

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

Issue 155395: GTK: Force a size on download items and elide the dangerous download filename... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/download_item_gtk.cc
===================================================================
--- chrome/browser/gtk/download_item_gtk.cc (revision 20424)
+++ chrome/browser/gtk/download_item_gtk.cc (working copy)
@@ -42,6 +42,9 @@
// it will be elided.
const int kTextWidth = 140;
+// Showing width of the dangerous file warning, in pixels.
Evan Martin 2009/07/13 21:22:33 "Showing width" is a bit of strange wording (?)
+const int kDangerousTextWidth = 350;
+
// The minimum width we will ever draw the download item. Used as a lower bound
// during animation. This number comes from the width of the images used to
// make the download item.
@@ -281,11 +284,12 @@
gtk_box_pack_start(GTK_BOX(dangerous_hbox_), dangerous_image,
FALSE, FALSE, 0);
- // Create the warning text.
- // TODO(estade): the encoding might not be UTF8.
+ std::wstring elided_filename = gfx::ElideFilename(
+ get_download()->original_name(),
+ gfx::Font(), kTextWidth);
std::string dangerous_warning =
l10n_util::GetStringFUTF8(IDS_PROMPT_DANGEROUS_DOWNLOAD,
- UTF8ToUTF16(get_download()->original_name().value()));
+ WideToUTF16(elided_filename));
gchar* label_markup =
g_markup_printf_escaped(kLabelColorMarkup, kFilenameColor,
dangerous_warning.c_str());
@@ -299,6 +303,7 @@
// request when the animation is going on.
gtk_box_pack_start(GTK_BOX(dangerous_hbox_), dangerous_label,
TRUE, TRUE, 0);
+ gtk_widget_set_size_request(dangerous_label, kDangerousTextWidth, -1);
g_free(label_markup);
// Create the ok button.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698