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

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

Issue 2756893002: Add Keyboard Latency UMA Metrics. (Closed)
Patch Set: mfomitchev responses, rebase Created 3 years, 7 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_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { 1218 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) {
1219 popup_child_host_view_->InsertChar(event); 1219 popup_child_host_view_->InsertChar(event);
1220 return; 1220 return;
1221 } 1221 }
1222 1222
1223 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 1223 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547
1224 // TODO(wjmaclean): can host_ ever be null? 1224 // TODO(wjmaclean): can host_ ever be null?
1225 if (host_ && (event_handler_->accept_return_character() || 1225 if (host_ && (event_handler_->accept_return_character() ||
1226 event.GetCharacter() != ui::VKEY_RETURN)) { 1226 event.GetCharacter() != ui::VKEY_RETURN)) {
1227 // Send a blink::WebInputEvent::Char event to |host_|. 1227 // Send a blink::WebInputEvent::Char event to |host_|.
1228 ForwardKeyboardEvent(NativeWebKeyboardEvent(event, event.GetCharacter()), 1228 ForwardKeyboardEventWithLatencyInfo(
1229 nullptr); 1229 NativeWebKeyboardEvent(event, event.GetCharacter()), *event.latency(),
1230 nullptr);
1230 } 1231 }
1231 } 1232 }
1232 1233
1233 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { 1234 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const {
1234 if (text_input_manager_ && text_input_manager_->GetTextInputState()) 1235 if (text_input_manager_ && text_input_manager_->GetTextInputState())
1235 return text_input_manager_->GetTextInputState()->type; 1236 return text_input_manager_->GetTextInputState()->type;
1236 return ui::TEXT_INPUT_TYPE_NONE; 1237 return ui::TEXT_INPUT_TYPE_NONE;
1237 } 1238 }
1238 1239
1239 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { 1240 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const {
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); 2221 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow());
2221 #endif 2222 #endif
2222 } 2223 }
2223 2224
2224 void RenderWidgetHostViewAura::DetachFromInputMethod() { 2225 void RenderWidgetHostViewAura::DetachFromInputMethod() {
2225 ui::InputMethod* input_method = GetInputMethod(); 2226 ui::InputMethod* input_method = GetInputMethod();
2226 if (input_method) 2227 if (input_method)
2227 input_method->DetachTextInputClient(this); 2228 input_method->DetachTextInputClient(this);
2228 } 2229 }
2229 2230
2230 void RenderWidgetHostViewAura::ForwardKeyboardEvent( 2231 void RenderWidgetHostViewAura::ForwardKeyboardEventWithLatencyInfo(
2231 const NativeWebKeyboardEvent& event, 2232 const NativeWebKeyboardEvent& event,
2233 const ui::LatencyInfo& latency,
2232 bool* update_event) { 2234 bool* update_event) {
2233 RenderWidgetHostImpl* target_host = host_; 2235 RenderWidgetHostImpl* target_host = host_;
2234 2236
2235 // If there are multiple widgets on the page (such as when there are 2237 // If there are multiple widgets on the page (such as when there are
2236 // out-of-process iframes), pick the one that should process this event. 2238 // out-of-process iframes), pick the one that should process this event.
2237 if (host_->delegate()) 2239 if (host_->delegate())
2238 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); 2240 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_);
2239 if (!target_host) 2241 if (!target_host)
2240 return; 2242 return;
2241 2243
2242 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 2244 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
2243 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = 2245 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate =
2244 ui::GetTextEditKeyBindingsDelegate(); 2246 ui::GetTextEditKeyBindingsDelegate();
2245 std::vector<ui::TextEditCommandAuraLinux> commands; 2247 std::vector<ui::TextEditCommandAuraLinux> commands;
2246 if (!event.skip_in_browser && 2248 if (!event.skip_in_browser &&
2247 keybinding_delegate && 2249 keybinding_delegate &&
2248 event.os_event && 2250 event.os_event &&
2249 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { 2251 keybinding_delegate->MatchEvent(*event.os_event, &commands)) {
2250 // Transform from ui/ types to content/ types. 2252 // Transform from ui/ types to content/ types.
2251 EditCommands edit_commands; 2253 EditCommands edit_commands;
2252 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = 2254 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it =
2253 commands.begin(); it != commands.end(); ++it) { 2255 commands.begin(); it != commands.end(); ++it) {
2254 edit_commands.push_back(EditCommand(it->GetCommandString(), 2256 edit_commands.push_back(EditCommand(it->GetCommandString(),
2255 it->argument())); 2257 it->argument()));
2256 } 2258 }
2257 2259
2258 target_host->ForwardKeyboardEventWithCommands(event, &edit_commands, 2260 target_host->ForwardKeyboardEventWithCommands(event, latency,
2259 update_event); 2261 &edit_commands, update_event);
2260 return; 2262 return;
2261 } 2263 }
2262 #endif 2264 #endif
2263 2265
2264 target_host->ForwardKeyboardEventWithCommands(event, nullptr, update_event); 2266 target_host->ForwardKeyboardEventWithCommands(event, latency, nullptr,
2267 update_event);
2265 } 2268 }
2266 2269
2267 void RenderWidgetHostViewAura::CreateSelectionController() { 2270 void RenderWidgetHostViewAura::CreateSelectionController() {
2268 ui::TouchSelectionController::Config tsc_config; 2271 ui::TouchSelectionController::Config tsc_config;
2269 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( 2272 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds(
2270 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); 2273 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms());
2271 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() 2274 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance()
2272 ->max_touch_move_in_pixels_for_click(); 2275 ->max_touch_move_in_pixels_for_click();
2273 tsc_config.enable_longpress_drag_selection = false; 2276 tsc_config.enable_longpress_drag_selection = false;
2274 selection_controller_.reset(new ui::TouchSelectionController( 2277 selection_controller_.reset(new ui::TouchSelectionController(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 } 2377 }
2375 2378
2376 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { 2379 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() {
2377 if (!delegated_frame_host_) 2380 if (!delegated_frame_host_)
2378 return; 2381 return;
2379 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || 2382 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ ||
2380 needs_flush_input_); 2383 needs_flush_input_);
2381 } 2384 }
2382 2385
2383 } // namespace content 2386 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698