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/ui/views/location_bar/location_bar_view.h" | |
8 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
9 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
10 | 11 |
11 LocationIconView::LocationIconView(LocationBarView* location_bar) | 12 LocationIconView::LocationIconView(LocationBarView* location_bar) |
12 : page_info_helper_(this, location_bar) { | 13 : page_info_helper_(this, location_bar) { |
13 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON)); | 14 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON)); |
14 TouchableLocationBarView::Init(this); | 15 LocationBarView::InitTouchableLocationBarView(this); |
15 } | 16 } |
16 | 17 |
17 LocationIconView::~LocationIconView() { | 18 LocationIconView::~LocationIconView() { |
18 } | 19 } |
19 | 20 |
20 bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) { | 21 bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) { |
21 // We want to show the dialog on mouse release; that is the standard behavior | 22 // We want to show the dialog on mouse release; that is the standard behavior |
22 // for buttons. | 23 // for buttons. |
23 return true; | 24 return true; |
24 } | 25 } |
25 | 26 |
26 void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) { | 27 void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) { |
27 page_info_helper_.ProcessEvent(event); | 28 page_info_helper_.ProcessEvent(event); |
28 } | 29 } |
29 | 30 |
30 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) { | 31 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) { |
31 if (event->type() == ui::ET_GESTURE_TAP) { | 32 if (event->type() == ui::ET_GESTURE_TAP) { |
32 page_info_helper_.ProcessEvent(*event); | 33 page_info_helper_.ProcessEvent(*event); |
33 event->SetHandled(); | 34 event->SetHandled(); |
34 } | 35 } |
35 } | 36 } |
36 | 37 |
37 int LocationIconView::GetBuiltInHorizontalPadding() const { | 38 void LocationIconView::ShowTooltip(bool show) { |
38 return GetBuiltInHorizontalPaddingImpl(); | 39 SetTooltipText(show ? l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON) |
40 : base::string16()); | |
Peter Kasting
2013/08/09 20:57:28
Nit: Break after '?' (as my comment had it), not b
tfarina
2013/08/10 02:13:40
this is clang-format not me.
| |
39 } | 41 } |
40 | |
41 void LocationIconView::ShowTooltip(bool show) { | |
42 if (show) { | |
43 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON)); | |
44 } else { | |
45 SetTooltipText(string16()); | |
46 } | |
47 } | |
OLD | NEW |