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

Side by Side Diff: chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm

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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/app/vector_icons/vector_icons.h" 10 #include "chrome/app/vector_icons/vector_icons.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 return NO; 291 return NO;
292 292
293 // Sanity-check to make sure we got a keyboard event. 293 // Sanity-check to make sure we got a keyboard event.
294 NSEvent* event = [NSApp currentEvent]; 294 NSEvent* event = [NSApp currentEvent];
295 if ([event type] != NSKeyDown && [event type] != NSKeyUp) 295 if ([event type] != NSKeyDown && [event type] != NSKeyUp)
296 return NO; 296 return NO;
297 297
298 // Forward the event to the renderer. 298 // Forward the event to the renderer.
299 // TODO(rohitrao): Should this call -[BaseView keyEvent:]? Is there code in 299 // TODO(rohitrao): Should this call -[BaseView keyEvent:]? Is there code in
300 // that function that we want to keep or avoid? Calling 300 // that function that we want to keep or avoid? Calling
301 // |ForwardKeyboardEvent()| directly ignores edit commands, which breaks 301 // |ForwardKeyboardEventWithLatencyInfo()| directly ignores edit commands,
302 // cmd-up/down if we ever decide to include |moveToBeginningOfDocument:| in 302 // which breaks cmd-up/down if we ever decide to include
303 // the list above. 303 // |moveToBeginningOfDocument:| in the list above.
304 content::RenderViewHost* render_view_host = 304 content::RenderViewHost* render_view_host =
305 web_contents->GetRenderViewHost(); 305 web_contents->GetRenderViewHost();
306 render_view_host->GetWidget()->ForwardKeyboardEvent( 306
307 NativeWebKeyboardEvent(event)); 307 LatencyInfo latency;
308 latency->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
309
310 render_view_host->GetWidget()->ForwardKeyboardEventWithLatencyInfo(
311 NativeWebKeyboardEvent(event), latency);
308 return YES; 312 return YES;
309 } 313 }
310 314
311 return NO; 315 return NO;
312 } 316 }
313 317
314 // Methods from FindBar 318 // Methods from FindBar
315 - (void)showFindBar:(BOOL)animate { 319 - (void)showFindBar:(BOOL)animate {
316 // Save the currently-focused view. |findBarView_| is in the view 320 // Save the currently-focused view. |findBarView_| is in the view
317 // hierarchy by now. showFindBar can be called even when the 321 // hierarchy by now. showFindBar can be called even when the
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } 665 }
662 666
663 - (BrowserWindowController*)browserWindowController { 667 - (BrowserWindowController*)browserWindowController {
664 if (!browser_) 668 if (!browser_)
665 return nil; 669 return nil;
666 return [BrowserWindowController 670 return [BrowserWindowController
667 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()]; 671 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()];
668 } 672 }
669 673
670 @end 674 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698