Chromium Code Reviews| Index: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc |
| =================================================================== |
| --- chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc (revision 110486) |
| +++ chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc (working copy) |
| @@ -1444,7 +1444,9 @@ |
| // back after shutdown, and similar issues. |
| GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
| gchar* text = gtk_clipboard_wait_for_text(x_clipboard); |
| - string16 text_wstr = UTF8ToUTF16(text ? text : ""); |
| + string16 sanitized_text(text ? |
| + CollapseWhitespace(StripJavascriptSchemas(UTF8ToUTF16(text)), true) : |
|
Peter Kasting
2011/11/21 21:23:43
Why did you reverse the order of the calls here?
SanjoyPal
2011/11/22 07:02:14
Done.
|
| + string16()); |
| g_free(text); |
| // Paste and Go menu item. |
| @@ -1456,7 +1458,7 @@ |
| g_signal_connect(paste_go_menuitem, "activate", |
| G_CALLBACK(HandlePasteAndGoThunk), this); |
| gtk_widget_set_sensitive(paste_go_menuitem, |
| - model_->CanPasteAndGo(text_wstr)); |
| + model_->CanPasteAndGo(sanitized_text)); |
|
Peter Kasting
2011/11/21 21:23:43
Why did you move this call back down here since th
SanjoyPal
2011/11/22 07:02:14
Done.
|
| gtk_widget_show(paste_go_menuitem); |
| g_signal_connect(menu, "deactivate", |
| @@ -1661,14 +1663,16 @@ |
| p = next; |
| } |
| - if (filtered_text.length()) { |
| + const std::string sanitized_text = |
| + UTF16ToUTF8(StripJavascriptSchemas(UTF8ToUTF16(filtered_text))); |
| + if (sanitized_text.length()) { |
|
Peter Kasting
2011/11/21 21:23:43
Nit: Change to using !empty()
SanjoyPal
2011/11/22 07:02:14
Done.
|
| // Avoid inserting the text after the instant anchor. |
| ValidateTextBufferIter(location); |
| // Call the default handler to insert filtered text. |
| GtkTextBufferClass* klass = GTK_TEXT_BUFFER_GET_CLASS(buffer); |
| - klass->insert_text(buffer, location, filtered_text.data(), |
| - static_cast<gint>(filtered_text.length())); |
| + klass->insert_text(buffer, location, sanitized_text.data(), |
| + static_cast<gint>(sanitized_text.length())); |
| } |
| // Stop propagating the signal emission to prevent the default handler from |