Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(973)

Unified Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc

Issue 6982011: Strip leading "javascript:" schemas from text pasted or dropped into the omnibox. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
===================================================================
--- chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc (revision 84514)
+++ chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc (working copy)
@@ -657,10 +657,8 @@
void OmniboxViewGtk::OnBeforePossibleChange() {
// Record this paste, so we can do different behavior.
- if (paste_clipboard_requested_) {
- paste_clipboard_requested_ = false;
+ if (paste_clipboard_requested_)
model_->on_paste();
- }
// This method will be called in HandleKeyPress() method just before
// handling a key press event. So we should prevent it from being called
@@ -686,6 +684,13 @@
return false;
}
+ if (paste_clipboard_requested_) {
Peter Kasting 2011/05/10 23:27:42 I don't think this is the right place for this. W
Cris Neckar 2011/05/11 21:42:36 The problem is that this is handled within the gtk
+ paste_clipboard_requested_ = false;
+ string16 text(GetText());
+ if (StripJavascriptSchema(text, &text))
+ SetUserText(text);
+ }
+
// If the change is caused by an Enter key press event, and the event was not
// handled by IME, then it's an unexpected change and shall be reverted here.
// {Start|Finish}UpdatingHighlightedText() are called here to prevent the
@@ -1578,12 +1583,16 @@
string16 possible_url = UTF8ToUTF16(reinterpret_cast<char*>(text));
g_free(text);
- if (OnPerformDropImpl(possible_url)) {
+
+ string16 stripped_url(possible_url);
+ bool stripped = StripJavascriptSchema(stripped_url, &stripped_url);
+ if (OnPerformDropImpl(possible_url) || stripped) {
gtk_drag_finish(context, TRUE, TRUE, time);
-
static guint signal_id =
g_signal_lookup("drag-data-received", GTK_TYPE_WIDGET);
g_signal_stop_emission(text_view_, signal_id, 0);
+ if (stripped)
+ SetUserText(stripped_url);
Peter Kasting 2011/05/10 23:27:42 Does GTK navigate on drop? If so, where does that
Cris Neckar 2011/05/11 21:42:36 If the dragged text is a url it occurs in OnPerfor
}
}

Powered by Google App Engine
This is Rietveld 408576698