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

Side by Side Diff: chrome/browser/ui/views/find_bar_host.cc

Issue 2756893002: Add Keyboard Latency UMA Metrics. (Closed)
Patch Set: Restrict to RawKeyDown and Char events on Android & Mac 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 "chrome/browser/ui/views/find_bar_host.h" 5 #include "chrome/browser/ui/views/find_bar_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 content::WebContents* contents = find_bar_controller_->web_contents(); 58 content::WebContents* contents = find_bar_controller_->web_contents();
59 if (!contents) 59 if (!contents)
60 return false; 60 return false;
61 61
62 // Make sure we don't have a text field element interfering with keyboard 62 // Make sure we don't have a text field element interfering with keyboard
63 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". 63 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom".
64 contents->ClearFocusedElement(); 64 contents->ClearFocusedElement();
65 NativeWebKeyboardEvent event(key_event); 65 NativeWebKeyboardEvent event(key_event);
66 contents->GetRenderViewHost()->GetWidget()->ForwardKeyboardEvent(event); 66 contents->GetRenderViewHost()
67 ->GetWidget()
68 ->ForwardKeyboardEventWithLatencyInfo(event, *key_event.latency());
67 return true; 69 return true;
68 } 70 }
69 71
70 FindBarController* FindBarHost::GetFindBarController() const { 72 FindBarController* FindBarHost::GetFindBarController() const {
71 return find_bar_controller_; 73 return find_bar_controller_;
72 } 74 }
73 75
74 void FindBarHost::SetFindBarController(FindBarController* find_bar_controller) { 76 void FindBarHost::SetFindBarController(FindBarController* find_bar_controller) {
75 find_bar_controller_ = find_bar_controller; 77 find_bar_controller_ = find_bar_controller;
76 } 78 }
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 349
348 //////////////////////////////////////////////////////////////////////////////// 350 ////////////////////////////////////////////////////////////////////////////////
349 // private: 351 // private:
350 352
351 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { 353 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) {
352 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); 354 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen();
353 gfx::Rect webcontents_rect = 355 gfx::Rect webcontents_rect =
354 find_bar_controller_->web_contents()->GetViewBounds(); 356 find_bar_controller_->web_contents()->GetViewBounds();
355 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); 357 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y());
356 } 358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698