summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 18:46:31 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 18:46:31 +0000
commit669fa671b5279f1c3fccfc357409f7d51a5b1775 (patch)
treec10a3f94758f11570d53e1b4ef270a21b22e61f3 /chrome
parentc62da25837d8976f587d2048b82aef41e71d9bb2 (diff)
downloadchromium_src-669fa671b5279f1c3fccfc357409f7d51a5b1775.zip
chromium_src-669fa671b5279f1c3fccfc357409f7d51a5b1775.tar.gz
chromium_src-669fa671b5279f1c3fccfc357409f7d51a5b1775.tar.bz2
Escape the '&' character in the back/forward menu entries.
BUG=17660 TEST=See 17660 for reproduction steps. patch by Aaron Kemp <kemp [at] chromium> original review: http://codereview.chromium.org/541053/show Review URL: http://codereview.chromium.org/542113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36530 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/back_forward_menu_model.cc9
-rw-r--r--chrome/browser/gtk/menu_gtk.cc6
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),