Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed errors reported by trybots Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 495
496 // OpenMatch() may close the popup, which will clear the result set and, by 496 // OpenMatch() may close the popup, which will clear the result set and, by
497 // extension, |match| and its contents. So copy the relevant match out to 497 // extension, |match| and its contents. So copy the relevant match out to
498 // make sure it stays alive until the call completes. 498 // make sure it stays alive until the call completes.
499 AutocompleteMatch match = model_->result().match_at(index); 499 AutocompleteMatch match = model_->result().match_at(index);
500 omnibox_view_->OpenMatch(match, disposition, GURL(), index); 500 omnibox_view_->OpenMatch(match, disposition, GURL(), index);
501 } 501 }
502 502
503 size_t OmniboxPopupContentsView::GetIndexForPoint( 503 size_t OmniboxPopupContentsView::GetIndexForPoint(
504 const gfx::Point& point) { 504 const gfx::Point& point) {
505 if (!HitTest(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::ConvertPointToView(this, child, &point_in_child_coords);
514 if (child->HitTest(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) {
524 // Adjust for the border so that the bubble and location bar borders are 524 // Adjust for the border so that the bubble and location bar borders are
(...skipping 23 matching lines...) Expand all
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 views::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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.cc ('k') | chrome/browser/ui/views/tabs/base_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698