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/omnibox/omnibox_popup_contents_view.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" |
6 | 6 |
7 #include "chrome/browser/search/search.h" | 7 #include "chrome/browser/search/search.h" |
8 #include "chrome/browser/ui/omnibox/omnibox_popup_non_view.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_popup_non_view.h" |
9 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 9 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 const views::Border* border = location_bar_->border(); | 516 const views::Border* border = location_bar_->border(); |
517 if (border) { | 517 if (border) { |
518 // Adjust for the border so that the bubble and location bar borders are | 518 // Adjust for the border so that the bubble and location bar borders are |
519 // aligned. | 519 // aligned. |
520 gfx::Insets insets = border->GetInsets(); | 520 gfx::Insets insets = border->GetInsets(); |
521 location_bar_bounds.Inset(insets.left(), 0, insets.right(), 0); | 521 location_bar_bounds.Inset(insets.left(), 0, insets.right(), 0); |
522 } else { | 522 } else { |
523 // The normal location bar is drawn using a background graphic that includes | 523 // The normal location bar is drawn using a background graphic that includes |
524 // the border, so we inset by enough to make the edges line up, and the | 524 // the border, so we inset by enough to make the edges line up, and the |
525 // bubble appear at the same height as the Star bubble. | 525 // bubble appear at the same height as the Star bubble. |
526 location_bar_bounds.Inset(LocationBarView::kNormalHorizontalEdgeThickness, | 526 location_bar_bounds.Inset(LocationBarView::kNormalEdgeThickness, 0); |
527 0); | |
528 } | 527 } |
529 gfx::Point location_bar_origin(location_bar_bounds.origin()); | 528 gfx::Point location_bar_origin(location_bar_bounds.origin()); |
530 views::View::ConvertPointToScreen(location_bar_, &location_bar_origin); | 529 views::View::ConvertPointToScreen(location_bar_, &location_bar_origin); |
531 location_bar_bounds.set_origin(location_bar_origin); | 530 location_bar_bounds.set_origin(location_bar_origin); |
532 return bubble_border_->GetBounds( | 531 return bubble_border_->GetBounds( |
533 location_bar_bounds, gfx::Size(location_bar_bounds.width(), h)); | 532 location_bar_bounds, gfx::Size(location_bar_bounds.width(), h)); |
534 } | 533 } |
535 | 534 |
536 void OmniboxPopupContentsView::UpdateLineEvent( | 535 void OmniboxPopupContentsView::UpdateLineEvent( |
537 const ui::LocatedEvent& event, | 536 const ui::LocatedEvent& event, |
538 bool should_set_selected_line) { | 537 bool should_set_selected_line) { |
539 size_t index = GetIndexForPoint(event.location()); | 538 size_t index = GetIndexForPoint(event.location()); |
540 model_->SetHoveredLine(index); | 539 model_->SetHoveredLine(index); |
541 if (HasMatchAt(index) && should_set_selected_line) | 540 if (HasMatchAt(index) && should_set_selected_line) |
542 model_->SetSelectedLine(index, false, false); | 541 model_->SetSelectedLine(index, false, false); |
543 } | 542 } |
544 | 543 |
545 void OmniboxPopupContentsView::OpenSelectedLine( | 544 void OmniboxPopupContentsView::OpenSelectedLine( |
546 const ui::LocatedEvent& event, | 545 const ui::LocatedEvent& event, |
547 WindowOpenDisposition disposition) { | 546 WindowOpenDisposition disposition) { |
548 size_t index = GetIndexForPoint(event.location()); | 547 size_t index = GetIndexForPoint(event.location()); |
549 OpenIndex(index, disposition); | 548 OpenIndex(index, disposition); |
550 } | 549 } |
551 | 550 |
552 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 551 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
553 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 552 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
554 } | 553 } |
OLD | NEW |