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

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

Issue 2756893002: Add Keyboard Latency UMA Metrics. (Closed)
Patch Set: Fix a few compile issues. 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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); 2223 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow());
2223 #endif 2224 #endif
2224 } 2225 }
2225 2226
2226 void RenderWidgetHostViewAura::DetachFromInputMethod() { 2227 void RenderWidgetHostViewAura::DetachFromInputMethod() {
2227 ui::InputMethod* input_method = GetInputMethod(); 2228 ui::InputMethod* input_method = GetInputMethod();
2228 if (input_method) 2229 if (input_method)
2229 input_method->DetachTextInputClient(this); 2230 input_method->DetachTextInputClient(this);
2230 } 2231 }
2231 2232
2232 void RenderWidgetHostViewAura::ForwardKeyboardEvent( 2233 void RenderWidgetHostViewAura::ForwardKeyboardEventWithLatencyInfo(
2233 const NativeWebKeyboardEvent& event, 2234 const NativeWebKeyboardEvent& event,
2235 const ui::LatencyInfo& latency,
2234 bool* update_event) { 2236 bool* update_event) {
2235 RenderWidgetHostImpl* target_host = host_; 2237 RenderWidgetHostImpl* target_host = host_;
2236 2238
2237 // If there are multiple widgets on the page (such as when there are 2239 // If there are multiple widgets on the page (such as when there are
2238 // out-of-process iframes), pick the one that should process this event. 2240 // out-of-process iframes), pick the one that should process this event.
2239 if (host_->delegate()) 2241 if (host_->delegate())
2240 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); 2242 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_);
2241 if (!target_host) 2243 if (!target_host)
2242 return; 2244 return;
2243 2245
2244 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 2246 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
2245 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = 2247 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate =
2246 ui::GetTextEditKeyBindingsDelegate(); 2248 ui::GetTextEditKeyBindingsDelegate();
2247 std::vector<ui::TextEditCommandAuraLinux> commands; 2249 std::vector<ui::TextEditCommandAuraLinux> commands;
2248 if (!event.skip_in_browser && 2250 if (!event.skip_in_browser &&
2249 keybinding_delegate && 2251 keybinding_delegate &&
2250 event.os_event && 2252 event.os_event &&
2251 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { 2253 keybinding_delegate->MatchEvent(*event.os_event, &commands)) {
2252 // Transform from ui/ types to content/ types. 2254 // Transform from ui/ types to content/ types.
2253 EditCommands edit_commands; 2255 EditCommands edit_commands;
2254 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = 2256 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it =
2255 commands.begin(); it != commands.end(); ++it) { 2257 commands.begin(); it != commands.end(); ++it) {
2256 edit_commands.push_back(EditCommand(it->GetCommandString(), 2258 edit_commands.push_back(EditCommand(it->GetCommandString(),
2257 it->argument())); 2259 it->argument()));
2258 } 2260 }
2259 2261
2260 target_host->ForwardKeyboardEventWithCommands(event, &edit_commands, 2262 target_host->ForwardKeyboardEventWithCommands(event, latency,
2261 update_event); 2263 &edit_commands, update_event);
2262 return; 2264 return;
2263 } 2265 }
2264 #endif 2266 #endif
2265 2267
2266 target_host->ForwardKeyboardEventWithCommands(event, nullptr, update_event); 2268 target_host->ForwardKeyboardEventWithCommands(event, latency, nullptr,
2269 update_event);
2267 } 2270 }
2268 2271
2269 void RenderWidgetHostViewAura::CreateSelectionController() { 2272 void RenderWidgetHostViewAura::CreateSelectionController() {
2270 ui::TouchSelectionController::Config tsc_config; 2273 ui::TouchSelectionController::Config tsc_config;
2271 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( 2274 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds(
2272 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); 2275 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms());
2273 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() 2276 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance()
2274 ->max_touch_move_in_pixels_for_click(); 2277 ->max_touch_move_in_pixels_for_click();
2275 tsc_config.enable_longpress_drag_selection = false; 2278 tsc_config.enable_longpress_drag_selection = false;
2276 selection_controller_.reset(new ui::TouchSelectionController( 2279 selection_controller_.reset(new ui::TouchSelectionController(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 } 2383 }
2381 2384
2382 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { 2385 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() {
2383 if (!delegated_frame_host_) 2386 if (!delegated_frame_host_)
2384 return; 2387 return;
2385 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || 2388 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ ||
2386 needs_flush_input_); 2389 needs_flush_input_);
2387 } 2390 }
2388 2391
2389 } // namespace content 2392 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698