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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_icon_view.cc

Issue 1627543002: Anchor the infobar arrow to the LocationIconView correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pkasting feedback Created 4 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_icon_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/location_bar/location_icon_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ssl/chrome_security_state_model_client.h" 8 #include "chrome/browser/ssl/chrome_security_state_model_client.h"
9 #include "chrome/browser/ui/view_ids.h" 9 #include "chrome/browser/ui/view_ids.h"
10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return true; 111 return true;
112 } 112 }
113 113
114 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) { 114 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) {
115 if (event->type() != ui::ET_GESTURE_TAP) 115 if (event->type() != ui::ET_GESTURE_TAP)
116 return; 116 return;
117 OnClickOrTap(*event); 117 OnClickOrTap(*event);
118 event->SetHandled(); 118 event->SetHandled();
119 } 119 }
120 120
121 bool LocationIconView::GetTooltipText(const gfx::Point& p,
122 base::string16* tooltip) const {
123 if (show_tooltip_)
124 *tooltip = l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON);
125 return show_tooltip_;
126 }
127
121 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) { 128 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) {
122 // Do not show page info if the user has been editing the location bar or the 129 // Do not show page info if the user has been editing the location bar or the
123 // location bar is at the NTP. 130 // location bar is at the NTP.
124 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty()) 131 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty())
125 return; 132 return;
126 ProcessEvent(event); 133 ProcessEvent(event);
127 } 134 }
128 135
129 void LocationIconView::ShowTooltip(bool show) {
130 SetTooltipText(show ?
131 l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON) : base::string16());
132 }
133
134 void LocationIconView::ProcessEvent(const ui::LocatedEvent& event) { 136 void LocationIconView::ProcessEvent(const ui::LocatedEvent& event) {
135 if (!HitTestPoint(event.location())) 137 if (!HitTestPoint(event.location()))
136 return; 138 return;
137 ProcessEventInternal(location_bar_); 139 ProcessEventInternal(location_bar_);
138 } 140 }
139 141
140 void LocationIconView::ProcessEvent(const ui::KeyEvent& event) { 142 void LocationIconView::ProcessEvent(const ui::KeyEvent& event) {
141 ProcessEventInternal(location_bar_); 143 ProcessEventInternal(location_bar_);
142 } 144 }
143 145
(...skipping 24 matching lines...) Expand all
168 return size; 170 return size;
169 } 171 }
170 172
171 void LocationIconView::SetBackground(bool should_show_ev) { 173 void LocationIconView::SetBackground(bool should_show_ev) {
172 static const int kEvBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE); 174 static const int kEvBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE);
173 if (should_show_ev) 175 if (should_show_ev)
174 SetBackgroundImageGrid(kEvBackgroundImages); 176 SetBackgroundImageGrid(kEvBackgroundImages);
175 else 177 else
176 UnsetBackgroundImageGrid(); 178 UnsetBackgroundImageGrid();
177 } 179 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_icon_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698