| 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" |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 12 #include "chrome/browser/ui/view_ids.h" | 12 #include "chrome/browser/ui/view_ids.h" |
| 13 #include "chrome/browser/ui/views/find_bar_view.h" | 13 #include "chrome/browser/ui/views/find_bar_view.h" |
| 14 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 15 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/browser/web_contents_view.h" | 17 #include "content/public/browser/web_contents_view.h" |
| 18 #include "ui/base/keycodes/keyboard_codes.h" | 18 #include "ui/base/keycodes/keyboard_codes.h" |
| 19 #include "ui/views/focus/external_focus_tracker.h" | 19 #include "ui/views/focus/external_focus_tracker.h" |
| 20 #include "ui/views/focus/view_storage.h" | 20 #include "ui/views/focus/view_storage.h" |
| 21 #include "ui/views/widget/root_view.h" | 21 #include "ui/views/widget/root_view.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 break; | 60 break; |
| 61 case ui::VKEY_HOME: | 61 case ui::VKEY_HOME: |
| 62 case ui::VKEY_END: | 62 case ui::VKEY_END: |
| 63 if (key_event.IsControlDown()) | 63 if (key_event.IsControlDown()) |
| 64 break; | 64 break; |
| 65 // Fall through. | 65 // Fall through. |
| 66 default: | 66 default: |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 TabContentsWrapper* contents = find_bar_controller_->tab_contents(); | 70 TabContents* contents = find_bar_controller_->tab_contents(); |
| 71 if (!contents) | 71 if (!contents) |
| 72 return false; | 72 return false; |
| 73 | 73 |
| 74 content::RenderViewHost* render_view_host = | 74 content::RenderViewHost* render_view_host = |
| 75 contents->web_contents()->GetRenderViewHost(); | 75 contents->web_contents()->GetRenderViewHost(); |
| 76 | 76 |
| 77 // Make sure we don't have a text field element interfering with keyboard | 77 // Make sure we don't have a text field element interfering with keyboard |
| 78 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". | 78 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". |
| 79 render_view_host->ClearFocusedNode(); | 79 render_view_host->ClearFocusedNode(); |
| 80 NativeWebKeyboardEvent event = GetKeyboardEvent(contents->web_contents(), | 80 NativeWebKeyboardEvent event = GetKeyboardEvent(contents->web_contents(), |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 content::WebContentsView* tab_view = | 335 content::WebContentsView* tab_view = |
| 336 find_bar_controller_->tab_contents()->web_contents()->GetView(); | 336 find_bar_controller_->tab_contents()->web_contents()->GetView(); |
| 337 gfx::Rect webcontents_rect; | 337 gfx::Rect webcontents_rect; |
| 338 tab_view->GetViewBounds(&webcontents_rect); | 338 tab_view->GetViewBounds(&webcontents_rect); |
| 339 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); | 339 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
| 340 } | 340 } |
| 341 | 341 |
| 342 FindBarView* FindBarHost::find_bar_view() { | 342 FindBarView* FindBarHost::find_bar_view() { |
| 343 return static_cast<FindBarView*>(view()); | 343 return static_cast<FindBarView*>(view()); |
| 344 } | 344 } |
| OLD | NEW |