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