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

Unified Diff: chrome/browser/ui/views/location_bar/location_icon_view.cc

Issue 197623002: [OriginChip] Show the page info bubble on the location bar icon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to comment Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698