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

Side by Side Diff: chrome/browser/ui/views/omnibox/inline_omnibox_popup_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/inline_omnibox_popup_view.h" 5 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/omnibox/omnibox_view.h" 10 #include "chrome/browser/ui/omnibox/omnibox_view.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 return; 352 return;
353 353
354 // OpenMatch() may close the popup, which will clear the result set and, by 354 // OpenMatch() may close the popup, which will clear the result set and, by
355 // extension, |match| and its contents. So copy the relevant match out to 355 // extension, |match| and its contents. So copy the relevant match out to
356 // make sure it stays alive until the call completes. 356 // make sure it stays alive until the call completes.
357 AutocompleteMatch match = model_->result().match_at(index); 357 AutocompleteMatch match = model_->result().match_at(index);
358 omnibox_view_->OpenMatch(match, disposition, GURL(), index); 358 omnibox_view_->OpenMatch(match, disposition, GURL(), index);
359 } 359 }
360 360
361 size_t InlineOmniboxPopupView::GetIndexForPoint(const gfx::Point& point) { 361 size_t InlineOmniboxPopupView::GetIndexForPoint(const gfx::Point& point) {
362 if (!HitTest(point)) 362 if (!HitTestPoint(point))
363 return OmniboxPopupModel::kNoMatch; 363 return OmniboxPopupModel::kNoMatch;
364 364
365 int nb_match = model_->result().size(); 365 int nb_match = model_->result().size();
366 DCHECK(nb_match <= child_count()); 366 DCHECK(nb_match <= child_count());
367 for (int i = 0; i < nb_match; ++i) { 367 for (int i = 0; i < nb_match; ++i) {
368 views::View* child = child_at(i); 368 views::View* child = child_at(i);
369 gfx::Point point_in_child_coords(point); 369 gfx::Point point_in_child_coords(point);
370 View::ConvertPointToView(this, child, &point_in_child_coords); 370 View::ConvertPointToView(this, child, &point_in_child_coords);
371 if (child->HitTest(point_in_child_coords)) 371 if (child->HitTestPoint(point_in_child_coords))
372 return i; 372 return i;
373 } 373 }
374 return OmniboxPopupModel::kNoMatch; 374 return OmniboxPopupModel::kNoMatch;
375 } 375 }
376 376
377 gfx::Rect InlineOmniboxPopupView::CalculateTargetBounds(int h) { 377 gfx::Rect InlineOmniboxPopupView::CalculateTargetBounds(int h) {
378 return gfx::Rect(0, 0, 1, h); 378 return gfx::Rect(0, 0, 1, h);
379 } 379 }
380 380
381 void InlineOmniboxPopupView::UpdateLineEvent( 381 void InlineOmniboxPopupView::UpdateLineEvent(
382 const views::LocatedEvent& event, 382 const views::LocatedEvent& event,
383 bool should_set_selected_line) { 383 bool should_set_selected_line) {
384 size_t index = GetIndexForPoint(event.location()); 384 size_t index = GetIndexForPoint(event.location());
385 model_->SetHoveredLine(index); 385 model_->SetHoveredLine(index);
386 if (HasMatchAt(index) && should_set_selected_line) 386 if (HasMatchAt(index) && should_set_selected_line)
387 model_->SetSelectedLine(index, false, false); 387 model_->SetSelectedLine(index, false, false);
388 } 388 }
389 389
390 void InlineOmniboxPopupView::OpenSelectedLine( 390 void InlineOmniboxPopupView::OpenSelectedLine(
391 const views::LocatedEvent& event, 391 const views::LocatedEvent& event,
392 WindowOpenDisposition disposition) { 392 WindowOpenDisposition disposition) {
393 size_t index = GetIndexForPoint(event.location()); 393 size_t index = GetIndexForPoint(event.location());
394 OpenIndex(index, disposition); 394 OpenIndex(index, disposition);
395 } 395 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/zoom_view.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698