| Index: chrome/renderer/render_view.cc
|
| ===================================================================
|
| --- chrome/renderer/render_view.cc (revision 25695)
|
| +++ chrome/renderer/render_view.cc (working copy)
|
| @@ -419,6 +419,8 @@
|
| OnNotifyRendererViewType)
|
| IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt)
|
| IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive)
|
| + IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent,
|
| + OnSetEditCommandsForNextKeyEvent);
|
|
|
| // Have the super handle all other messages.
|
| IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message))
|
| @@ -3381,3 +3383,32 @@
|
| }
|
| print_helper_->Print(frame, script_initiated);
|
| }
|
| +
|
| +void RenderView::OnSetEditCommandsForNextKeyEvent(
|
| + const EditCommands& edit_commands) {
|
| + edit_commands_ = edit_commands;
|
| +}
|
| +
|
| +void RenderView::DidHandleKeyEvent() {
|
| + edit_commands_.clear();
|
| +}
|
| +
|
| +bool RenderView::HandleCurrentKeyboardEvent() {
|
| + if (edit_commands_.empty())
|
| + return false;
|
| +
|
| + WebFrame* frame = webview()->GetFocusedFrame();
|
| + if (!frame)
|
| + return false;
|
| +
|
| + EditCommands::iterator it = edit_commands_.begin();
|
| + EditCommands::iterator end = edit_commands_.end();
|
| +
|
| + for (; it != end; ++it) {
|
| + if (!frame->executeCommand(WebString::fromUTF8(it->name),
|
| + WebString::fromUTF8(it->value)))
|
| + break;
|
| + }
|
| +
|
| + return true;
|
| +}
|
|
|