| 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" |
| 11 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 11 #include "chrome/browser/ui/find_bar/find_tab_helper.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/render_widget_host.h" | 16 #include "content/public/browser/render_widget_host.h" |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "ui/events/event.h" | 18 #include "ui/events/event.h" |
| 19 #include "ui/events/keycodes/keyboard_codes.h" | 19 #include "ui/events/keycodes/keyboard_codes.h" |
| 20 #include "ui/views/focus/external_focus_tracker.h" | 20 #include "ui/views/focus/external_focus_tracker.h" |
| 21 #include "ui/views/focus/view_storage.h" | 21 #include "ui/views/focus/view_storage.h" |
| 22 #include "ui/views/widget/root_view.h" | 22 #include "ui/views/widget/root_view.h" |
| 23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
| 24 | 24 |
| 25 using content::NativeWebKeyboardEvent; | 25 using content::NativeWebKeyboardEvent; |
| 26 | 26 |
| 27 namespace chrome { | |
| 28 | |
| 29 // Declared in browser_dialogs.h so others don't have to depend on our header. | |
| 30 FindBar* CreateFindBar(BrowserView* browser_view) { | |
| 31 return new FindBarHost(browser_view); | |
| 32 } | |
| 33 | |
| 34 } // namespace chrome | |
| 35 | |
| 36 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| 37 // FindBarHost, public: | 28 // FindBarHost, public: |
| 38 | 29 |
| 39 FindBarHost::FindBarHost(BrowserView* browser_view) | 30 FindBarHost::FindBarHost(BrowserView* browser_view) |
| 40 : DropdownBarHost(browser_view), | 31 : DropdownBarHost(browser_view), |
| 41 find_bar_controller_(NULL) { | 32 find_bar_controller_(NULL) { |
| 42 FindBarView* find_bar_view = new FindBarView(this); | 33 FindBarView* find_bar_view = new FindBarView(this); |
| 43 Init(browser_view->find_bar_host_view(), find_bar_view, find_bar_view); | 34 Init(browser_view->find_bar_host_view(), find_bar_view, find_bar_view); |
| 44 } | 35 } |
| 45 | 36 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 343 |
| 353 //////////////////////////////////////////////////////////////////////////////// | 344 //////////////////////////////////////////////////////////////////////////////// |
| 354 // private: | 345 // private: |
| 355 | 346 |
| 356 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { | 347 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { |
| 357 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); | 348 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); |
| 358 gfx::Rect webcontents_rect = | 349 gfx::Rect webcontents_rect = |
| 359 find_bar_controller_->web_contents()->GetViewBounds(); | 350 find_bar_controller_->web_contents()->GetViewBounds(); |
| 360 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); | 351 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
| 361 } | 352 } |
| OLD | NEW |