| 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 "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" | 5 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 13 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 14 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 15 #include "chrome/browser/chromeos/ui/idle_logout_dialog_view.h" | 14 #include "chrome/browser/chromeos/ui/idle_logout_dialog_view.h" |
| 15 #include "components/user_manager/user_manager.h" |
| 16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 19 #include "ui/wm/core/user_activity_detector.h" | 19 #include "ui/wm/core/user_activity_detector.h" |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 static base::LazyInstance<KioskModeIdleLogout> | 25 static base::LazyInstance<KioskModeIdleLogout> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 KioskModeIdleLogout::~KioskModeIdleLogout() { | 44 KioskModeIdleLogout::~KioskModeIdleLogout() { |
| 45 if (ash::Shell::HasInstance() && | 45 if (ash::Shell::HasInstance() && |
| 46 ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this)) | 46 ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this)) |
| 47 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); | 47 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void KioskModeIdleLogout::Setup() { | 50 void KioskModeIdleLogout::Setup() { |
| 51 if (UserManager::Get()->IsLoggedInAsDemoUser()) { | 51 if (user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { |
| 52 // This means that we're recovering from a crash. The user is already | 52 // This means that we're recovering from a crash. The user is already |
| 53 // logged in, so go ahead and start the timer. | 53 // logged in, so go ahead and start the timer. |
| 54 Start(); | 54 Start(); |
| 55 } else { | 55 } else { |
| 56 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 56 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 57 content::NotificationService::AllSources()); | 57 content::NotificationService::AllSources()); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 void KioskModeIdleLogout::Observe( | 61 void KioskModeIdleLogout::Observe( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 89 base::Bind(&KioskModeIdleLogout::OnTimeout, | 89 base::Bind(&KioskModeIdleLogout::OnTimeout, |
| 90 base::Unretained(this))); | 90 base::Unretained(this))); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void KioskModeIdleLogout::OnTimeout() { | 94 void KioskModeIdleLogout::OnTimeout() { |
| 95 IdleLogoutDialogView::ShowDialog(); | 95 IdleLogoutDialogView::ShowDialog(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace chromeos | 98 } // namespace chromeos |
| OLD | NEW |