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

Unified Diff: chrome/renderer/render_view.cc

Issue 55052: Copy selection to x clipboard. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « chrome/renderer/render_view.h ('k') | tools/gtk_clipboard_dump/gtk_clipboard_dump.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
===================================================================
--- chrome/renderer/render_view.cc (revision 13031)
+++ chrome/renderer/render_view.cc (working copy)
@@ -297,6 +297,12 @@
MessageLoop::current());
webwidget_ = WebView::Create(this, webkit_prefs);
+#if defined(OS_LINUX)
+ // We have to enable ourselves as the editor delegate on linux so we can copy
+ // text selections to the X clipboard.
+ webview()->SetUseEditorDelegate(true);
+#endif
+
// Don't let WebCore keep a B/F list - we have our own.
// We let it keep 1 entry because FrameLoader::goToItem expects an item in the
// backForwardList, which is used only in ASSERTs.
@@ -425,6 +431,7 @@
IPC_MESSAGE_HANDLER(ViewMsg_HandleExtensionMessage,
OnHandleExtensionMessage)
IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse)
+ IPC_MESSAGE_HANDLER(ViewMsg_RequestSelectionText, OnRequestSelectionText)
// Have the super handle all other messages.
IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message))
@@ -454,6 +461,10 @@
Send(new ViewHostMsg_Thumbnail(routing_id_, url, score, thumbnail));
}
+void RenderView::OnRequestSelectionText() {
+ Send(new ViewHostMsg_SetSelectionText(routing_id_, selection_text_));
+}
+
void RenderView::PrintPage(const ViewMsg_PrintPage_Params& params,
const gfx::Size& canvas_size,
WebFrame* frame) {
@@ -2422,6 +2433,17 @@
Send(new ViewHostMsg_SetTooltipText(routing_id_, tooltip_text));
}
+void RenderView::DidChangeSelection(bool is_empty_selection) {
+#if defined(OS_LINUX)
+ if (!is_empty_selection) {
+ // TODO(estade): find a way to incrementally update the selection text.
+ selection_text_ = webview()->GetMainFrame()->GetSelection(false);
+ Send(new ViewHostMsg_SelectionChanged(routing_id_));
+ }
+#endif
+}
+
+
void RenderView::DownloadUrl(const GURL& url, const GURL& referrer) {
Send(new ViewHostMsg_DownloadUrl(routing_id_, url, referrer));
}
« no previous file with comments | « chrome/renderer/render_view.h ('k') | tools/gtk_clipboard_dump/gtk_clipboard_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698