diff options
-rw-r--r-- | chrome/browser/back_forward_menu_model.cc | 9 | ||||
-rw-r--r-- | chrome/browser/gtk/menu_gtk.cc | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/chrome/browser/back_forward_menu_model.cc b/chrome/browser/back_forward_menu_model.cc index dd73cf8..6ceede4 100644 --- a/chrome/browser/back_forward_menu_model.cc +++ b/chrome/browser/back_forward_menu_model.cc @@ -70,8 +70,15 @@ string16 BackForwardMenuModel::GetLabelAt(int index) const { if (IsSeparator(index)) return string16(); + // Return the entry title, escaping any '&' characters. NavigationEntry* entry = GetNavigationEntry(index); - return entry->GetTitleForDisplay(&GetTabContents()->controller()); + string16 menu_text(entry->GetTitleForDisplay( + &GetTabContents()->controller())); + for (size_t i = menu_text.find('&'); i != string16::npos; + i = menu_text.find('&', i + 2)) { + menu_text.insert(i, 1, '&'); + } + return menu_text; } bool BackForwardMenuModel::IsLabelDynamicAt(int index) const { diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/gtk/menu_gtk.cc index 2b2b354..c4aecb0 100644 --- a/chrome/browser/gtk/menu_gtk.cc +++ b/chrome/browser/gtk/menu_gtk.cc @@ -77,7 +77,8 @@ void MenuGtk::AppendMenuItemWithLabel(int command_id, void MenuGtk::AppendMenuItemWithIcon(int command_id, const std::string& label, const SkBitmap& icon) { - GtkWidget* menu_item = BuildMenuItemWithImage(label, icon); + std::string converted_label = ConvertAcceleratorsFromWindowsStyle(label); + GtkWidget* menu_item = BuildMenuItemWithImage(converted_label, icon); AppendMenuItem(command_id, menu_item); } @@ -225,9 +226,8 @@ void MenuGtk::BuildMenuIn(GtkWidget* menu, GtkWidget* MenuGtk::BuildMenuItemWithImage(const std::string& label, const SkBitmap& icon) { - std::string converted_label = ConvertAcceleratorsFromWindowsStyle(label); GtkWidget* menu_item = - gtk_image_menu_item_new_with_mnemonic(converted_label.c_str()); + gtk_image_menu_item_new_with_mnemonic(label.c_str()); GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), |