| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 | 10 |
| 11 LocationIconView::LocationIconView(LocationBarView* location_bar) | 11 LocationIconView::LocationIconView(LocationBarView* location_bar) |
| 12 : ALLOW_THIS_IN_INITIALIZER_LIST(click_handler_(this, location_bar)) { | 12 : ALLOW_THIS_IN_INITIALIZER_LIST(click_handler_(this, location_bar)) { |
| 13 SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16( | 13 SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16( |
| 14 IDS_TOOLTIP_LOCATION_ICON))); | 14 IDS_TOOLTIP_LOCATION_ICON))); |
| 15 } | 15 } |
| 16 | 16 |
| 17 LocationIconView::~LocationIconView() { | 17 LocationIconView::~LocationIconView() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 bool LocationIconView::OnMousePressed(const views::MouseEvent& event) { | 20 bool LocationIconView::OnMousePressed(const views::MouseEvent& event) { |
| 21 // We want to show the dialog on mouse release; that is the standard behavior | 21 // We want to show the dialog on mouse release; that is the standard behavior |
| 22 // for buttons. | 22 // for buttons. |
| 23 return true; | 23 return true; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void LocationIconView::OnMouseReleased(const views::MouseEvent& event, | 26 void LocationIconView::OnMouseReleased(const views::MouseEvent& event) { |
| 27 bool canceled) { | 27 click_handler_.OnMouseReleased(event); |
| 28 click_handler_.OnMouseReleased(event, canceled); | |
| 29 } | 28 } |
| 30 | 29 |
| 31 void LocationIconView::ShowTooltip(bool show) { | 30 void LocationIconView::ShowTooltip(bool show) { |
| 32 if (show) { | 31 if (show) { |
| 33 SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16( | 32 SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16( |
| 34 IDS_TOOLTIP_LOCATION_ICON))); | 33 IDS_TOOLTIP_LOCATION_ICON))); |
| 35 } else { | 34 } else { |
| 36 SetTooltipText(L""); | 35 SetTooltipText(L""); |
| 37 } | 36 } |
| 38 } | 37 } |
| OLD | NEW |