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

Unified Diff: chrome/renderer/render_view.cc

Issue 197035: [mac] Let cmd-e write the selection into the find pasteboard. (Closed)
Patch Set: Add comment, merge with ToT Created 11 years, 3 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 6847563270c08aa04293661e094a801cb09fe56a..82539ad3fa5d3ca00dff440c7ac90c943e0a5819 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -349,6 +349,7 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo)
IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut)
IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy)
+ IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard)
IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste)
IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace)
IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellPanel, OnToggleSpellPanel)
@@ -823,6 +824,22 @@ void RenderView::OnCopy() {
UserMetricsRecordAction(L"Copy");
}
+void RenderView::OnCopyToFindPboard() {
+ if (!webview())
+ return;
+
+ // Since the find pasteboard supports only plain text, this can be simpler
+ // than the |OnCopy()| case.
+ WebFrame* frame = webview()->GetFocusedFrame();
+ if (frame->hasSelection()) {
+ string16 selection = frame->selectionAsText();
+ RenderThread::current()->Send(
+ new ViewHostMsg_ClipboardFindPboardWriteStringAsync(selection));
+ }
+
+ UserMetricsRecordAction(L"CopyToFindPboard");
+}
+
void RenderView::OnPaste() {
if (!webview())
return;
« no previous file with comments | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698