Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/translate/translate_icon_view.h" | 5 #include "chrome/browser/ui/views/translate/translate_icon_view.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | |
| 7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| 11 #include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h" | |
| 10 #include "chrome/browser/ui/view_ids.h" | 12 #include "chrome/browser/ui/view_ids.h" |
| 11 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" | 13 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
| 12 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 13 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/gfx/vector_icons_public.h" | 18 #include "ui/gfx/vector_icons_public.h" |
| 17 | 19 |
| 20 namespace { | |
| 21 | |
| 22 const char kTranslateBubbleUIEvent[] = "Translate.BubbleUiEvent"; | |
|
msw
2016/05/12 17:29:41
Remove this and use translate::kTranslateBubbleUIE
ftang
2016/05/12 18:38:08
Done.
| |
| 23 | |
| 24 } // namespace | |
| 25 | |
| 18 TranslateIconView::TranslateIconView(CommandUpdater* command_updater) | 26 TranslateIconView::TranslateIconView(CommandUpdater* command_updater) |
| 19 : BubbleIconView(command_updater, IDC_TRANSLATE_PAGE) { | 27 : BubbleIconView(command_updater, IDC_TRANSLATE_PAGE) { |
| 20 set_id(VIEW_ID_TRANSLATE_BUTTON); | 28 set_id(VIEW_ID_TRANSLATE_BUTTON); |
| 21 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_TRANSLATE)); | 29 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_TRANSLATE)); |
| 22 } | 30 } |
| 23 | 31 |
| 24 TranslateIconView::~TranslateIconView() {} | 32 TranslateIconView::~TranslateIconView() {} |
| 25 | 33 |
| 26 void TranslateIconView::OnExecuting( | 34 void TranslateIconView::OnExecuting( |
| 27 BubbleIconView::ExecuteSource execute_source) {} | 35 BubbleIconView::ExecuteSource execute_source) {} |
| 28 | 36 |
| 37 void TranslateIconView::OnPressed(bool activated) { | |
| 38 UMA_HISTOGRAM_ENUMERATION( | |
| 39 kTranslateBubbleUIEvent, | |
| 40 (activated ? translate::PAGE_ACTION_ICON_ACTIVATED | |
| 41 : translate::PAGE_ACTION_ICON_DEACTIVATED), | |
| 42 translate::TRANSLATE_BUBBLE_UI_EVENT_MAX); | |
| 43 } | |
| 44 | |
| 29 views::BubbleDialogDelegateView* TranslateIconView::GetBubble() const { | 45 views::BubbleDialogDelegateView* TranslateIconView::GetBubble() const { |
| 30 return TranslateBubbleView::GetCurrentBubble(); | 46 return TranslateBubbleView::GetCurrentBubble(); |
| 31 } | 47 } |
| 32 | 48 |
| 33 gfx::VectorIconId TranslateIconView::GetVectorIcon() const { | 49 gfx::VectorIconId TranslateIconView::GetVectorIcon() const { |
| 34 return gfx::VectorIconId::TRANSLATE; | 50 return gfx::VectorIconId::TRANSLATE; |
| 35 } | 51 } |
| OLD | NEW |