Comment #9 on issue 14562 by tha...@chromium.org: Support Cmd-E as shortcut  
for finding selection
http://code.google.com/p/chromium/issues/detail?id=14562

So, did some looking how cmd-c works:

Cmd-c is not bound to `commandDispatch:` on OS X but instead directly to
`copy:` (see `MainMenu.xib`). This is implemented in
`chrome/browser/tab_contents/tab_contents_view_mac.mm` by
`TabContentsViewCocoa` and just delegates to `TabContents::Copy()`, which in
turn delegates to `RenderViewHost::Copy()`. This send a `ViewMsg_Copy` to  
the
renderer.

This message is then routed to `RenderView::OnCopy()` in the renderer, which
`executeCommand()`s `"Copy"` on the webview's focussed frame.

The map from command names to actions is in
`third_party/WebKit/WebCore/editing/EditorCommand.cpp`. The command reaches
`.../WebCore/editing/Editor.cpp::copy()`, which calls
`Pasteboard::generalPasteboard()->writeSelection()` (or `writeImage()`).

In our case, that ends up being  
`.../WebCore/platform/PasteboardChromium.cpp`,
which calls `ChromiumBridge::clipboardWriteSelection()` (for the text case).
The implementation is in the forked part of webkit ('webkit/api/src`) again.

This calls `WebClipboardImpl::WriteHTML()`, which puts the text into a
`ScopedClipboardWriterGlue`.  Then
`chrome/renderer/renderer_glue.cc::~ScopedClipboardWriterGlue()` sends
`ViewHostMsg_ClipboardWriteObjectsAsync` to the browser process.

The browser process `OnClipboardWriteObjects()` in
`chrome/browser/resource_message_filter.cc` is called when the ipc message
`ViewHostMsg_ClipboardWriteObjectsAsync` arrives.
This calls `WriteObjects()` on a `base/clipboard.h` `Clipboard` (through
`ScopedClipboardWriter`). Finally, `base/clipboard_mac.mm` does the writing  
to
the clipboard.

Cmd-e should work exactly the same but write into a different pasteboard at
the end.



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/group/chromium-bugs
-~----------~----~----~----~------~----~------~--~---

Reply via email to