Index: chrome/browser/tab_contents/render_view_context_menu.cc |
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc |
index fdc406fe5b69d11cb045c003061153e9474c9b6e..66e20a9d82e92ce55863f784b9d4005129996bf8 100644 |
--- a/chrome/browser/tab_contents/render_view_context_menu.cc |
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc |
@@ -389,10 +389,8 @@ void RenderViewContextMenu::AppendAllExtensionItems() { |
i != sorted_ids.end(); ++i) { |
string16 printable_selection_text = PrintableSelectionText(); |
// Escape "&" as "&&". |
- for (size_t position = printable_selection_text.find('&'); |
- position != string16::npos; |
- position = printable_selection_text.find('&', position + 2)) |
- printable_selection_text.insert(position, 1, '&'); |
+ ReplaceChars(printable_selection_text, ASCIIToUTF16("&").c_str(), |
Yoyo Zhou
2013/02/19 18:34:01
Try L"&" and L"&&" here.
Joe Thomas
2013/02/19 19:17:50
This works only on platforms like windows where wc
Joe Thomas
2013/02/19 21:32:11
Looks like my above explanation is not fully clear
Yoyo Zhou
2013/02/19 21:57:02
Bummer. I guess C++11 initializer lists would be r
Joe Thomas
2013/02/19 22:39:05
That can be done. Patch updated.
|
+ ASCIIToUTF16("&&"), &printable_selection_text); |
extension_items_.AppendExtensionItems(i->second, printable_selection_text, |
&index); |
@@ -830,9 +828,9 @@ void RenderViewContextMenu::AppendSearchProvider() { |
string16 printable_selection_text = PrintableSelectionText(); |
// Escape "&" as "&&". |
- for (size_t i = printable_selection_text.find('&'); i != string16::npos; |
- i = printable_selection_text.find('&', i + 2)) |
- printable_selection_text.insert(i, 1, '&'); |
+ ReplaceChars(printable_selection_text, ASCIIToUTF16("&").c_str(), |
+ ASCIIToUTF16("&&"), &printable_selection_text); |
+ |
if (AutocompleteMatch::IsSearchType(match.type)) { |
const TemplateURL* const default_provider = |