Chromium Code Reviews| Index: chrome/browser/gtk/back_forward_menu_model_gtk.cc |
| =================================================================== |
| --- chrome/browser/gtk/back_forward_menu_model_gtk.cc (revision 24583) |
| +++ chrome/browser/gtk/back_forward_menu_model_gtk.cc (working copy) |
| @@ -4,9 +4,13 @@ |
| #include "chrome/browser/gtk/back_forward_menu_model_gtk.h" |
| +#include "app/l10n_util.h" |
| #include "base/string_util.h" |
| #include "chrome/browser/gtk/back_forward_button_gtk.h" |
| +// Might want to vary this by locale. |
| +static const size_t kMaxChars = 50; |
| + |
| BackForwardMenuModelGtk::BackForwardMenuModelGtk(Browser* browser, |
| ModelType model_type, |
| BackForwardButtonGtk* button) |
| @@ -23,7 +27,11 @@ |
| } |
| std::string BackForwardMenuModelGtk::GetLabel(int command_id) const { |
| - return UTF16ToUTF8(GetItemLabel(command_id)); |
| + std::wstring item_label_wstr = UTF16ToWideHack(GetItemLabel(command_id)); |
| + // This breaks on word boundaries. Ideally we would break on character |
| + // boundaries. |
| + item_label_wstr = l10n_util::TruncateString(item_label_wstr, kMaxChars); |
|
tony
2009/08/27 23:01:04
It looks like there's an width-chars property on G
Evan Stade
2009/08/27 23:02:27
The "width-chars" style property
"width-chars"
|
| + return WideToUTF8(item_label_wstr); |
| } |
| bool BackForwardMenuModelGtk::HasIcon(int command_id) const { |