| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/system/date/date_default_view.h" | 5 #include "ash/system/date/date_default_view.h" |
| 6 | 6 |
| 7 #include "ash/common/metrics/user_metrics_action.h" |
| 7 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 8 #include "ash/common/system/tray/special_popup_row.h" | 9 #include "ash/common/system/tray/special_popup_row.h" |
| 9 #include "ash/common/system/tray/system_tray_delegate.h" | 10 #include "ash/common/system/tray/system_tray_delegate.h" |
| 10 #include "ash/common/system/tray/tray_constants.h" | 11 #include "ash/common/system/tray/tray_constants.h" |
| 11 #include "ash/common/system/tray/tray_popup_header_button.h" | 12 #include "ash/common/system/tray/tray_popup_header_button.h" |
| 12 #include "ash/common/wm/wm_user_metrics_action.h" | |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/system/date/date_view.h" | 14 #include "ash/system/date/date_view.h" |
| 15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 16 #include "grit/ash_resources.h" | 16 #include "grit/ash_resources.h" |
| 17 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/views/border.h" | 19 #include "ui/views/border.h" |
| 20 #include "ui/views/controls/button/button.h" | 20 #include "ui/views/controls/button/button.h" |
| 21 #include "ui/views/layout/fill_layout.h" | 21 #include "ui/views/layout/fill_layout.h" |
| 22 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 const tray::DateView* DateDefaultView::GetDateView() const { | 123 const tray::DateView* DateDefaultView::GetDateView() const { |
| 124 return date_view_; | 124 return date_view_; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void DateDefaultView::ButtonPressed(views::Button* sender, | 127 void DateDefaultView::ButtonPressed(views::Button* sender, |
| 128 const ui::Event& event) { | 128 const ui::Event& event) { |
| 129 WmShell* shell = WmShell::Get(); | 129 WmShell* shell = WmShell::Get(); |
| 130 SystemTrayDelegate* tray_delegate = shell->system_tray_delegate(); | 130 SystemTrayDelegate* tray_delegate = shell->system_tray_delegate(); |
| 131 if (sender == help_button_) { | 131 if (sender == help_button_) { |
| 132 shell->RecordUserMetricsAction(wm::WmUserMetricsAction::TRAY_HELP); | 132 shell->RecordUserMetricsAction(UMA_TRAY_HELP); |
| 133 tray_delegate->ShowHelp(); | 133 tray_delegate->ShowHelp(); |
| 134 } else if (sender == shutdown_button_) { | 134 } else if (sender == shutdown_button_) { |
| 135 shell->RecordUserMetricsAction(wm::WmUserMetricsAction::TRAY_SHUT_DOWN); | 135 shell->RecordUserMetricsAction(UMA_TRAY_SHUT_DOWN); |
| 136 tray_delegate->RequestShutdown(); | 136 tray_delegate->RequestShutdown(); |
| 137 } else if (sender == lock_button_) { | 137 } else if (sender == lock_button_) { |
| 138 shell->RecordUserMetricsAction(wm::WmUserMetricsAction::TRAY_LOCK_SCREEN); | 138 shell->RecordUserMetricsAction(UMA_TRAY_LOCK_SCREEN); |
| 139 tray_delegate->RequestLockScreen(); | 139 tray_delegate->RequestLockScreen(); |
| 140 } else { | 140 } else { |
| 141 NOTREACHED(); | 141 NOTREACHED(); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { | 145 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { |
| 146 if (!shutdown_button_) | 146 if (!shutdown_button_) |
| 147 return; | 147 return; |
| 148 | 148 |
| 149 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( | 149 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( |
| 150 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT | 150 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT |
| 151 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); | 151 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace ash | 154 } // namespace ash |
| OLD | NEW |