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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 view_->ProcessAckedTouchEvent( | 1149 view_->ProcessAckedTouchEvent( |
1150 touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED); | 1150 touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED); |
1151 } | 1151 } |
1152 return; | 1152 return; |
1153 } | 1153 } |
1154 | 1154 |
1155 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency); | 1155 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency); |
1156 input_router_->SendTouchEvent(touch_with_latency); | 1156 input_router_->SendTouchEvent(touch_with_latency); |
1157 } | 1157 } |
1158 | 1158 |
1159 void RenderWidgetHostImpl::ForwardKeyboardEvent( | 1159 void RenderWidgetHostImpl::ForwardKeyboardEventWithLatencyInfo( |
1160 const NativeWebKeyboardEvent& key_event) { | 1160 const NativeWebKeyboardEvent& key_event, |
1161 ForwardKeyboardEventWithCommands(key_event, nullptr, nullptr); | 1161 const ui::LatencyInfo& ui_latency) { |
| 1162 ForwardKeyboardEventWithCommands(key_event, ui_latency, nullptr, nullptr); |
1162 } | 1163 } |
1163 | 1164 |
1164 void RenderWidgetHostImpl::ForwardKeyboardEventWithCommands( | 1165 void RenderWidgetHostImpl::ForwardKeyboardEventWithCommands( |
1165 const NativeWebKeyboardEvent& key_event, | 1166 const NativeWebKeyboardEvent& key_event, |
| 1167 const ui::LatencyInfo& ui_latency, |
1166 const std::vector<EditCommand>* commands, | 1168 const std::vector<EditCommand>* commands, |
1167 bool* update_event) { | 1169 bool* update_event) { |
1168 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); | 1170 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); |
1169 if (owner_delegate_ && | 1171 if (owner_delegate_ && |
1170 !owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) { | 1172 !owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) { |
1171 return; | 1173 return; |
1172 } | 1174 } |
1173 | 1175 |
1174 if (ShouldDropInputEvents()) | 1176 if (ShouldDropInputEvents()) |
1175 return; | 1177 return; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 is_shortcut = true; | 1234 is_shortcut = true; |
1233 break; | 1235 break; |
1234 } | 1236 } |
1235 | 1237 |
1236 if (key_event.type() == WebKeyboardEvent::RawKeyDown) | 1238 if (key_event.type() == WebKeyboardEvent::RawKeyDown) |
1237 suppress_events_until_keydown_ = false; | 1239 suppress_events_until_keydown_ = false; |
1238 } | 1240 } |
1239 | 1241 |
1240 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) | 1242 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) |
1241 return; | 1243 return; |
1242 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER); | |
1243 NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event, | 1244 NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event, |
1244 latency_info); | 1245 ui_latency); |
1245 key_event_with_latency.event.isBrowserShortcut = is_shortcut; | 1246 key_event_with_latency.event.isBrowserShortcut = is_shortcut; |
1246 DispatchInputEventWithLatencyInfo(key_event, &key_event_with_latency.latency); | 1247 DispatchInputEventWithLatencyInfo(key_event, &key_event_with_latency.latency); |
1247 // TODO(foolip): |InputRouter::SendKeyboardEvent()| may filter events, in | 1248 // TODO(foolip): |InputRouter::SendKeyboardEvent()| may filter events, in |
1248 // which the commands will be treated as belonging to the next key event. | 1249 // which the commands will be treated as belonging to the next key event. |
1249 // InputMsg_SetEditCommandsForNextKeyEvent should only be sent if | 1250 // InputMsg_SetEditCommandsForNextKeyEvent should only be sent if |
1250 // InputMsg_HandleInputEvent is, but has to be sent first. | 1251 // InputMsg_HandleInputEvent is, but has to be sent first. |
1251 // https://crbug.com/684298 | 1252 // https://crbug.com/684298 |
1252 if (commands && !commands->empty()) { | 1253 if (commands && !commands->empty()) { |
1253 Send( | 1254 Send( |
1254 new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), *commands)); | 1255 new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), *commands)); |
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 | 2641 |
2641 // After navigation, if a frame belonging to the new page is received, stop | 2642 // After navigation, if a frame belonging to the new page is received, stop |
2642 // the timer that triggers clearing the graphics of the last page. | 2643 // the timer that triggers clearing the graphics of the last page. |
2643 if (last_received_content_source_id_ >= current_content_source_id_ && | 2644 if (last_received_content_source_id_ >= current_content_source_id_ && |
2644 new_content_rendering_timeout_->IsRunning()) { | 2645 new_content_rendering_timeout_->IsRunning()) { |
2645 new_content_rendering_timeout_->Stop(); | 2646 new_content_rendering_timeout_->Stop(); |
2646 } | 2647 } |
2647 } | 2648 } |
2648 | 2649 |
2649 } // namespace content | 2650 } // namespace content |
OLD | NEW |