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/common/system/date/date_default_view.h" | 5 #include "ash/common/system/date/date_default_view.h" |
6 | 6 |
7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "ash/common/metrics/user_metrics_action.h" | 8 #include "ash/common/metrics/user_metrics_action.h" |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
10 #include "ash/common/system/date/date_view.h" | 10 #include "ash/common/system/date/date_view.h" |
11 #include "ash/common/system/tray/special_popup_row.h" | 11 #include "ash/common/system/tray/special_popup_row.h" |
12 #include "ash/common/system/tray/system_tray.h" | 12 #include "ash/common/system/tray/system_tray.h" |
| 13 #include "ash/common/system/tray/system_tray_controller.h" |
13 #include "ash/common/system/tray/system_tray_delegate.h" | 14 #include "ash/common/system/tray/system_tray_delegate.h" |
14 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
15 #include "ash/common/system/tray/tray_popup_header_button.h" | 16 #include "ash/common/system/tray/tray_popup_header_button.h" |
16 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
17 #include "ash/resources/vector_icons/vector_icons.h" | 18 #include "ash/resources/vector_icons/vector_icons.h" |
18 #include "base/i18n/rtl.h" | 19 #include "base/i18n/rtl.h" |
19 #include "grit/ash_resources.h" | 20 #include "grit/ash_resources.h" |
20 #include "grit/ash_strings.h" | 21 #include "grit/ash_strings.h" |
21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/gfx/paint_vector_icon.h" | 23 #include "ui/gfx/paint_vector_icon.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 const tray::DateView* DateDefaultView::GetDateView() const { | 147 const tray::DateView* DateDefaultView::GetDateView() const { |
147 return date_view_; | 148 return date_view_; |
148 } | 149 } |
149 | 150 |
150 void DateDefaultView::ButtonPressed(views::Button* sender, | 151 void DateDefaultView::ButtonPressed(views::Button* sender, |
151 const ui::Event& event) { | 152 const ui::Event& event) { |
152 WmShell* shell = WmShell::Get(); | 153 WmShell* shell = WmShell::Get(); |
153 SystemTrayDelegate* tray_delegate = shell->system_tray_delegate(); | 154 SystemTrayDelegate* tray_delegate = shell->system_tray_delegate(); |
154 if (sender == help_button_) { | 155 if (sender == help_button_) { |
155 shell->RecordUserMetricsAction(UMA_TRAY_HELP); | 156 shell->RecordUserMetricsAction(UMA_TRAY_HELP); |
156 tray_delegate->ShowHelp(); | 157 shell->system_tray_controller()->ShowHelp(); |
157 } else if (sender == shutdown_button_) { | 158 } else if (sender == shutdown_button_) { |
158 shell->RecordUserMetricsAction(UMA_TRAY_SHUT_DOWN); | 159 shell->RecordUserMetricsAction(UMA_TRAY_SHUT_DOWN); |
159 tray_delegate->RequestShutdown(); | 160 tray_delegate->RequestShutdown(); |
160 } else if (sender == lock_button_) { | 161 } else if (sender == lock_button_) { |
161 shell->RecordUserMetricsAction(UMA_TRAY_LOCK_SCREEN); | 162 shell->RecordUserMetricsAction(UMA_TRAY_LOCK_SCREEN); |
162 #if defined(OS_CHROMEOS) | 163 #if defined(OS_CHROMEOS) |
163 chromeos::DBusThreadManager::Get() | 164 chromeos::DBusThreadManager::Get() |
164 ->GetSessionManagerClient() | 165 ->GetSessionManagerClient() |
165 ->RequestLockScreen(); | 166 ->RequestLockScreen(); |
166 #endif | 167 #endif |
167 } else { | 168 } else { |
168 NOTREACHED(); | 169 NOTREACHED(); |
169 } | 170 } |
170 date_view_->CloseSystemBubble(); | 171 date_view_->CloseSystemBubble(); |
171 } | 172 } |
172 | 173 |
173 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { | 174 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { |
174 if (!shutdown_button_) | 175 if (!shutdown_button_) |
175 return; | 176 return; |
176 | 177 |
177 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( | 178 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( |
178 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT | 179 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT |
179 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); | 180 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); |
180 } | 181 } |
181 | 182 |
182 } // namespace ash | 183 } // namespace ash |
OLD | NEW |