| 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 "chrome/browser/ui/find_bar/find_bar_controller.h" | 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 10 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 10 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 content::WebContents* contents = find_bar_controller_->web_contents(); | 70 content::WebContents* contents = find_bar_controller_->web_contents(); |
| 71 if (!contents) | 71 if (!contents) |
| 72 return false; | 72 return false; |
| 73 | 73 |
| 74 content::RenderViewHost* render_view_host = contents->GetRenderViewHost(); | 74 content::RenderViewHost* render_view_host = contents->GetRenderViewHost(); |
| 75 | 75 |
| 76 // Make sure we don't have a text field element interfering with keyboard | 76 // Make sure we don't have a text field element interfering with keyboard |
| 77 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". | 77 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". |
| 78 render_view_host->ClearFocusedNode(); | 78 render_view_host->ClearFocusedElement(); |
| 79 NativeWebKeyboardEvent event = GetKeyboardEvent(contents, key_event); | 79 NativeWebKeyboardEvent event = GetKeyboardEvent(contents, key_event); |
| 80 render_view_host->ForwardKeyboardEvent(event); | 80 render_view_host->ForwardKeyboardEvent(event); |
| 81 return true; | 81 return true; |
| 82 } | 82 } |
| 83 | 83 |
| 84 FindBarController* FindBarHost::GetFindBarController() const { | 84 FindBarController* FindBarHost::GetFindBarController() const { |
| 85 return find_bar_controller_; | 85 return find_bar_controller_; |
| 86 } | 86 } |
| 87 | 87 |
| 88 void FindBarHost::SetFindBarController(FindBarController* find_bar_controller) { | 88 void FindBarHost::SetFindBarController(FindBarController* find_bar_controller) { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 //////////////////////////////////////////////////////////////////////////////// | 364 //////////////////////////////////////////////////////////////////////////////// |
| 365 // private: | 365 // private: |
| 366 | 366 |
| 367 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { | 367 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { |
| 368 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); | 368 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); |
| 369 content::WebContentsView* tab_view = | 369 content::WebContentsView* tab_view = |
| 370 find_bar_controller_->web_contents()->GetView(); | 370 find_bar_controller_->web_contents()->GetView(); |
| 371 gfx::Rect webcontents_rect = tab_view->GetViewBounds(); | 371 gfx::Rect webcontents_rect = tab_view->GetViewBounds(); |
| 372 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); | 372 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
| 373 } | 373 } |
| OLD | NEW |