| 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 "chrome/browser/ui/browser_show_actions.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 : ALLOW_THIS_IN_INITIALIZER_LIST(click_handler_(this, location_bar)) { | 13 BrowserShowPageInfo* delegate) |
| 14 : ALLOW_THIS_IN_INITIALIZER_LIST( |
| 15 click_handler_(this, location_bar, delegate)) { |
| 13 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON)); | 16 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON)); |
| 14 } | 17 } |
| 15 | 18 |
| 16 LocationIconView::~LocationIconView() { | 19 LocationIconView::~LocationIconView() { |
| 17 } | 20 } |
| 18 | 21 |
| 19 bool LocationIconView::OnMousePressed(const views::MouseEvent& event) { | 22 bool LocationIconView::OnMousePressed(const views::MouseEvent& event) { |
| 20 // We want to show the dialog on mouse release; that is the standard behavior | 23 // We want to show the dialog on mouse release; that is the standard behavior |
| 21 // for buttons. | 24 // for buttons. |
| 22 return true; | 25 return true; |
| 23 } | 26 } |
| 24 | 27 |
| 25 void LocationIconView::OnMouseReleased(const views::MouseEvent& event) { | 28 void LocationIconView::OnMouseReleased(const views::MouseEvent& event) { |
| 26 click_handler_.OnMouseReleased(event); | 29 click_handler_.OnMouseReleased(event); |
| 27 } | 30 } |
| 28 | 31 |
| 29 void LocationIconView::ShowTooltip(bool show) { | 32 void LocationIconView::ShowTooltip(bool show) { |
| 30 if (show) { | 33 if (show) { |
| 31 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON)); | 34 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON)); |
| 32 } else { | 35 } else { |
| 33 SetTooltipText(string16()); | 36 SetTooltipText(string16()); |
| 34 } | 37 } |
| 35 } | 38 } |
| OLD | NEW |