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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 905 |
906 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event, | 906 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event, |
907 const ui::LatencyInfo& latency_info, | 907 const ui::LatencyInfo& latency_info, |
908 bool is_keyboard_shortcut) { | 908 bool is_keyboard_shortcut) { |
909 base::AutoReset<bool> handling_input_event_resetter( | 909 base::AutoReset<bool> handling_input_event_resetter( |
910 &handling_input_event_, true); | 910 &handling_input_event_, true); |
911 if (!input_event) | 911 if (!input_event) |
912 return; | 912 return; |
913 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( | 913 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( |
914 &handling_event_type_, input_event->type); | 914 &handling_event_type_, input_event->type); |
| 915 #if defined(OS_ANDROID) |
| 916 // On Android, when the delete key or forward delete key is pressed using IME, |
| 917 // |AdapterInputConnection| generates input key events to make sure all JS |
| 918 // listeners that monitor KeyUp and KeyDown events receive the proper key |
| 919 // code. Since this input key event comes from IME, we need to set the |
| 920 // IME event guard here to make sure it does not interfere with other IME |
| 921 // events. |
| 922 scoped_ptr<ImeEventGuard> ime_event_guard_maybe; |
| 923 if (WebInputEvent::isKeyboardEventType(input_event->type)) { |
| 924 const WebKeyboardEvent& key_event = |
| 925 *static_cast<const WebKeyboardEvent*>(input_event); |
| 926 if (key_event.nativeKeyCode == AKEYCODE_FORWARD_DEL || |
| 927 key_event.nativeKeyCode == AKEYCODE_DEL) { |
| 928 ime_event_guard_maybe.reset(new ImeEventGuard(this)); |
| 929 } |
| 930 } |
| 931 #endif |
915 | 932 |
916 base::AutoReset<const ui::LatencyInfo*> resetter(¤t_event_latency_info_, | 933 base::AutoReset<const ui::LatencyInfo*> resetter(¤t_event_latency_info_, |
917 &latency_info); | 934 &latency_info); |
918 | 935 |
919 base::TimeTicks start_time; | 936 base::TimeTicks start_time; |
920 if (base::TimeTicks::IsHighResNowFastAndReliable()) | 937 if (base::TimeTicks::IsHighResNowFastAndReliable()) |
921 start_time = base::TimeTicks::HighResNow(); | 938 start_time = base::TimeTicks::HighResNow(); |
922 | 939 |
923 const char* const event_name = | 940 const char* const event_name = |
924 WebInputEventTraits::GetName(input_event->type); | 941 WebInputEventTraits::GetName(input_event->type); |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2073 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2090 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2074 video_hole_frames_.AddObserver(frame); | 2091 video_hole_frames_.AddObserver(frame); |
2075 } | 2092 } |
2076 | 2093 |
2077 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2094 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2078 video_hole_frames_.RemoveObserver(frame); | 2095 video_hole_frames_.RemoveObserver(frame); |
2079 } | 2096 } |
2080 #endif // defined(VIDEO_HOLE) | 2097 #endif // defined(VIDEO_HOLE) |
2081 | 2098 |
2082 } // namespace content | 2099 } // namespace content |
OLD | NEW |