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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) | 913 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) |
914 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) | 914 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) |
915 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) | 915 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) |
916 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) | 916 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) |
917 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) | 917 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) |
918 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 918 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
919 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) | 919 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) |
920 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) | 920 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) |
921 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) | 921 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) |
922 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) | 922 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) |
| 923 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, |
| 924 OnMoveRangeSelectionExtent) |
923 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) | 925 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) |
924 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) | 926 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) |
925 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, | 927 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, |
926 OnExtendSelectionAndDelete) | 928 OnExtendSelectionAndDelete) |
927 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, | 929 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, |
928 OnSetCompositionFromExistingText) | 930 OnSetCompositionFromExistingText) |
929 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 931 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
930 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 932 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
931 OnJavaScriptExecuteRequest) | 933 OnJavaScriptExecuteRequest) |
932 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, | 934 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 | 1277 |
1276 void RenderFrameImpl::OnDelete() { | 1278 void RenderFrameImpl::OnDelete() { |
1277 frame_->executeCommand(WebString::fromUTF8("Delete"), GetFocusedElement()); | 1279 frame_->executeCommand(WebString::fromUTF8("Delete"), GetFocusedElement()); |
1278 } | 1280 } |
1279 | 1281 |
1280 void RenderFrameImpl::OnSelectAll() { | 1282 void RenderFrameImpl::OnSelectAll() { |
1281 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1283 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1282 frame_->executeCommand(WebString::fromUTF8("SelectAll"), GetFocusedElement()); | 1284 frame_->executeCommand(WebString::fromUTF8("SelectAll"), GetFocusedElement()); |
1283 } | 1285 } |
1284 | 1286 |
1285 void RenderFrameImpl::OnSelectRange(const gfx::Point& start, | 1287 void RenderFrameImpl::OnSelectRange(const gfx::Point& base, |
1286 const gfx::Point& end) { | 1288 const gfx::Point& extent) { |
1287 // This IPC is dispatched by RenderWidgetHost, so use its routing id. | 1289 // This IPC is dispatched by RenderWidgetHost, so use its routing id. |
1288 Send(new ViewHostMsg_SelectRange_ACK(GetRenderWidget()->routing_id())); | 1290 Send(new InputHostMsg_SelectRange_ACK(GetRenderWidget()->routing_id())); |
1289 | 1291 |
1290 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1292 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1291 frame_->selectRange(start, end); | 1293 frame_->selectRange(base, extent); |
1292 } | 1294 } |
1293 | 1295 |
1294 void RenderFrameImpl::OnUnselect() { | 1296 void RenderFrameImpl::OnUnselect() { |
1295 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1297 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1296 frame_->executeCommand(WebString::fromUTF8("Unselect"), GetFocusedElement()); | 1298 frame_->executeCommand(WebString::fromUTF8("Unselect"), GetFocusedElement()); |
1297 } | 1299 } |
1298 | 1300 |
| 1301 void RenderFrameImpl::OnMoveRangeSelectionExtent(const gfx::Point& point) { |
| 1302 // This IPC is dispatched by RenderWidgetHost, so use its routing id. |
| 1303 Send(new InputHostMsg_MoveRangeSelectionExtent_ACK( |
| 1304 GetRenderWidget()->routing_id())); |
| 1305 |
| 1306 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
| 1307 frame_->moveRangeSelectionExtent(point); |
| 1308 } |
| 1309 |
1299 void RenderFrameImpl::OnReplace(const base::string16& text) { | 1310 void RenderFrameImpl::OnReplace(const base::string16& text) { |
1300 if (!frame_->hasSelection()) | 1311 if (!frame_->hasSelection()) |
1301 frame_->selectWordAroundCaret(); | 1312 frame_->selectWordAroundCaret(); |
1302 | 1313 |
1303 frame_->replaceSelection(text); | 1314 frame_->replaceSelection(text); |
1304 } | 1315 } |
1305 | 1316 |
1306 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { | 1317 void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { |
1307 if (!frame_->hasSelection()) | 1318 if (!frame_->hasSelection()) |
1308 return; | 1319 return; |
(...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4168 | 4179 |
4169 #if defined(ENABLE_BROWSER_CDMS) | 4180 #if defined(ENABLE_BROWSER_CDMS) |
4170 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 4181 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
4171 if (!cdm_manager_) | 4182 if (!cdm_manager_) |
4172 cdm_manager_ = new RendererCdmManager(this); | 4183 cdm_manager_ = new RendererCdmManager(this); |
4173 return cdm_manager_; | 4184 return cdm_manager_; |
4174 } | 4185 } |
4175 #endif // defined(ENABLE_BROWSER_CDMS) | 4186 #endif // defined(ENABLE_BROWSER_CDMS) |
4176 | 4187 |
4177 } // namespace content | 4188 } // namespace content |
OLD | NEW |