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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 | 1215 |
1216 #if defined(OS_ANDROID) | 1216 #if defined(OS_ANDROID) |
1217 // Allow the IME to be shown when the focus changes as a consequence | 1217 // Allow the IME to be shown when the focus changes as a consequence |
1218 // of a processed touch end event. | 1218 // of a processed touch end event. |
1219 if (input_event->type == WebInputEvent::TouchEnd && processed) | 1219 if (input_event->type == WebInputEvent::TouchEnd && processed) |
1220 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); | 1220 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); |
1221 #elif defined(USE_AURA) | 1221 #elif defined(USE_AURA) |
1222 // Show the virtual keyboard if enabled and a user gesture triggers a focus | 1222 // Show the virtual keyboard if enabled and a user gesture triggers a focus |
1223 // change. | 1223 // change. |
1224 if (processed && (input_event->type == WebInputEvent::TouchEnd || | 1224 if (processed && (input_event->type == WebInputEvent::TouchEnd || |
1225 input_event->type == WebInputEvent::MouseUp)) | 1225 input_event->type == WebInputEvent::MouseUp)) { |
1226 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_IME); | 1226 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_IME); |
| 1227 } |
1227 #endif | 1228 #endif |
1228 | 1229 |
1229 if (!prevent_default) { | 1230 if (!prevent_default) { |
1230 if (WebInputEvent::isKeyboardEventType(input_event->type)) | 1231 if (WebInputEvent::isKeyboardEventType(input_event->type)) |
1231 DidHandleKeyEvent(); | 1232 DidHandleKeyEvent(); |
1232 if (WebInputEvent::isMouseEventType(input_event->type)) | 1233 if (WebInputEvent::isMouseEventType(input_event->type)) |
1233 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); | 1234 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); |
1234 if (WebInputEvent::isTouchEventType(input_event->type)) | 1235 if (WebInputEvent::isTouchEventType(input_event->type)) |
1235 DidHandleTouchEvent(*(static_cast<const WebTouchEvent*>(input_event))); | 1236 DidHandleTouchEvent(*(static_cast<const WebTouchEvent*>(input_event))); |
1236 } | 1237 } |
| 1238 |
| 1239 #if !defined(OS_ANDROID) && !defined(USE_AURA) |
| 1240 // Virtual keyboard is not supported, so react to focus change immediately. |
| 1241 if (processed && (input_event->type == WebInputEvent::TouchEnd || |
| 1242 input_event->type == WebInputEvent::MouseUp)) { |
| 1243 FocusChangeComplete(); |
| 1244 } |
| 1245 #endif |
1237 } | 1246 } |
1238 | 1247 |
1239 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { | 1248 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { |
1240 if (webwidget_) | 1249 if (webwidget_) |
1241 webwidget_->setCursorVisibilityState(is_visible); | 1250 webwidget_->setCursorVisibilityState(is_visible); |
1242 } | 1251 } |
1243 | 1252 |
1244 void RenderWidget::OnMouseCaptureLost() { | 1253 void RenderWidget::OnMouseCaptureLost() { |
1245 if (webwidget_) | 1254 if (webwidget_) |
1246 webwidget_->mouseCaptureLost(); | 1255 webwidget_->mouseCaptureLost(); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); | 1687 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); |
1679 } | 1688 } |
1680 | 1689 |
1681 void RenderWidget::showImeIfNeeded() { | 1690 void RenderWidget::showImeIfNeeded() { |
1682 OnShowImeIfNeeded(); | 1691 OnShowImeIfNeeded(); |
1683 } | 1692 } |
1684 | 1693 |
1685 void RenderWidget::OnShowImeIfNeeded() { | 1694 void RenderWidget::OnShowImeIfNeeded() { |
1686 #if defined(OS_ANDROID) || defined(USE_AURA) | 1695 #if defined(OS_ANDROID) || defined(USE_AURA) |
1687 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); | 1696 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); |
| 1697 #else |
| 1698 FocusChangeComplete(); |
1688 #endif | 1699 #endif |
1689 } | 1700 } |
1690 | 1701 |
1691 #if defined(OS_ANDROID) | 1702 #if defined(OS_ANDROID) |
1692 void RenderWidget::IncrementOutstandingImeEventAcks() { | 1703 void RenderWidget::IncrementOutstandingImeEventAcks() { |
1693 ++outstanding_ime_acks_; | 1704 ++outstanding_ime_acks_; |
1694 } | 1705 } |
1695 | 1706 |
1696 void RenderWidget::OnImeEventAck() { | 1707 void RenderWidget::OnImeEventAck() { |
1697 --outstanding_ime_acks_; | 1708 --outstanding_ime_acks_; |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2381 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2371 video_hole_frames_.AddObserver(frame); | 2382 video_hole_frames_.AddObserver(frame); |
2372 } | 2383 } |
2373 | 2384 |
2374 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2385 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2375 video_hole_frames_.RemoveObserver(frame); | 2386 video_hole_frames_.RemoveObserver(frame); |
2376 } | 2387 } |
2377 #endif // defined(VIDEO_HOLE) | 2388 #endif // defined(VIDEO_HOLE) |
2378 | 2389 |
2379 } // namespace content | 2390 } // namespace content |
OLD | NEW |