diff options
-rw-r--r-- | chrome/browser/gtk/status_bubble_gtk.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/chrome/browser/gtk/status_bubble_gtk.cc b/chrome/browser/gtk/status_bubble_gtk.cc index 70e2702..fb5fcc3 100644 --- a/chrome/browser/gtk/status_bubble_gtk.cc +++ b/chrome/browser/gtk/status_bubble_gtk.cc @@ -6,6 +6,7 @@ #include <gtk/gtk.h> +#include "app/gfx/text_elider.h" #include "base/gfx/gtk_util.h" #include "base/message_loop.h" #include "base/string_util.h" @@ -70,9 +71,15 @@ void StatusBubbleGtk::SetURL(const GURL& url, const std::wstring& languages) { return; } - // TODO(erg): We probably want to elide the text from the GURL object. - url_text_ = url.possibly_invalid_spec(); - + // Set Elided Text corresponding to the GURL object. We limit the width of + // the URL to a third of the width of the browser window (matching the width + // on Windows). + GtkWidget* parent = gtk_widget_get_parent(container_.get()); + int window_width = parent->allocation.width; + // TODO(tc): We don't actually use gfx::Font as the font in the status + // bubble. We should extend gfx::ElideUrl to take some sort of pango font. + url_text_ = WideToUTF8(gfx::ElideUrl(url, gfx::Font(), window_width / 3, + languages)); SetStatusTextTo(url_text_); } |