Chromium Code Reviews| 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_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 | 589 |
| 590 bool handled = true; | 590 bool handled = true; |
| 591 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) | 591 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
| 592 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) | 592 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) |
| 593 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, | 593 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, |
| 594 OnCursorVisibilityChange) | 594 OnCursorVisibilityChange) |
| 595 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) | 595 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) |
| 596 IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText) | 596 IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText) |
| 597 IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText, | 597 IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText, |
| 598 OnImeFinishComposingText) | 598 OnImeFinishComposingText) |
| 599 IPC_MESSAGE_HANDLER(InputMsg_ApplySuggestionReplacement, | |
| 600 OnApplySuggestionReplacement) | |
|
esprehn
2017/01/31 22:41:34
Please use mojo.
rlanday
2017/01/31 23:30:09
Ok
| |
| 601 IPC_MESSAGE_HANDLER(InputMsg_DeleteSuggestionHighlight, | |
| 602 OnDeleteSuggestionHighlight) | |
| 603 IPC_MESSAGE_HANDLER(InputMsg_SuggestionMenuClosed, OnSuggestionMenuClosed) | |
| 599 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) | 604 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) |
| 600 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 605 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 601 OnSetEditCommandsForNextKeyEvent) | 606 OnSetEditCommandsForNextKeyEvent) |
| 602 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) | 607 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) |
| 603 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, | 608 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, |
| 604 OnSyntheticGestureCompleted) | 609 OnSyntheticGestureCompleted) |
| 605 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 610 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
| 606 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 611 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
| 607 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 612 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
| 608 OnEnableDeviceEmulation) | 613 OnEnableDeviceEmulation) |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1618 input_handler_->set_handling_input_event(true); | 1623 input_handler_->set_handling_input_event(true); |
| 1619 if (auto* controller = GetInputMethodController()) { | 1624 if (auto* controller = GetInputMethodController()) { |
| 1620 controller->finishComposingText( | 1625 controller->finishComposingText( |
| 1621 keep_selection ? WebInputMethodController::KeepSelection | 1626 keep_selection ? WebInputMethodController::KeepSelection |
| 1622 : WebInputMethodController::DoNotKeepSelection); | 1627 : WebInputMethodController::DoNotKeepSelection); |
| 1623 } | 1628 } |
| 1624 input_handler_->set_handling_input_event(false); | 1629 input_handler_->set_handling_input_event(false); |
| 1625 UpdateCompositionInfo(false /* not an immediate request */); | 1630 UpdateCompositionInfo(false /* not an immediate request */); |
| 1626 } | 1631 } |
| 1627 | 1632 |
| 1633 void RenderWidget::OnApplySuggestionReplacement(int document_marker_id, | |
| 1634 int suggestion_index) { | |
| 1635 if (auto* controller = GetInputMethodController()) { | |
| 1636 controller->applySuggestionReplacement(document_marker_id, | |
| 1637 suggestion_index); | |
| 1638 } | |
| 1639 } | |
| 1640 | |
| 1641 void RenderWidget::OnDeleteSuggestionHighlight() { | |
| 1642 if (auto* controller = GetInputMethodController()) { | |
| 1643 controller->deleteSuggestionHighlight(); | |
| 1644 } | |
| 1645 } | |
| 1646 | |
| 1647 void RenderWidget::OnSuggestionMenuClosed() { | |
| 1648 if (auto* controller = GetInputMethodController()) | |
| 1649 controller->suggestionMenuClosed(); | |
| 1650 } | |
| 1651 | |
| 1628 void RenderWidget::OnDeviceScaleFactorChanged() { | 1652 void RenderWidget::OnDeviceScaleFactorChanged() { |
| 1629 if (!compositor_) | 1653 if (!compositor_) |
| 1630 return; | 1654 return; |
| 1631 if (IsUseZoomForDSFEnabled()) | 1655 if (IsUseZoomForDSFEnabled()) |
| 1632 compositor_->SetPaintedDeviceScaleFactor(GetOriginalDeviceScaleFactor()); | 1656 compositor_->SetPaintedDeviceScaleFactor(GetOriginalDeviceScaleFactor()); |
| 1633 else | 1657 else |
| 1634 compositor_->setDeviceScaleFactor(device_scale_factor_); | 1658 compositor_->setDeviceScaleFactor(device_scale_factor_); |
| 1635 } | 1659 } |
| 1636 | 1660 |
| 1637 void RenderWidget::OnRepaint(gfx::Size size_to_paint) { | 1661 void RenderWidget::OnRepaint(gfx::Size size_to_paint) { |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2095 break; | 2119 break; |
| 2096 default: | 2120 default: |
| 2097 web_screen_info.orientationType = | 2121 web_screen_info.orientationType = |
| 2098 blink::WebScreenOrientationUndefined; | 2122 blink::WebScreenOrientationUndefined; |
| 2099 break; | 2123 break; |
| 2100 } | 2124 } |
| 2101 web_screen_info.orientationAngle = screen_info_.orientation_angle; | 2125 web_screen_info.orientationAngle = screen_info_.orientation_angle; |
| 2102 return web_screen_info; | 2126 return web_screen_info; |
| 2103 } | 2127 } |
| 2104 | 2128 |
| 2129 void RenderWidget::handlePotentialTextSuggestionTap() { | |
| 2130 blink::WebInputMethodController* controller = GetInputMethodController(); | |
| 2131 if (!controller) | |
| 2132 return; | |
| 2133 | |
| 2134 WebVector<blink::WebTextSuggestionInfo> suggestion_infos = | |
| 2135 controller->getTextSuggestionInfosUnderCaret(); | |
| 2136 | |
| 2137 if (suggestion_infos.size() == 0) | |
| 2138 return; | |
| 2139 | |
| 2140 // The composition is now on the suggestion range highlight | |
| 2141 UpdateCompositionInfo(false /* not an immediate request */); | |
| 2142 | |
| 2143 controller->prepareForTextSuggestionMenuToBeShown(); | |
|
esprehn
2017/01/31 22:41:34
This should all be done with mojo inside blink.
rlanday
2017/01/31 23:30:09
Ok
rlanday
2017/02/17 01:46:20
Is there a way to get access to the RenderWidget f
| |
| 2144 | |
| 2145 Send(new InputHostMsg_ShowTextSuggestionMenu( | |
| 2146 routing_id(), std::vector<blink::WebTextSuggestionInfo>( | |
| 2147 suggestion_infos.begin(), suggestion_infos.end()))); | |
| 2148 } | |
| 2149 | |
| 2105 void RenderWidget::resetInputMethod() { | 2150 void RenderWidget::resetInputMethod() { |
| 2106 ImeEventGuard guard(this); | 2151 ImeEventGuard guard(this); |
| 2107 Send(new InputHostMsg_ImeCancelComposition(routing_id())); | 2152 Send(new InputHostMsg_ImeCancelComposition(routing_id())); |
| 2108 | 2153 |
| 2109 UpdateCompositionInfo(false /* not an immediate request */); | 2154 UpdateCompositionInfo(false /* not an immediate request */); |
| 2110 } | 2155 } |
| 2111 | 2156 |
| 2112 #if defined(OS_ANDROID) | 2157 #if defined(OS_ANDROID) |
| 2113 void RenderWidget::showUnhandledTapUIIfNeeded( | 2158 void RenderWidget::showUnhandledTapUIIfNeeded( |
| 2114 const WebPoint& tapped_position, | 2159 const WebPoint& tapped_position, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2281 // browser side (https://crbug.com/669219). | 2326 // browser side (https://crbug.com/669219). |
| 2282 // If there is no WebFrameWidget, then there will be no | 2327 // If there is no WebFrameWidget, then there will be no |
| 2283 // InputMethodControllers for a WebLocalFrame. | 2328 // InputMethodControllers for a WebLocalFrame. |
| 2284 return nullptr; | 2329 return nullptr; |
| 2285 } | 2330 } |
| 2286 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2331 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2287 ->getActiveWebInputMethodController(); | 2332 ->getActiveWebInputMethodController(); |
| 2288 } | 2333 } |
| 2289 | 2334 |
| 2290 } // namespace content | 2335 } // namespace content |
| OLD | NEW |