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