Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2644843004: Send keyboard-derived commands only if the key events are sent (Closed)
Patch Set: add TODO Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 } 1172 }
1173 return; 1173 return;
1174 } 1174 }
1175 1175
1176 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency); 1176 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency);
1177 input_router_->SendTouchEvent(touch_with_latency); 1177 input_router_->SendTouchEvent(touch_with_latency);
1178 } 1178 }
1179 1179
1180 void RenderWidgetHostImpl::ForwardKeyboardEvent( 1180 void RenderWidgetHostImpl::ForwardKeyboardEvent(
1181 const NativeWebKeyboardEvent& key_event) { 1181 const NativeWebKeyboardEvent& key_event) {
1182 ForwardKeyboardEventWithCommands(key_event, nullptr);
1183 }
1184
1185 void RenderWidgetHostImpl::ForwardKeyboardEventWithCommands(
1186 const NativeWebKeyboardEvent& key_event,
1187 const std::vector<EditCommand>* commands) {
1182 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); 1188 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent");
1183 if (owner_delegate_ && 1189 if (owner_delegate_ &&
1184 !owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) { 1190 !owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) {
1185 return; 1191 return;
1186 } 1192 }
1187 1193
1188 if (ShouldDropInputEvents()) 1194 if (ShouldDropInputEvents())
1189 return; 1195 return;
1190 1196
1191 if (!process_->HasConnection()) 1197 if (!process_->HasConnection())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 suppress_events_until_keydown_ = false; 1244 suppress_events_until_keydown_ = false;
1239 } 1245 }
1240 1246
1241 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) 1247 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event))
1242 return; 1248 return;
1243 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER); 1249 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER);
1244 NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event, 1250 NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event,
1245 latency_info); 1251 latency_info);
1246 key_event_with_latency.event.isBrowserShortcut = is_shortcut; 1252 key_event_with_latency.event.isBrowserShortcut = is_shortcut;
1247 DispatchInputEventWithLatencyInfo(key_event, &key_event_with_latency.latency); 1253 DispatchInputEventWithLatencyInfo(key_event, &key_event_with_latency.latency);
1254 // TODO(foolip): |InputRouter::SendKeyboardEvent()| may filter events, in
1255 // which the commands will be treated as belonging to the next key event.
1256 // InputMsg_SetEditCommandsForNextKeyEvent should only be sent if
1257 // InputMsg_HandleInputEvent is, but has to be sent first.
1258 // https://crbug.com/684298
1259 if (commands && !commands->empty()) {
1260 Send(
1261 new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), *commands));
1262 }
1248 input_router_->SendKeyboardEvent(key_event_with_latency); 1263 input_router_->SendKeyboardEvent(key_event_with_latency);
1249 } 1264 }
1250 1265
1251 void RenderWidgetHostImpl::QueueSyntheticGesture( 1266 void RenderWidgetHostImpl::QueueSyntheticGesture(
1252 std::unique_ptr<SyntheticGesture> synthetic_gesture, 1267 std::unique_ptr<SyntheticGesture> synthetic_gesture,
1253 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { 1268 const base::Callback<void(SyntheticGesture::Result)>& on_complete) {
1254 if (!synthetic_gesture_controller_ && view_) { 1269 if (!synthetic_gesture_controller_ && view_) {
1255 synthetic_gesture_controller_.reset( 1270 synthetic_gesture_controller_.reset(
1256 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); 1271 new SyntheticGestureController(view_->CreateSyntheticGestureTarget()));
1257 } 1272 }
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2522 // different from the receiver's. 2537 // different from the receiver's.
2523 file_system_file.url = 2538 file_system_file.url =
2524 GURL(storage::GetIsolatedFileSystemRootURIString( 2539 GURL(storage::GetIsolatedFileSystemRootURIString(
2525 file_system_url.origin(), filesystem_id, std::string()) 2540 file_system_url.origin(), filesystem_id, std::string())
2526 .append(register_name)); 2541 .append(register_name));
2527 file_system_file.filesystem_id = filesystem_id; 2542 file_system_file.filesystem_id = filesystem_id;
2528 } 2543 }
2529 } 2544 }
2530 2545
2531 } // namespace content 2546 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698