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