OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 break; | 62 break; |
63 // Fall through. | 63 // Fall through. |
64 default: | 64 default: |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 TabContentsWrapper* contents = find_bar_controller_->tab_contents(); | 68 TabContentsWrapper* contents = find_bar_controller_->tab_contents(); |
69 if (!contents) | 69 if (!contents) |
70 return false; | 70 return false; |
71 | 71 |
72 RenderViewHost* render_view_host = contents->render_view_host(); | 72 RenderViewHost* render_view_host = |
| 73 contents->tab_contents()->render_view_host(); |
73 | 74 |
74 // Make sure we don't have a text field element interfering with keyboard | 75 // Make sure we don't have a text field element interfering with keyboard |
75 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". | 76 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". |
76 render_view_host->ClearFocusedNode(); | 77 render_view_host->ClearFocusedNode(); |
77 NativeWebKeyboardEvent event = GetKeyboardEvent(contents->tab_contents(), | 78 NativeWebKeyboardEvent event = GetKeyboardEvent(contents->tab_contents(), |
78 key_event); | 79 key_event); |
79 render_view_host->ForwardKeyboardEvent(event); | 80 render_view_host->ForwardKeyboardEvent(event); |
80 return true; | 81 return true; |
81 } | 82 } |
82 | 83 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 focus_manager()->UnregisterAccelerator(escape, this); | 313 focus_manager()->UnregisterAccelerator(escape, this); |
313 | 314 |
314 DropdownBarHost::UnregisterAccelerators(); | 315 DropdownBarHost::UnregisterAccelerators(); |
315 } | 316 } |
316 | 317 |
317 //////////////////////////////////////////////////////////////////////////////// | 318 //////////////////////////////////////////////////////////////////////////////// |
318 // private: | 319 // private: |
319 | 320 |
320 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { | 321 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { |
321 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowScreenBounds(); | 322 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowScreenBounds(); |
322 TabContentsView* tab_view = find_bar_controller_->tab_contents()->view(); | 323 TabContentsView* tab_view = |
| 324 find_bar_controller_->tab_contents()->tab_contents()->view(); |
323 gfx::Rect webcontents_rect; | 325 gfx::Rect webcontents_rect; |
324 tab_view->GetViewBounds(&webcontents_rect); | 326 tab_view->GetViewBounds(&webcontents_rect); |
325 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); | 327 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
326 } | 328 } |
327 | 329 |
328 FindBarView* FindBarHost::find_bar_view() { | 330 FindBarView* FindBarHost::find_bar_view() { |
329 return static_cast<FindBarView*>(view()); | 331 return static_cast<FindBarView*>(view()); |
330 } | 332 } |
OLD | NEW |