| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |