Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/location_icon_view.cc |
| diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc |
| index 9ac13a34f6a2cbb9adc4ce8a1b2fd5ec5110a84a..976e6b61953ad4099c055347652634249f8e26d9 100644 |
| --- a/chrome/browser/ui/views/location_bar/location_icon_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc |
| @@ -11,7 +11,8 @@ |
| #include "ui/base/l10n/l10n_util.h" |
| LocationIconView::LocationIconView(LocationBarView* location_bar) |
| - : page_info_helper_(this, location_bar) { |
| + : page_info_helper_(this, location_bar), |
| + location_bar_(location_bar) { |
| SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON)); |
| LocationBarView::InitTouchableLocationBarChildView(this); |
| } |
| @@ -26,18 +27,29 @@ bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) { |
| } |
| void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) { |
| - if (!chrome::ShouldDisplayOriginChip() && |
| - !chrome::ShouldDisplayOriginChipV2()) |
| - page_info_helper_.ProcessEvent(event); |
| + // Do not show page info if the user has been editing the location bar or the |
| + // location bar is at the NTP. Also skip showing the page info if the |
| + // toolbar-based origin chip is being shown because it is responsible for |
| + // showing the page info instead. |
| + if (location_bar_->GetOmniboxView()->IsEditingOrEmpty() || |
| + chrome::ShouldDisplayOriginChip()) |
| + return; |
| + |
| + page_info_helper_.ProcessEvent(event); |
| } |
| void LocationIconView::OnGestureEvent(ui::GestureEvent* event) { |
| - if (!chrome::ShouldDisplayOriginChip() && |
| - !chrome::ShouldDisplayOriginChipV2() && |
| - (event->type() == ui::ET_GESTURE_TAP)) { |
| - page_info_helper_.ProcessEvent(*event); |
| - event->SetHandled(); |
| - } |
| + // Do not show page info if the user has been editing the location bar or the |
| + // location bar is at the NTP. Also skip showing the page info if the |
| + // toolbar-based origin chip is being shown because it is responsible for |
| + // showing the page info instead. |
|
Peter Kasting
2014/03/18 01:23:13
This copy-and-paste makes me think we should have
Justin Donnelly
2014/03/18 15:54:48
Done.
|
| + if (location_bar_->GetOmniboxView()->IsEditingOrEmpty() || |
| + chrome::ShouldDisplayOriginChip() || |
| + (event->type() != ui::ET_GESTURE_TAP)) |
| + return; |
| + |
| + page_info_helper_.ProcessEvent(*event); |
| + event->SetHandled(); |
| } |
| void LocationIconView::ShowTooltip(bool show) { |