| 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 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with |
| 1240 // virtual keyboard. |
| 1241 #if !defined(OS_ANDROID) |
| 1242 // Virtual keyboard is not supported, so react to focus change immediately. |
| 1243 if (processed && (input_event->type == WebInputEvent::TouchEnd || |
| 1244 input_event->type == WebInputEvent::MouseUp)) { |
| 1245 FocusChangeComplete(); |
| 1246 } |
| 1247 #endif |
| 1237 } | 1248 } |
| 1238 | 1249 |
| 1239 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { | 1250 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { |
| 1240 if (webwidget_) | 1251 if (webwidget_) |
| 1241 webwidget_->setCursorVisibilityState(is_visible); | 1252 webwidget_->setCursorVisibilityState(is_visible); |
| 1242 } | 1253 } |
| 1243 | 1254 |
| 1244 void RenderWidget::OnMouseCaptureLost() { | 1255 void RenderWidget::OnMouseCaptureLost() { |
| 1245 if (webwidget_) | 1256 if (webwidget_) |
| 1246 webwidget_->mouseCaptureLost(); | 1257 webwidget_->mouseCaptureLost(); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 } | 1690 } |
| 1680 | 1691 |
| 1681 void RenderWidget::showImeIfNeeded() { | 1692 void RenderWidget::showImeIfNeeded() { |
| 1682 OnShowImeIfNeeded(); | 1693 OnShowImeIfNeeded(); |
| 1683 } | 1694 } |
| 1684 | 1695 |
| 1685 void RenderWidget::OnShowImeIfNeeded() { | 1696 void RenderWidget::OnShowImeIfNeeded() { |
| 1686 #if defined(OS_ANDROID) || defined(USE_AURA) | 1697 #if defined(OS_ANDROID) || defined(USE_AURA) |
| 1687 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); | 1698 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); |
| 1688 #endif | 1699 #endif |
| 1700 |
| 1701 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with |
| 1702 // virtual keyboard. |
| 1703 #if !defined(OS_ANDROID) |
| 1704 FocusChangeComplete(); |
| 1705 #endif |
| 1689 } | 1706 } |
| 1690 | 1707 |
| 1691 #if defined(OS_ANDROID) | 1708 #if defined(OS_ANDROID) |
| 1692 void RenderWidget::IncrementOutstandingImeEventAcks() { | 1709 void RenderWidget::IncrementOutstandingImeEventAcks() { |
| 1693 ++outstanding_ime_acks_; | 1710 ++outstanding_ime_acks_; |
| 1694 } | 1711 } |
| 1695 | 1712 |
| 1696 void RenderWidget::OnImeEventAck() { | 1713 void RenderWidget::OnImeEventAck() { |
| 1697 --outstanding_ime_acks_; | 1714 --outstanding_ime_acks_; |
| 1698 DCHECK(outstanding_ime_acks_ >= 0); | 1715 DCHECK(outstanding_ime_acks_ >= 0); |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2382 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2366 video_hole_frames_.AddObserver(frame); | 2383 video_hole_frames_.AddObserver(frame); |
| 2367 } | 2384 } |
| 2368 | 2385 |
| 2369 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2386 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2370 video_hole_frames_.RemoveObserver(frame); | 2387 video_hole_frames_.RemoveObserver(frame); |
| 2371 } | 2388 } |
| 2372 #endif // defined(VIDEO_HOLE) | 2389 #endif // defined(VIDEO_HOLE) |
| 2373 | 2390 |
| 2374 } // namespace content | 2391 } // namespace content |
| OLD | NEW |