OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |