diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-12 07:30:35 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-12 07:30:35 +0000 |
commit | a954bf7d89777070fa9980d6692e3787dd61e26f (patch) | |
tree | 31a0b26e4f0abfbe45437127d9f9703b5ceb6960 /chrome/renderer | |
parent | 8e5722d2311e0a91cca92692c012e64bb01fb2cf (diff) | |
download | chromium_src-a954bf7d89777070fa9980d6692e3787dd61e26f.zip chromium_src-a954bf7d89777070fa9980d6692e3787dd61e26f.tar.gz chromium_src-a954bf7d89777070fa9980d6692e3787dd61e26f.tar.bz2 |
Let cmd-e write the selection into the find pasteboard.
Note that chrome still does not support _reading_ from the find pasteboard, so hitting cmd-e followed by cmd-g in chrome still doesn't work. Also, cmd-f doesn't write to the find pasteboard yet either.
BUG=14562
TEST=Select some text on a web page, hit cmd-e, go to the same web page in safari, hit cmd-g. Safari should search for the text you selected in chrome.
Review URL: http://codereview.chromium.org/197035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26075 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 17 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index af8ddbf..1da9696 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -356,6 +356,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) @@ -830,6 +831,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; diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index cac8ca8..4f9bc89 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -535,6 +535,7 @@ class RenderView : public RenderWidget, void OnRedo(); void OnCut(); void OnCopy(); + void OnCopyToFindPboard(); void OnPaste(); void OnReplace(const std::wstring& text); void OnAdvanceToNextMisspelling(); |