summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 23:24:08 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 23:24:08 +0000
commit88335d31a472e3782a931f7706e1aba13753254b (patch)
tree6537f627d75e96c816d2f363895543d2e178e416
parent721d873dacf77a46f88d15d57ea7103d73635624 (diff)
downloadchromium_src-88335d31a472e3782a931f7706e1aba13753254b.zip
chromium_src-88335d31a472e3782a931f7706e1aba13753254b.tar.gz
chromium_src-88335d31a472e3782a931f7706e1aba13753254b.tar.bz2
Re-land the patch to elide the status bubble to 1/3 the width of the
window. Review URL: http://codereview.chromium.org/155432 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20563 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gtk/status_bubble_gtk.cc13
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_);
}