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/metrics/user_metrics_action.h" | 7 #include "ash/common/metrics/user_metrics_action.h" |
8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
9 #include "ash/common/system/date/date_view.h" | 9 #include "ash/common/system/date/date_view.h" |
10 #include "ash/common/system/tray/special_popup_row.h" | 10 #include "ash/common/system/tray/special_popup_row.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 lock_button_ = new TrayPopupHeaderButton( | 96 lock_button_ = new TrayPopupHeaderButton( |
97 this, IDR_AURA_UBER_TRAY_LOCKSCREEN, IDR_AURA_UBER_TRAY_LOCKSCREEN, | 97 this, IDR_AURA_UBER_TRAY_LOCKSCREEN, IDR_AURA_UBER_TRAY_LOCKSCREEN, |
98 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, | 98 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, |
99 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, IDS_ASH_STATUS_TRAY_LOCK); | 99 IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER, IDS_ASH_STATUS_TRAY_LOCK); |
100 lock_button_->SetTooltipText( | 100 lock_button_->SetTooltipText( |
101 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_LOCK)); | 101 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_LOCK)); |
102 view->AddViewToRowNonMd(lock_button_, true); | 102 view->AddViewToRowNonMd(lock_button_, true); |
103 } | 103 } |
104 SystemTrayDelegate* system_tray_delegate = shell->system_tray_delegate(); | 104 SystemTrayDelegate* system_tray_delegate = shell->system_tray_delegate(); |
105 system_tray_delegate->AddShutdownPolicyObserver(this); | 105 system_tray_delegate->AddShutdownPolicyObserver(this); |
106 system_tray_delegate->ShouldRebootOnShutdown(base::Bind( | 106 // Will invoke OnShutdownPolicyChanged with the initial value. |
107 &DateDefaultView::OnShutdownPolicyChanged, weak_factory_.GetWeakPtr())); | 107 system_tray_delegate->CheckIfRebootOnShutdown(); |
108 #endif // !defined(OS_WIN) | 108 #endif // !defined(OS_WIN) |
109 } | 109 } |
110 | 110 |
111 DateDefaultView::~DateDefaultView() { | 111 DateDefaultView::~DateDefaultView() { |
112 // We need the check as on shell destruction, the delegate is destroyed first. | 112 // We need the check as on shell destruction, the delegate is destroyed first. |
113 SystemTrayDelegate* system_tray_delegate = | 113 SystemTrayDelegate* system_tray_delegate = |
114 WmShell::Get()->system_tray_delegate(); | 114 WmShell::Get()->system_tray_delegate(); |
115 if (system_tray_delegate) | 115 if (system_tray_delegate) |
116 system_tray_delegate->RemoveShutdownPolicyObserver(this); | 116 system_tray_delegate->RemoveShutdownPolicyObserver(this); |
117 } | 117 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { | 157 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { |
158 if (!shutdown_button_) | 158 if (!shutdown_button_) |
159 return; | 159 return; |
160 | 160 |
161 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( | 161 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( |
162 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT | 162 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT |
163 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); | 163 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); |
164 } | 164 } |
165 | 165 |
166 } // namespace ash | 166 } // namespace ash |
OLD | NEW |