| 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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 | 1219 |
| 1220 #if defined(OS_ANDROID) | 1220 #if defined(OS_ANDROID) |
| 1221 // Allow the IME to be shown when the focus changes as a consequence | 1221 // Allow the IME to be shown when the focus changes as a consequence |
| 1222 // of a processed touch end event. | 1222 // of a processed touch end event. |
| 1223 if (input_event->type == WebInputEvent::TouchEnd && processed) | 1223 if (input_event->type == WebInputEvent::TouchEnd && processed) |
| 1224 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); | 1224 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); |
| 1225 #elif defined(USE_AURA) | 1225 #elif defined(USE_AURA) |
| 1226 // Show the virtual keyboard if enabled and a user gesture triggers a focus | 1226 // Show the virtual keyboard if enabled and a user gesture triggers a focus |
| 1227 // change. | 1227 // change. |
| 1228 if (processed && (input_event->type == WebInputEvent::TouchEnd || | 1228 if (processed && (input_event->type == WebInputEvent::TouchEnd || |
| 1229 input_event->type == WebInputEvent::MouseUp)) | 1229 input_event->type == WebInputEvent::MouseUp)) { |
| 1230 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_IME); | 1230 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_IME); |
| 1231 } |
| 1231 #endif | 1232 #endif |
| 1232 | 1233 |
| 1233 if (!prevent_default) { | 1234 if (!prevent_default) { |
| 1234 if (WebInputEvent::isKeyboardEventType(input_event->type)) | 1235 if (WebInputEvent::isKeyboardEventType(input_event->type)) |
| 1235 DidHandleKeyEvent(); | 1236 DidHandleKeyEvent(); |
| 1236 if (WebInputEvent::isMouseEventType(input_event->type)) | 1237 if (WebInputEvent::isMouseEventType(input_event->type)) |
| 1237 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); | 1238 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); |
| 1238 if (WebInputEvent::isTouchEventType(input_event->type)) | 1239 if (WebInputEvent::isTouchEventType(input_event->type)) |
| 1239 DidHandleTouchEvent(*(static_cast<const WebTouchEvent*>(input_event))); | 1240 DidHandleTouchEvent(*(static_cast<const WebTouchEvent*>(input_event))); |
| 1240 } | 1241 } |
| 1242 |
| 1243 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with |
| 1244 // virtual keyboard. |
| 1245 #if !defined(OS_ANDROID) |
| 1246 // Virtual keyboard is not supported, so react to focus change immediately. |
| 1247 if (processed && (input_event->type == WebInputEvent::TouchEnd || |
| 1248 input_event->type == WebInputEvent::MouseUp)) { |
| 1249 FocusChangeComplete(); |
| 1250 } |
| 1251 #endif |
| 1241 } | 1252 } |
| 1242 | 1253 |
| 1243 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { | 1254 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { |
| 1244 if (webwidget_) | 1255 if (webwidget_) |
| 1245 webwidget_->setCursorVisibilityState(is_visible); | 1256 webwidget_->setCursorVisibilityState(is_visible); |
| 1246 } | 1257 } |
| 1247 | 1258 |
| 1248 void RenderWidget::OnMouseCaptureLost() { | 1259 void RenderWidget::OnMouseCaptureLost() { |
| 1249 if (webwidget_) | 1260 if (webwidget_) |
| 1250 webwidget_->mouseCaptureLost(); | 1261 webwidget_->mouseCaptureLost(); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1686 } | 1697 } |
| 1687 | 1698 |
| 1688 void RenderWidget::showImeIfNeeded() { | 1699 void RenderWidget::showImeIfNeeded() { |
| 1689 OnShowImeIfNeeded(); | 1700 OnShowImeIfNeeded(); |
| 1690 } | 1701 } |
| 1691 | 1702 |
| 1692 void RenderWidget::OnShowImeIfNeeded() { | 1703 void RenderWidget::OnShowImeIfNeeded() { |
| 1693 #if defined(OS_ANDROID) || defined(USE_AURA) | 1704 #if defined(OS_ANDROID) || defined(USE_AURA) |
| 1694 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); | 1705 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); |
| 1695 #endif | 1706 #endif |
| 1707 |
| 1708 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with |
| 1709 // virtual keyboard. |
| 1710 #if !defined(OS_ANDROID) |
| 1711 FocusChangeComplete(); |
| 1712 #endif |
| 1696 } | 1713 } |
| 1697 | 1714 |
| 1698 #if defined(OS_ANDROID) | 1715 #if defined(OS_ANDROID) |
| 1699 void RenderWidget::IncrementOutstandingImeEventAcks() { | 1716 void RenderWidget::IncrementOutstandingImeEventAcks() { |
| 1700 ++outstanding_ime_acks_; | 1717 ++outstanding_ime_acks_; |
| 1701 } | 1718 } |
| 1702 | 1719 |
| 1703 void RenderWidget::OnImeEventAck() { | 1720 void RenderWidget::OnImeEventAck() { |
| 1704 --outstanding_ime_acks_; | 1721 --outstanding_ime_acks_; |
| 1705 DCHECK(outstanding_ime_acks_ >= 0); | 1722 DCHECK(outstanding_ime_acks_ >= 0); |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2389 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2373 video_hole_frames_.AddObserver(frame); | 2390 video_hole_frames_.AddObserver(frame); |
| 2374 } | 2391 } |
| 2375 | 2392 |
| 2376 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2393 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2377 video_hole_frames_.RemoveObserver(frame); | 2394 video_hole_frames_.RemoveObserver(frame); |
| 2378 } | 2395 } |
| 2379 #endif // defined(VIDEO_HOLE) | 2396 #endif // defined(VIDEO_HOLE) |
| 2380 | 2397 |
| 2381 } // namespace content | 2398 } // namespace content |
| OLD | NEW |