| 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/chromeos/session/last_window_closed_logout_reminder.h" | 5 #include "ash/system/chromeos/session/last_window_closed_logout_reminder.h" |
| 6 | 6 |
| 7 #include "ash/common/system/tray/system_tray_delegate.h" | 7 #include "ash/common/system/tray/system_tray_delegate.h" |
| 8 #include "ash/common/wm_shell.h" |
| 8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 9 #include "ash/system/chromeos/session/logout_confirmation_controller.h" | 10 #include "ash/system/chromeos/session/logout_confirmation_controller.h" |
| 10 #include "ash/system/tray/system_tray_notifier.h" | 11 #include "ash/system/tray/system_tray_notifier.h" |
| 11 #include "ash/system/user/login_status.h" | 12 #include "ash/system/user/login_status.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 | 14 |
| 14 namespace ash { | 15 namespace ash { |
| 15 namespace { | 16 namespace { |
| 16 const int kLogoutConfirmationDelayInSeconds = 20; | 17 const int kLogoutConfirmationDelayInSeconds = 20; |
| 17 } | 18 } |
| 18 | 19 |
| 19 LastWindowClosedLogoutReminder::LastWindowClosedLogoutReminder() { | 20 LastWindowClosedLogoutReminder::LastWindowClosedLogoutReminder() { |
| 20 Shell::GetInstance()->system_tray_notifier()->AddLastWindowClosedObserver( | 21 Shell::GetInstance()->system_tray_notifier()->AddLastWindowClosedObserver( |
| 21 this); | 22 this); |
| 22 } | 23 } |
| 23 | 24 |
| 24 LastWindowClosedLogoutReminder::~LastWindowClosedLogoutReminder() { | 25 LastWindowClosedLogoutReminder::~LastWindowClosedLogoutReminder() { |
| 25 Shell::GetInstance()->system_tray_notifier()->RemoveLastWindowClosedObserver( | 26 Shell::GetInstance()->system_tray_notifier()->RemoveLastWindowClosedObserver( |
| 26 this); | 27 this); |
| 27 } | 28 } |
| 28 | 29 |
| 29 void LastWindowClosedLogoutReminder::OnLastWindowClosed() { | 30 void LastWindowClosedLogoutReminder::OnLastWindowClosed() { |
| 30 if (Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() != | 31 if (WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != |
| 31 LoginStatus::PUBLIC) { | 32 LoginStatus::PUBLIC) { |
| 32 return; | 33 return; |
| 33 } | 34 } |
| 34 | 35 |
| 35 // Ask the user to confirm logout if a public session is in progress and the | 36 // Ask the user to confirm logout if a public session is in progress and the |
| 36 // screen is not locked. | 37 // screen is not locked. |
| 37 Shell::GetInstance()->logout_confirmation_controller()->ConfirmLogout( | 38 Shell::GetInstance()->logout_confirmation_controller()->ConfirmLogout( |
| 38 base::TimeTicks::Now() + | 39 base::TimeTicks::Now() + |
| 39 base::TimeDelta::FromSeconds(kLogoutConfirmationDelayInSeconds)); | 40 base::TimeDelta::FromSeconds(kLogoutConfirmationDelayInSeconds)); |
| 40 } | 41 } |
| 41 | 42 |
| 42 } // namespace ash | 43 } // namespace ash |
| OLD | NEW |