| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tray_date.h" | 5 #include "ash/system/date/tray_date.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" |
| 8 #include "ash/system/date/date_view.h" | 9 #include "ash/system/date/date_view.h" |
| 9 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| 10 #include "ash/system/tray/system_tray_delegate.h" | 11 #include "ash/system/tray/system_tray_delegate.h" |
| 11 #include "ash/system/tray/system_tray_notifier.h" | 12 #include "ash/system/tray/system_tray_notifier.h" |
| 12 #include "ash/system/tray/tray_constants.h" | 13 #include "ash/system/tray/tray_constants.h" |
| 13 #include "ash/system/tray/tray_item_view.h" | 14 #include "ash/system/tray/tray_item_view.h" |
| 14 #include "ash/system/tray/tray_views.h" | 15 #include "ash/system/tray/tray_views.h" |
| 15 #include "base/i18n/time_formatting.h" | 16 #include "base/i18n/time_formatting.h" |
| 16 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 17 #include "base/time.h" | 18 #include "base/time.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 view->AddButton(lock_); | 101 view->AddButton(lock_); |
| 101 } | 102 } |
| 102 } | 103 } |
| 103 | 104 |
| 104 virtual ~DateDefaultView() {} | 105 virtual ~DateDefaultView() {} |
| 105 | 106 |
| 106 private: | 107 private: |
| 107 // Overridden from views::ButtonListener. | 108 // Overridden from views::ButtonListener. |
| 108 virtual void ButtonPressed(views::Button* sender, | 109 virtual void ButtonPressed(views::Button* sender, |
| 109 const ui::Event& event) OVERRIDE { | 110 const ui::Event& event) OVERRIDE { |
| 110 ash::SystemTrayDelegate* tray = | 111 ash::Shell* shell = ash::Shell::GetInstance(); |
| 111 ash::Shell::GetInstance()->system_tray_delegate(); | 112 ash::ShellDelegate* shell_delegate = shell->delegate(); |
| 112 if (sender == help_) | 113 ash::SystemTrayDelegate* tray_delegate = shell->system_tray_delegate(); |
| 113 tray->ShowHelp(); | 114 if (sender == help_) { |
| 114 else if (sender == shutdown_) | 115 shell_delegate->RecordUserMetricsAction(ash::UMA_TRAY_HELP); |
| 115 tray->ShutDown(); | 116 tray_delegate->ShowHelp(); |
| 116 else if (sender == lock_) | 117 } else if (sender == shutdown_) { |
| 117 tray->RequestLockScreen(); | 118 shell_delegate->RecordUserMetricsAction(ash::UMA_TRAY_SHUT_DOWN); |
| 118 else | 119 tray_delegate->ShutDown(); |
| 120 } else if (sender == lock_) { |
| 121 shell_delegate->RecordUserMetricsAction(ash::UMA_TRAY_LOCK_SCREEN); |
| 122 tray_delegate->RequestLockScreen(); |
| 123 } else { |
| 119 NOTREACHED(); | 124 NOTREACHED(); |
| 125 } |
| 120 } | 126 } |
| 121 | 127 |
| 122 ash::internal::TrayPopupHeaderButton* help_; | 128 ash::internal::TrayPopupHeaderButton* help_; |
| 123 ash::internal::TrayPopupHeaderButton* shutdown_; | 129 ash::internal::TrayPopupHeaderButton* shutdown_; |
| 124 ash::internal::TrayPopupHeaderButton* lock_; | 130 ash::internal::TrayPopupHeaderButton* lock_; |
| 125 | 131 |
| 126 DISALLOW_COPY_AND_ASSIGN(DateDefaultView); | 132 DISALLOW_COPY_AND_ASSIGN(DateDefaultView); |
| 127 }; | 133 }; |
| 128 | 134 |
| 129 } // namespace | 135 } // namespace |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 time_tray_->UpdateTimeFormat(); | 194 time_tray_->UpdateTimeFormat(); |
| 189 } | 195 } |
| 190 | 196 |
| 191 void TrayDate::Refresh() { | 197 void TrayDate::Refresh() { |
| 192 if (time_tray_) | 198 if (time_tray_) |
| 193 time_tray_->UpdateText(); | 199 time_tray_->UpdateText(); |
| 194 } | 200 } |
| 195 | 201 |
| 196 } // namespace internal | 202 } // namespace internal |
| 197 } // namespace ash | 203 } // namespace ash |
| OLD | NEW |