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

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: Send keyboard-derived commands only if the key events are sent Created 3 years, 11 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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 } 1174 }
1175 return; 1175 return;
1176 } 1176 }
1177 1177
1178 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency); 1178 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency);
1179 input_router_->SendTouchEvent(touch_with_latency); 1179 input_router_->SendTouchEvent(touch_with_latency);
1180 } 1180 }
1181 1181
1182 void RenderWidgetHostImpl::ForwardKeyboardEvent( 1182 void RenderWidgetHostImpl::ForwardKeyboardEvent(
1183 const NativeWebKeyboardEvent& key_event) { 1183 const NativeWebKeyboardEvent& key_event) {
1184 ForwardKeyboardEventWithCommands(key_event, nullptr);
1185 }
1186
1187 void RenderWidgetHostImpl::ForwardKeyboardEventWithCommands(
1188 const NativeWebKeyboardEvent& key_event,
1189 const std::vector<EditCommand>* commands) {
1184 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); 1190 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent");
1185 if (owner_delegate_ && 1191 if (owner_delegate_ &&
1186 !owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) { 1192 !owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) {
1187 return; 1193 return;
1188 } 1194 }
1189 1195
1190 if (ShouldDropInputEvents()) 1196 if (ShouldDropInputEvents())
1191 return; 1197 return;
1192 1198
1193 if (!process_->HasConnection()) 1199 if (!process_->HasConnection())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 suppress_events_until_keydown_ = false; 1246 suppress_events_until_keydown_ = false;
1241 } 1247 }
1242 1248
1243 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) 1249 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event))
1244 return; 1250 return;
1245 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER); 1251 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER);
1246 NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event, 1252 NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event,
1247 latency_info); 1253 latency_info);
1248 key_event_with_latency.event.isBrowserShortcut = is_shortcut; 1254 key_event_with_latency.event.isBrowserShortcut = is_shortcut;
1249 DispatchInputEventWithLatencyInfo(key_event, &key_event_with_latency.latency); 1255 DispatchInputEventWithLatencyInfo(key_event, &key_event_with_latency.latency);
1256 if (commands && !commands->empty()) {
1257 Send(
1258 new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), *commands));
1259 }
1250 input_router_->SendKeyboardEvent(key_event_with_latency); 1260 input_router_->SendKeyboardEvent(key_event_with_latency);
sadrul 2017/01/20 18:20:15 InputRouter can do additional queueing/filtering.
foolip 2017/01/20 20:01:40 At which point in InputRouterImpl will it be undou
sadrul 2017/01/20 21:57:22 InputRouterImpl::OfferToRendere [1] I believe is w
foolip 2017/01/20 22:33:12 I can believe that, even passing it alongside the
1251 } 1261 }
1252 1262
1253 void RenderWidgetHostImpl::QueueSyntheticGesture( 1263 void RenderWidgetHostImpl::QueueSyntheticGesture(
1254 std::unique_ptr<SyntheticGesture> synthetic_gesture, 1264 std::unique_ptr<SyntheticGesture> synthetic_gesture,
1255 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { 1265 const base::Callback<void(SyntheticGesture::Result)>& on_complete) {
1256 if (!synthetic_gesture_controller_ && view_) { 1266 if (!synthetic_gesture_controller_ && view_) {
1257 synthetic_gesture_controller_.reset( 1267 synthetic_gesture_controller_.reset(
1258 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); 1268 new SyntheticGestureController(view_->CreateSyntheticGestureTarget()));
1259 } 1269 }
1260 if (synthetic_gesture_controller_) { 1270 if (synthetic_gesture_controller_) {
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 // different from the receiver's. 2536 // different from the receiver's.
2527 file_system_file.url = 2537 file_system_file.url =
2528 GURL(storage::GetIsolatedFileSystemRootURIString( 2538 GURL(storage::GetIsolatedFileSystemRootURIString(
2529 file_system_url.origin(), filesystem_id, std::string()) 2539 file_system_url.origin(), filesystem_id, std::string())
2530 .append(register_name)); 2540 .append(register_name));
2531 file_system_file.filesystem_id = filesystem_id; 2541 file_system_file.filesystem_id = filesystem_id;
2532 } 2542 }
2533 } 2543 }
2534 2544
2535 } // namespace content 2545 } // 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