| 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 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2116 } | 2116 } |
| 2117 } | 2117 } |
| 2118 #endif | 2118 #endif |
| 2119 | 2119 |
| 2120 void RenderWidget::didHandleGestureEvent( | 2120 void RenderWidget::didHandleGestureEvent( |
| 2121 const WebGestureEvent& event, | 2121 const WebGestureEvent& event, |
| 2122 bool event_cancelled) { | 2122 bool event_cancelled) { |
| 2123 #if defined(OS_ANDROID) || defined(USE_AURA) | 2123 #if defined(OS_ANDROID) || defined(USE_AURA) |
| 2124 if (event_cancelled) | 2124 if (event_cancelled) |
| 2125 return; | 2125 return; |
| 2126 if (event.type == WebInputEvent::GestureTap) { | 2126 if (event.type() == WebInputEvent::GestureTap) { |
| 2127 UpdateTextInputState(ShowIme::IF_NEEDED, ChangeSource::FROM_NON_IME); | 2127 UpdateTextInputState(ShowIme::IF_NEEDED, ChangeSource::FROM_NON_IME); |
| 2128 } else if (event.type == WebInputEvent::GestureLongPress) { | 2128 } else if (event.type() == WebInputEvent::GestureLongPress) { |
| 2129 DCHECK(GetWebWidget()); | 2129 DCHECK(GetWebWidget()); |
| 2130 blink::WebInputMethodController* controller = GetInputMethodController(); | 2130 blink::WebInputMethodController* controller = GetInputMethodController(); |
| 2131 if (!controller || controller->textInputInfo().value.isEmpty()) | 2131 if (!controller || controller->textInputInfo().value.isEmpty()) |
| 2132 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME); | 2132 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME); |
| 2133 else | 2133 else |
| 2134 UpdateTextInputState(ShowIme::IF_NEEDED, ChangeSource::FROM_NON_IME); | 2134 UpdateTextInputState(ShowIme::IF_NEEDED, ChangeSource::FROM_NON_IME); |
| 2135 } | 2135 } |
| 2136 // TODO(ananta): Piggyback off existing IPCs to communicate this information, | 2136 // TODO(ananta): Piggyback off existing IPCs to communicate this information, |
| 2137 // crbug/420130. | 2137 // crbug/420130. |
| 2138 #if defined(OS_WIN) | 2138 #if defined(OS_WIN) |
| 2139 if (event.type != blink::WebGestureEvent::GestureTap) | 2139 if (event.type() != blink::WebGestureEvent::GestureTap) |
| 2140 return; | 2140 return; |
| 2141 | 2141 |
| 2142 // TODO(estade): hit test the event against focused node to make sure | 2142 // TODO(estade): hit test the event against focused node to make sure |
| 2143 // the tap actually hit the focused node. | 2143 // the tap actually hit the focused node. |
| 2144 blink::WebInputMethodController* controller = GetInputMethodController(); | 2144 blink::WebInputMethodController* controller = GetInputMethodController(); |
| 2145 blink::WebTextInputType text_input_type = | 2145 blink::WebTextInputType text_input_type = |
| 2146 controller ? controller->textInputType() : blink::WebTextInputTypeNone; | 2146 controller ? controller->textInputType() : blink::WebTextInputTypeNone; |
| 2147 | 2147 |
| 2148 Send(new ViewHostMsg_FocusedNodeTouched( | 2148 Send(new ViewHostMsg_FocusedNodeTouched( |
| 2149 routing_id_, text_input_type != blink::WebTextInputTypeNone)); | 2149 routing_id_, text_input_type != blink::WebTextInputTypeNone)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2274 // browser side (https://crbug.com/669219). | 2274 // browser side (https://crbug.com/669219). |
| 2275 // If there is no WebFrameWidget, then there will be no | 2275 // If there is no WebFrameWidget, then there will be no |
| 2276 // InputMethodControllers for a WebLocalFrame. | 2276 // InputMethodControllers for a WebLocalFrame. |
| 2277 return nullptr; | 2277 return nullptr; |
| 2278 } | 2278 } |
| 2279 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2279 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2280 ->getActiveWebInputMethodController(); | 2280 ->getActiveWebInputMethodController(); |
| 2281 } | 2281 } |
| 2282 | 2282 |
| 2283 } // namespace content | 2283 } // namespace content |
| OLD | NEW |