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/ui/omnibox/omnibox_view.h" | 7 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
9 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h" | 9 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h" |
10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" | 10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 size_t OmniboxPopupContentsView::GetIndexForPoint( | 503 size_t OmniboxPopupContentsView::GetIndexForPoint( |
504 const gfx::Point& point) { | 504 const gfx::Point& point) { |
505 if (!HitTestPoint(point)) | 505 if (!HitTestPoint(point)) |
506 return OmniboxPopupModel::kNoMatch; | 506 return OmniboxPopupModel::kNoMatch; |
507 | 507 |
508 int nb_match = model_->result().size(); | 508 int nb_match = model_->result().size(); |
509 DCHECK(nb_match <= child_count()); | 509 DCHECK(nb_match <= child_count()); |
510 for (int i = 0; i < nb_match; ++i) { | 510 for (int i = 0; i < nb_match; ++i) { |
511 views::View* child = child_at(i); | 511 views::View* child = child_at(i); |
512 gfx::Point point_in_child_coords(point); | 512 gfx::Point point_in_child_coords(point); |
513 View::ConvertPointToView(this, child, &point_in_child_coords); | 513 View::ConvertPointToTarget(this, child, &point_in_child_coords); |
514 if (child->HitTestPoint(point_in_child_coords)) | 514 if (child->HitTestPoint(point_in_child_coords)) |
515 return i; | 515 return i; |
516 } | 516 } |
517 return OmniboxPopupModel::kNoMatch; | 517 return OmniboxPopupModel::kNoMatch; |
518 } | 518 } |
519 | 519 |
520 gfx::Rect OmniboxPopupContentsView::CalculateTargetBounds(int h) { | 520 gfx::Rect OmniboxPopupContentsView::CalculateTargetBounds(int h) { |
521 gfx::Rect location_bar_bounds(location_bar_->GetContentsBounds()); | 521 gfx::Rect location_bar_bounds(location_bar_->GetContentsBounds()); |
522 const views::Border* border = location_bar_->border(); | 522 const views::Border* border = location_bar_->border(); |
523 if (border) { | 523 if (border) { |
(...skipping 10 matching lines...) Expand all Loading... |
534 0); | 534 0); |
535 } | 535 } |
536 gfx::Point location_bar_origin(location_bar_bounds.origin()); | 536 gfx::Point location_bar_origin(location_bar_bounds.origin()); |
537 views::View::ConvertPointToScreen(location_bar_, &location_bar_origin); | 537 views::View::ConvertPointToScreen(location_bar_, &location_bar_origin); |
538 location_bar_bounds.set_origin(location_bar_origin); | 538 location_bar_bounds.set_origin(location_bar_origin); |
539 return bubble_border_->GetBounds( | 539 return bubble_border_->GetBounds( |
540 location_bar_bounds, gfx::Size(location_bar_bounds.width(), h)); | 540 location_bar_bounds, gfx::Size(location_bar_bounds.width(), h)); |
541 } | 541 } |
542 | 542 |
543 void OmniboxPopupContentsView::UpdateLineEvent( | 543 void OmniboxPopupContentsView::UpdateLineEvent( |
544 const views::LocatedEvent& event, | 544 const ui::LocatedEvent& event, |
545 bool should_set_selected_line) { | 545 bool should_set_selected_line) { |
546 size_t index = GetIndexForPoint(event.location()); | 546 size_t index = GetIndexForPoint(event.location()); |
547 model_->SetHoveredLine(index); | 547 model_->SetHoveredLine(index); |
548 if (HasMatchAt(index) && should_set_selected_line) | 548 if (HasMatchAt(index) && should_set_selected_line) |
549 model_->SetSelectedLine(index, false, false); | 549 model_->SetSelectedLine(index, false, false); |
550 } | 550 } |
551 | 551 |
552 void OmniboxPopupContentsView::OpenSelectedLine( | 552 void OmniboxPopupContentsView::OpenSelectedLine( |
553 const views::LocatedEvent& event, | 553 const ui::LocatedEvent& event, |
554 WindowOpenDisposition disposition) { | 554 WindowOpenDisposition disposition) { |
555 size_t index = GetIndexForPoint(event.location()); | 555 size_t index = GetIndexForPoint(event.location()); |
556 OpenIndex(index, disposition); | 556 OpenIndex(index, disposition); |
557 } | 557 } |
OLD | NEW |