OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 976 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
977 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 977 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
978 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) | 978 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) |
979 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) | 979 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) |
980 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) | 980 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) |
981 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) | 981 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) |
982 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) | 982 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) |
983 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) | 983 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) |
984 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 984 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
985 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) | 985 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) |
| 986 IPC_MESSAGE_HANDLER(ViewMsg_ReplaceMisspelling, OnReplaceMisspelling) |
986 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) | 987 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) |
987 IPC_MESSAGE_HANDLER(ViewMsg_SetName, OnSetName) | 988 IPC_MESSAGE_HANDLER(ViewMsg_SetName, OnSetName) |
988 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 989 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
989 IPC_MESSAGE_HANDLER(ViewMsg_Unselect, OnUnselect) | 990 IPC_MESSAGE_HANDLER(ViewMsg_Unselect, OnUnselect) |
990 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets, | 991 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets, |
991 OnSetEditableSelectionOffsets) | 992 OnSetEditableSelectionOffsets) |
992 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText, | 993 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText, |
993 OnSetCompositionFromExistingText) | 994 OnSetCompositionFromExistingText) |
994 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete, | 995 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete, |
995 OnExtendSelectionAndDelete) | 996 OnExtendSelectionAndDelete) |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 WebString::fromUTF8("PasteAndMatchStyle")); | 1398 WebString::fromUTF8("PasteAndMatchStyle")); |
1398 } | 1399 } |
1399 | 1400 |
1400 void RenderViewImpl::OnReplace(const string16& text) { | 1401 void RenderViewImpl::OnReplace(const string16& text) { |
1401 if (!webview()) | 1402 if (!webview()) |
1402 return; | 1403 return; |
1403 | 1404 |
1404 WebFrame* frame = webview()->focusedFrame(); | 1405 WebFrame* frame = webview()->focusedFrame(); |
1405 if (!frame->hasSelection()) | 1406 if (!frame->hasSelection()) |
1406 frame->selectWordAroundCaret(); | 1407 frame->selectWordAroundCaret(); |
| 1408 |
1407 frame->replaceSelection(text); | 1409 frame->replaceSelection(text); |
1408 } | 1410 } |
1409 | 1411 |
| 1412 void RenderViewImpl::OnReplaceMisspelling(const string16& text) { |
| 1413 if (!webview()) |
| 1414 return; |
| 1415 |
| 1416 WebFrame* frame = webview()->focusedFrame(); |
| 1417 if (!frame->hasSelection()) |
| 1418 return; |
| 1419 |
| 1420 frame->replaceMisspelledRange(text); |
| 1421 } |
| 1422 |
1410 void RenderViewImpl::OnDelete() { | 1423 void RenderViewImpl::OnDelete() { |
1411 if (!webview()) | 1424 if (!webview()) |
1412 return; | 1425 return; |
1413 | 1426 |
1414 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete")); | 1427 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete")); |
1415 } | 1428 } |
1416 | 1429 |
1417 void RenderViewImpl::OnSetName(const std::string& name) { | 1430 void RenderViewImpl::OnSetName(const std::string& name) { |
1418 if (!webview()) | 1431 if (!webview()) |
1419 return; | 1432 return; |
(...skipping 5186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6606 } | 6619 } |
6607 #endif | 6620 #endif |
6608 | 6621 |
6609 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6622 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6610 TransportDIB::Handle dib_handle) { | 6623 TransportDIB::Handle dib_handle) { |
6611 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6624 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6612 RenderProcess::current()->ReleaseTransportDIB(dib); | 6625 RenderProcess::current()->ReleaseTransportDIB(dib); |
6613 } | 6626 } |
6614 | 6627 |
6615 } // namespace content | 6628 } // namespace content |
OLD | NEW |