summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-08 00:45:42 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-08 00:45:42 +0000
commitb486d1518be2973e57c0ad965223c2e9c3788c9e (patch)
treebfc1844499538e9096912d25c0255a960317d7fc
parent07331d79c72e07472722ed527ddfb3ac7f0b2c15 (diff)
downloadchromium_src-b486d1518be2973e57c0ad965223c2e9c3788c9e.zip
chromium_src-b486d1518be2973e57c0ad965223c2e9c3788c9e.tar.gz
chromium_src-b486d1518be2973e57c0ad965223c2e9c3788c9e.tar.bz2
GTK: add http:// to cuts as well as copies in the omnibox.
BUG=43569 TEST=manual Review URL: http://codereview.chromium.org/2021006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46767 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc19
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.h5
2 files changed, 18 insertions, 6 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index 4c506bc..c93a998 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -296,9 +296,9 @@ void AutocompleteEditViewGtk::Init() {
g_signal_connect(text_view_, "backspace",
G_CALLBACK(&HandleBackSpaceThunk), this);
g_signal_connect(text_view_, "copy-clipboard",
- G_CALLBACK(&HandleCopyOrCutClipboardThunk), this);
+ G_CALLBACK(&HandleCopyClipboardThunk), this);
g_signal_connect(text_view_, "cut-clipboard",
- G_CALLBACK(&HandleCopyOrCutClipboardThunk), this);
+ G_CALLBACK(&HandleCutClipboardThunk), this);
g_signal_connect(text_view_, "paste-clipboard",
G_CALLBACK(&HandlePasteClipboardThunk), this);
g_signal_connect_after(text_view_, "expose-event",
@@ -1186,7 +1186,15 @@ void AutocompleteEditViewGtk::HandleViewMoveFocus(GtkWidget* widget,
// Propagate the signal so that focus can be moved as normal.
}
-void AutocompleteEditViewGtk::HandleCopyOrCutClipboard(GtkWidget* sender) {
+void AutocompleteEditViewGtk::HandleCopyClipboard(GtkWidget* sender) {
+ HandleCopyOrCutClipboard(true);
+}
+
+void AutocompleteEditViewGtk::HandleCutClipboard(GtkWidget* sender) {
+ HandleCopyOrCutClipboard(false);
+}
+
+void AutocompleteEditViewGtk::HandleCopyOrCutClipboard(bool copy) {
// On copy or cut, we manually update the PRIMARY selection to contain the
// highlighted text. This matches Firefox -- we highlight the URL but don't
// update PRIMARY on Ctrl-L, so Ctrl-L, Ctrl-C and then middle-click is a
@@ -1217,8 +1225,9 @@ void AutocompleteEditViewGtk::HandleCopyOrCutClipboard(GtkWidget* sender) {
scw.WriteHyperlink(UTF16ToUTF8(EscapeForHTML(text16)), url.spec());
// Stop propagating the signal.
- static guint signal_id =
- g_signal_lookup("copy-clipboard", GTK_TYPE_TEXT_VIEW);
+ static guint signal_id = copy ?
+ g_signal_lookup("copy-clipboard", GTK_TYPE_TEXT_VIEW) :
+ g_signal_lookup("cut-clipboard", GTK_TYPE_TEXT_VIEW);
g_signal_stop_emission(text_view_, signal_id, 0);
}
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
index 29a04e9..e524820 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
@@ -179,7 +179,8 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
GdkDragContext*, gint, gint, GtkSelectionData*,
guint, guint);
CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleBackSpace);
- CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleCopyOrCutClipboard);
+ CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleCopyClipboard);
+ CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleCutClipboard);
CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandlePasteClipboard);
CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean, HandleExposeEvent,
GdkEventExpose*);
@@ -195,6 +196,8 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
GtkSelectionData* selection_data,
guint info);
+ void HandleCopyOrCutClipboard(bool copy);
+
// Take control of the PRIMARY selection clipboard with |text|. Use
// |text_buffer_| as the owner, so that this doesn't remove the selection on
// it. This makes use of the above callbacks.