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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1002 OnCustomContextMenuAction) | 1002 OnCustomContextMenuAction) |
1003 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) | 1003 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) |
1004 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) | 1004 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) |
1005 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) | 1005 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) |
1006 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) | 1006 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) |
1007 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) | 1007 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) |
1008 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 1008 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
1009 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) | 1009 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) |
1010 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) | 1010 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) |
1011 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) | 1011 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) |
1012 IPC_MESSAGE_HANDLER(InputMsg_ExpandSelectionByCharacterOffset, | |
1013 OnExpandSelectionByCharacterOffset) | |
1012 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) | 1014 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) |
1013 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, | 1015 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, |
1014 OnMoveRangeSelectionExtent) | 1016 OnMoveRangeSelectionExtent) |
1015 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) | 1017 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) |
1016 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) | 1018 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) |
1017 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, | 1019 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, |
1018 OnExtendSelectionAndDelete) | 1020 OnExtendSelectionAndDelete) |
1019 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, | 1021 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, |
1020 OnSetCompositionFromExistingText) | 1022 OnSetCompositionFromExistingText) |
1021 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, | 1023 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1318 | 1320 |
1319 void RenderFrameImpl::OnSelectRange(const gfx::Point& base, | 1321 void RenderFrameImpl::OnSelectRange(const gfx::Point& base, |
1320 const gfx::Point& extent) { | 1322 const gfx::Point& extent) { |
1321 // This IPC is dispatched by RenderWidgetHost, so use its routing id. | 1323 // This IPC is dispatched by RenderWidgetHost, so use its routing id. |
1322 Send(new InputHostMsg_SelectRange_ACK(GetRenderWidget()->routing_id())); | 1324 Send(new InputHostMsg_SelectRange_ACK(GetRenderWidget()->routing_id())); |
1323 | 1325 |
1324 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1326 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1325 frame_->selectRange(base, extent); | 1327 frame_->selectRange(base, extent); |
1326 } | 1328 } |
1327 | 1329 |
1330 void RenderFrameImpl::OnExpandSelectionByCharacterOffset(int start_adjust, | |
1331 int end_adjust) { | |
1332 size_t start, length; | |
1333 if (!GetRenderWidget()->webwidget()->caretOrSelectionRange( | |
1334 &start, &length)) { | |
1335 return; | |
1336 } | |
1337 start -= start_adjust; | |
1338 length += end_adjust + start_adjust; | |
1339 frame_->selectRange(WebRange::fromDocumentRange(frame_, start, length)); | |
1340 | |
Charlie Reis
2015/07/07 17:02:27
nit: No blank line.
aurimas (slooooooooow)
2015/07/07 18:18:05
Done
| |
1341 } | |
1342 | |
1328 void RenderFrameImpl::OnUnselect() { | 1343 void RenderFrameImpl::OnUnselect() { |
1329 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | 1344 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); |
1330 frame_->executeCommand(WebString::fromUTF8("Unselect"), GetFocusedElement()); | 1345 frame_->executeCommand(WebString::fromUTF8("Unselect"), GetFocusedElement()); |
1331 } | 1346 } |
1332 | 1347 |
1333 void RenderFrameImpl::OnMoveRangeSelectionExtent(const gfx::Point& point) { | 1348 void RenderFrameImpl::OnMoveRangeSelectionExtent(const gfx::Point& point) { |
1334 // This IPC is dispatched by RenderWidgetHost, so use its routing id. | 1349 // This IPC is dispatched by RenderWidgetHost, so use its routing id. |
1335 Send(new InputHostMsg_MoveRangeSelectionExtent_ACK( | 1350 Send(new InputHostMsg_MoveRangeSelectionExtent_ACK( |
1336 GetRenderWidget()->routing_id())); | 1351 GetRenderWidget()->routing_id())); |
1337 | 1352 |
(...skipping 3674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5012 void RenderFrameImpl::RegisterMojoServices() { | 5027 void RenderFrameImpl::RegisterMojoServices() { |
5013 // Only main frame have ImageDownloader service. | 5028 // Only main frame have ImageDownloader service. |
5014 if (!frame_->parent()) { | 5029 if (!frame_->parent()) { |
5015 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( | 5030 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( |
5016 base::Bind(&ImageDownloaderImpl::CreateMojoService, | 5031 base::Bind(&ImageDownloaderImpl::CreateMojoService, |
5017 base::Unretained(this))); | 5032 base::Unretained(this))); |
5018 } | 5033 } |
5019 } | 5034 } |
5020 | 5035 |
5021 } // namespace content | 5036 } // namespace content |
OLD | NEW |