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