| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 DCHECK(bounds); | 307 DCHECK(bounds); |
| 308 // The BrowserView does Layout for the components that we care about | 308 // The BrowserView does Layout for the components that we care about |
| 309 // positioning relative to, so we ask it to tell us where we should go. | 309 // positioning relative to, so we ask it to tell us where we should go. |
| 310 *bounds = browser_view()->GetFindBarBoundingBox(); | 310 *bounds = browser_view()->GetFindBarBoundingBox(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void FindBarHost::RegisterAccelerators() { | 313 void FindBarHost::RegisterAccelerators() { |
| 314 DropdownBarHost::RegisterAccelerators(); | 314 DropdownBarHost::RegisterAccelerators(); |
| 315 | 315 |
| 316 // Register for Ctrl+Return. | 316 // Register for Ctrl+Return. |
| 317 ui::Accelerator escape(ui::VKEY_RETURN, ui::EF_CONTROL_DOWN); | 317 ui::Accelerator escape(ui::VKEY_RETURN, |
| 318 ui::EF_CONTROL_DOWN, |
| 319 ui::ET_KEY_PRESSED); |
| 318 focus_manager()->RegisterAccelerator( | 320 focus_manager()->RegisterAccelerator( |
| 319 escape, ui::AcceleratorManager::kNormalPriority, this); | 321 escape, ui::AcceleratorManager::kNormalPriority, this); |
| 320 } | 322 } |
| 321 | 323 |
| 322 void FindBarHost::UnregisterAccelerators() { | 324 void FindBarHost::UnregisterAccelerators() { |
| 323 // Unregister Ctrl+Return. | 325 // Unregister Ctrl+Return. |
| 324 ui::Accelerator escape(ui::VKEY_RETURN, ui::EF_CONTROL_DOWN); | 326 ui::Accelerator escape(ui::VKEY_RETURN, |
| 327 ui::EF_CONTROL_DOWN, |
| 328 ui::ET_KEY_PRESSED); |
| 325 focus_manager()->UnregisterAccelerator(escape, this); | 329 focus_manager()->UnregisterAccelerator(escape, this); |
| 326 | 330 |
| 327 DropdownBarHost::UnregisterAccelerators(); | 331 DropdownBarHost::UnregisterAccelerators(); |
| 328 } | 332 } |
| 329 | 333 |
| 330 //////////////////////////////////////////////////////////////////////////////// | 334 //////////////////////////////////////////////////////////////////////////////// |
| 331 // private: | 335 // private: |
| 332 | 336 |
| 333 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { | 337 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { |
| 334 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowScreenBounds(); | 338 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowScreenBounds(); |
| 335 content::WebContentsView* tab_view = | 339 content::WebContentsView* tab_view = |
| 336 find_bar_controller_->tab_contents()->web_contents()->GetView(); | 340 find_bar_controller_->tab_contents()->web_contents()->GetView(); |
| 337 gfx::Rect webcontents_rect; | 341 gfx::Rect webcontents_rect; |
| 338 tab_view->GetViewBounds(&webcontents_rect); | 342 tab_view->GetViewBounds(&webcontents_rect); |
| 339 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); | 343 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
| 340 } | 344 } |
| 341 | 345 |
| 342 FindBarView* FindBarHost::find_bar_view() { | 346 FindBarView* FindBarHost::find_bar_view() { |
| 343 return static_cast<FindBarView*>(view()); | 347 return static_cast<FindBarView*>(view()); |
| 344 } | 348 } |
| OLD | NEW |