OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 bool handled = true; | 1377 bool handled = true; |
1378 IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg) | 1378 IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg) |
1379 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) | 1379 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) |
1380 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) | 1380 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) |
1381 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) | 1381 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) |
1382 IPC_MESSAGE_HANDLER(FrameMsg_Delete, OnDeleteFrame) | 1382 IPC_MESSAGE_HANDLER(FrameMsg_Delete, OnDeleteFrame) |
1383 IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) | 1383 IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) |
1384 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) | 1384 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) |
1385 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, | 1385 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, |
1386 OnCustomContextMenuAction) | 1386 OnCustomContextMenuAction) |
| 1387 IPC_MESSAGE_HANDLER(FrameMsg_ClickOnFocusedElement, OnClickFocusedElement) |
1387 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) | 1388 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) |
1388 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) | 1389 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) |
1389 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) | 1390 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) |
1390 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) | 1391 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) |
1391 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) | 1392 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) |
1392 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 1393 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
1393 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) | 1394 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) |
1394 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) | 1395 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) |
1395 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) | 1396 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) |
1396 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, | 1397 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 ContextMenuClient* client = | 1660 ContextMenuClient* client = |
1660 pending_context_menus_.Lookup(custom_context.request_id); | 1661 pending_context_menus_.Lookup(custom_context.request_id); |
1661 if (client) | 1662 if (client) |
1662 client->OnMenuAction(custom_context.request_id, action); | 1663 client->OnMenuAction(custom_context.request_id, action); |
1663 } else { | 1664 } else { |
1664 // Internal request, forward to WebKit. | 1665 // Internal request, forward to WebKit. |
1665 render_view_->webview()->performCustomContextMenuAction(action); | 1666 render_view_->webview()->performCustomContextMenuAction(action); |
1666 } | 1667 } |
1667 } | 1668 } |
1668 | 1669 |
| 1670 void RenderFrameImpl::OnClickFocusedElement() { |
| 1671 WebView* view = render_view_->webview(); |
| 1672 WebFrame* focused_frame = view->focusedFrame(); |
| 1673 if (focused_frame) { |
| 1674 WebDocument doc = focused_frame->document(); |
| 1675 if (!doc.isNull()) { |
| 1676 WebElement element = doc.focusedElement(); |
| 1677 if (!element.isNull()) |
| 1678 element.simulateClick(); |
| 1679 } |
| 1680 } |
| 1681 } |
| 1682 |
1669 void RenderFrameImpl::OnUndo() { | 1683 void RenderFrameImpl::OnUndo() { |
1670 frame_->executeCommand(WebString::fromUTF8("Undo"), GetFocusedElement()); | 1684 frame_->executeCommand(WebString::fromUTF8("Undo"), GetFocusedElement()); |
1671 } | 1685 } |
1672 | 1686 |
1673 void RenderFrameImpl::OnRedo() { | 1687 void RenderFrameImpl::OnRedo() { |
1674 frame_->executeCommand(WebString::fromUTF8("Redo"), GetFocusedElement()); | 1688 frame_->executeCommand(WebString::fromUTF8("Redo"), GetFocusedElement()); |
1675 } | 1689 } |
1676 | 1690 |
1677 void RenderFrameImpl::OnCut() { | 1691 void RenderFrameImpl::OnCut() { |
1678 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1692 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
(...skipping 4354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6033 int match_count, | 6047 int match_count, |
6034 int ordinal, | 6048 int ordinal, |
6035 const WebRect& selection_rect, | 6049 const WebRect& selection_rect, |
6036 bool final_status_update) { | 6050 bool final_status_update) { |
6037 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6051 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6038 selection_rect, ordinal, | 6052 selection_rect, ordinal, |
6039 final_status_update)); | 6053 final_status_update)); |
6040 } | 6054 } |
6041 | 6055 |
6042 } // namespace content | 6056 } // namespace content |
OLD | NEW |