diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 17:49:10 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 17:49:10 +0000 |
commit | 7ebf8a3197e272d430d9c685a25fc4a6c07db1a3 (patch) | |
tree | 4d2b7454ab3377eb98492e3680db182d150a1aa8 /chrome/browser/autocomplete | |
parent | 4d44891289a162420b9c4d4ae24ea1d5170d66dd (diff) | |
download | chromium_src-7ebf8a3197e272d430d9c685a25fc4a6c07db1a3.zip chromium_src-7ebf8a3197e272d430d9c685a25fc4a6c07db1a3.tar.gz chromium_src-7ebf8a3197e272d430d9c685a25fc4a6c07db1a3.tar.bz2 |
GTK: Drags from the omnibox should use the 'http://' version of the url.
BUG=61489
TEST=manual. see bug.
Review URL: http://codereview.chromium.org/4441001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | 21 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index 0048ae1..c96a188 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -300,6 +300,10 @@ void AutocompleteEditViewGtk::Init() { text_buffer_, "mark-set", G_CALLBACK(&HandleMarkSetAfterThunk), this); g_signal_connect(text_view_, "drag-data-received", G_CALLBACK(&HandleDragDataReceivedThunk), this); + // Override the text_view_'s default drag-data-get handler by calling our own + // version after the normal call has happened. + g_signal_connect_after(text_view_, "drag-data-get", + G_CALLBACK(&HandleDragDataGetThunk), this); g_signal_connect(text_view_, "backspace", G_CALLBACK(&HandleBackSpaceThunk), this); g_signal_connect(text_view_, "copy-clipboard", @@ -1274,6 +1278,23 @@ void AutocompleteEditViewGtk::HandleDragDataReceived( } } +void AutocompleteEditViewGtk::HandleDragDataGet( + GtkWidget* widget, + GdkDragContext* context, + GtkSelectionData* selection_data, + guint target_type, + guint time) { + // If GTK put the normal textual version of the selection in our drag data, + // put our doctored selection that might have the 'http://' prefix. Also, GTK + // is confused about signedness of its datatypes, leading to the weird switch + // statement (no set of casts fixes this). + switch (target_type) { + case GTK_TEXT_BUFFER_TARGET_INFO_TEXT: { + gtk_selection_data_set_text(selection_data, selected_text_.c_str(), -1); + } + } +} + void AutocompleteEditViewGtk::HandleInsertText( GtkTextBuffer* buffer, GtkTextIter* location, const gchar* text, gint len) { std::string filtered_text; diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h index 07e0ed3..b63c2f2 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h @@ -206,6 +206,8 @@ class AutocompleteEditViewGtk : public AutocompleteEditView, CHROMEGTK_CALLBACK_6(AutocompleteEditViewGtk, void, HandleDragDataReceived, GdkDragContext*, gint, gint, GtkSelectionData*, guint, guint); + CHROMEGTK_CALLBACK_4(AutocompleteEditViewGtk, void, HandleDragDataGet, + GdkDragContext*, GtkSelectionData*, guint, guint); CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleBackSpace); CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleCopyClipboard); CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleCutClipboard); |