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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) | 1474 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) |
1475 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, | 1475 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, |
1476 OnAdjustSelectionByCharacterOffset) | 1476 OnAdjustSelectionByCharacterOffset) |
1477 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) | 1477 IPC_MESSAGE_HANDLER(InputMsg_Unselect, OnUnselect) |
1478 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, | 1478 IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, |
1479 OnMoveRangeSelectionExtent) | 1479 OnMoveRangeSelectionExtent) |
1480 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) | 1480 IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) |
1481 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) | 1481 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) |
1482 IPC_MESSAGE_HANDLER(FrameMsg_CopyImageAt, OnCopyImageAt) | 1482 IPC_MESSAGE_HANDLER(FrameMsg_CopyImageAt, OnCopyImageAt) |
1483 IPC_MESSAGE_HANDLER(FrameMsg_SaveImageAt, OnSaveImageAt) | 1483 IPC_MESSAGE_HANDLER(FrameMsg_SaveImageAt, OnSaveImageAt) |
1484 IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, | |
1485 OnExtendSelectionAndDelete) | |
1486 IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, | |
1487 OnSetCompositionFromExistingText) | |
1488 IPC_MESSAGE_HANDLER(InputMsg_SetEditableSelectionOffsets, | |
1489 OnSetEditableSelectionOffsets) | |
1490 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, | 1484 IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, |
1491 OnExecuteNoValueEditCommand) | 1485 OnExecuteNoValueEditCommand) |
1492 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) | 1486 IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) |
1493 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 1487 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
1494 OnJavaScriptExecuteRequest) | 1488 OnJavaScriptExecuteRequest) |
1495 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, | 1489 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, |
1496 OnJavaScriptExecuteRequestForTests) | 1490 OnJavaScriptExecuteRequestForTests) |
1497 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, | 1491 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, |
1498 OnJavaScriptExecuteRequestInIsolatedWorld) | 1492 OnJavaScriptExecuteRequestInIsolatedWorld) |
1499 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, | 1493 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 Send(new FrameHostMsg_JavaScriptExecuteResponse(routing_id_, id, list)); | 2003 Send(new FrameHostMsg_JavaScriptExecuteResponse(routing_id_, id, list)); |
2010 } | 2004 } |
2011 } | 2005 } |
2012 | 2006 |
2013 void RenderFrameImpl::OnVisualStateRequest(uint64_t id) { | 2007 void RenderFrameImpl::OnVisualStateRequest(uint64_t id) { |
2014 GetRenderWidget()->QueueMessage( | 2008 GetRenderWidget()->QueueMessage( |
2015 new FrameHostMsg_VisualStateResponse(routing_id_, id), | 2009 new FrameHostMsg_VisualStateResponse(routing_id_, id), |
2016 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); | 2010 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); |
2017 } | 2011 } |
2018 | 2012 |
2019 void RenderFrameImpl::OnSetEditableSelectionOffsets(int start, int end) { | |
2020 base::AutoReset<bool> handling_select_range(&handling_select_range_, true); | |
2021 if (!GetRenderWidget()->ShouldHandleImeEvent()) | |
2022 return; | |
2023 ImeEventGuard guard(GetRenderWidget()); | |
2024 frame_->setEditableSelectionOffsets(start, end); | |
2025 } | |
2026 | |
2027 void RenderFrameImpl::OnSetCompositionFromExistingText( | |
2028 int start, int end, | |
2029 const std::vector<blink::WebCompositionUnderline>& underlines) { | |
2030 if (!GetRenderWidget()->ShouldHandleImeEvent()) | |
2031 return; | |
2032 ImeEventGuard guard(GetRenderWidget()); | |
2033 frame_->setCompositionFromExistingText(start, end, underlines); | |
2034 } | |
2035 | |
2036 void RenderFrameImpl::OnExecuteNoValueEditCommand(const std::string& name) { | 2013 void RenderFrameImpl::OnExecuteNoValueEditCommand(const std::string& name) { |
2037 frame_->executeCommand(WebString::fromUTF8(name)); | 2014 frame_->executeCommand(WebString::fromUTF8(name)); |
2038 } | 2015 } |
2039 | 2016 |
2040 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { | |
2041 if (!GetRenderWidget()->ShouldHandleImeEvent()) | |
2042 return; | |
2043 | |
2044 ImeEventGuard guard(GetRenderWidget()); | |
2045 frame_->extendSelectionAndDelete(before, after); | |
2046 } | |
2047 | |
2048 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { | 2017 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { |
2049 if (accessibility_mode_ == new_mode) | 2018 if (accessibility_mode_ == new_mode) |
2050 return; | 2019 return; |
2051 accessibility_mode_ = new_mode; | 2020 accessibility_mode_ = new_mode; |
2052 if (render_accessibility_) { | 2021 if (render_accessibility_) { |
2053 // Note: this isn't called automatically by the destructor because | 2022 // Note: this isn't called automatically by the destructor because |
2054 // there'd be no point in calling it in frame teardown, only if there's | 2023 // there'd be no point in calling it in frame teardown, only if there's |
2055 // an accessibility mode change but the frame is persisting. | 2024 // an accessibility mode change but the frame is persisting. |
2056 render_accessibility_->DisableAccessibility(); | 2025 render_accessibility_->DisableAccessibility(); |
2057 | 2026 |
(...skipping 4292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6350 // event target. Potentially a Pepper plugin will receive the event. | 6319 // event target. Potentially a Pepper plugin will receive the event. |
6351 // In order to tell whether a plugin gets the last mouse event and which it | 6320 // In order to tell whether a plugin gets the last mouse event and which it |
6352 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6321 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6353 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6322 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6354 // |pepper_last_mouse_event_target_|. | 6323 // |pepper_last_mouse_event_target_|. |
6355 pepper_last_mouse_event_target_ = nullptr; | 6324 pepper_last_mouse_event_target_ = nullptr; |
6356 #endif | 6325 #endif |
6357 } | 6326 } |
6358 | 6327 |
6359 } // namespace content | 6328 } // namespace content |
OLD | NEW |