| 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.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/event.h" |
| 18 #include "ui/base/keycodes/keyboard_codes.h" | 19 #include "ui/base/keycodes/keyboard_codes.h" |
| 19 #include "ui/views/focus/external_focus_tracker.h" | 20 #include "ui/views/focus/external_focus_tracker.h" |
| 20 #include "ui/views/focus/view_storage.h" | 21 #include "ui/views/focus/view_storage.h" |
| 21 #include "ui/views/widget/root_view.h" | 22 #include "ui/views/widget/root_view.h" |
| 22 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
| 23 | 24 |
| 24 using content::NativeWebKeyboardEvent; | 25 using content::NativeWebKeyboardEvent; |
| 25 | 26 |
| 26 namespace chrome { | 27 namespace chrome { |
| 27 | 28 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 : DropdownBarHost(browser_view), | 40 : DropdownBarHost(browser_view), |
| 40 find_bar_controller_(NULL) { | 41 find_bar_controller_(NULL) { |
| 41 FindBarView* find_bar_view = new FindBarView(this); | 42 FindBarView* find_bar_view = new FindBarView(this); |
| 42 Init(find_bar_view, find_bar_view); | 43 Init(find_bar_view, find_bar_view); |
| 43 } | 44 } |
| 44 | 45 |
| 45 FindBarHost::~FindBarHost() { | 46 FindBarHost::~FindBarHost() { |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool FindBarHost::MaybeForwardKeyEventToWebpage( | 49 bool FindBarHost::MaybeForwardKeyEventToWebpage( |
| 49 const views::KeyEvent& key_event) { | 50 const ui::KeyEvent& key_event) { |
| 50 if (!ShouldForwardKeyEventToWebpageNative(key_event)) { | 51 if (!ShouldForwardKeyEventToWebpageNative(key_event)) { |
| 51 // Native implementation says not to forward these events. | 52 // Native implementation says not to forward these events. |
| 52 return false; | 53 return false; |
| 53 } | 54 } |
| 54 | 55 |
| 55 switch (key_event.key_code()) { | 56 switch (key_event.key_code()) { |
| 56 case ui::VKEY_DOWN: | 57 case ui::VKEY_DOWN: |
| 57 case ui::VKEY_UP: | 58 case ui::VKEY_UP: |
| 58 case ui::VKEY_PRIOR: | 59 case ui::VKEY_PRIOR: |
| 59 case ui::VKEY_NEXT: | 60 case ui::VKEY_NEXT: |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); | 335 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); |
| 335 content::WebContentsView* tab_view = | 336 content::WebContentsView* tab_view = |
| 336 find_bar_controller_->tab_contents()->web_contents()->GetView(); | 337 find_bar_controller_->tab_contents()->web_contents()->GetView(); |
| 337 gfx::Rect webcontents_rect = tab_view->GetViewBounds(); | 338 gfx::Rect webcontents_rect = tab_view->GetViewBounds(); |
| 338 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); | 339 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
| 339 } | 340 } |
| 340 | 341 |
| 341 FindBarView* FindBarHost::find_bar_view() { | 342 FindBarView* FindBarHost::find_bar_view() { |
| 342 return static_cast<FindBarView*>(view()); | 343 return static_cast<FindBarView*>(view()); |
| 343 } | 344 } |
| OLD | NEW |