OLD | NEW |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 content::WebContents* contents = find_bar_controller_->web_contents(); | 57 content::WebContents* contents = find_bar_controller_->web_contents(); |
58 if (!contents) | 58 if (!contents) |
59 return false; | 59 return false; |
60 | 60 |
61 // Make sure we don't have a text field element interfering with keyboard | 61 // Make sure we don't have a text field element interfering with keyboard |
62 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". | 62 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". |
63 contents->ClearFocusedElement(); | 63 contents->ClearFocusedElement(); |
64 NativeWebKeyboardEvent event(key_event); | 64 NativeWebKeyboardEvent event(key_event); |
65 contents->GetRenderViewHost()->GetWidget()->ForwardKeyboardEvent(event); | 65 contents->GetRenderViewHost() |
| 66 ->GetWidget() |
| 67 ->ForwardKeyboardEventWithLatencyInfo(event, *key_event.latency()); |
66 return true; | 68 return true; |
67 } | 69 } |
68 | 70 |
69 FindBarController* FindBarHost::GetFindBarController() const { | 71 FindBarController* FindBarHost::GetFindBarController() const { |
70 return find_bar_controller_; | 72 return find_bar_controller_; |
71 } | 73 } |
72 | 74 |
73 void FindBarHost::SetFindBarController(FindBarController* find_bar_controller) { | 75 void FindBarHost::SetFindBarController(FindBarController* find_bar_controller) { |
74 find_bar_controller_ = find_bar_controller; | 76 find_bar_controller_ = find_bar_controller; |
75 } | 77 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 343 |
342 //////////////////////////////////////////////////////////////////////////////// | 344 //////////////////////////////////////////////////////////////////////////////// |
343 // private: | 345 // private: |
344 | 346 |
345 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { | 347 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { |
346 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); | 348 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); |
347 gfx::Rect webcontents_rect = | 349 gfx::Rect webcontents_rect = |
348 find_bar_controller_->web_contents()->GetViewBounds(); | 350 find_bar_controller_->web_contents()->GetViewBounds(); |
349 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); | 351 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
350 } | 352 } |
OLD | NEW |