| Index: chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.cc
|
| diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.cc
|
| deleted file mode 100644
|
| index 0658f440370ab7da392e63c9d9b13bfe46f8cec8..0000000000000000000000000000000000000000
|
| --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.cc
|
| +++ /dev/null
|
| @@ -1,99 +0,0 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h"
|
| -
|
| -#include "ash/shell.h"
|
| -#include "base/bind.h"
|
| -#include "base/lazy_instance.h"
|
| -#include "base/logging.h"
|
| -#include "base/message_loop/message_loop.h"
|
| -#include "chrome/browser/chrome_notification_types.h"
|
| -#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
|
| -#include "chrome/browser/chromeos/ui/idle_logout_dialog_view.h"
|
| -#include "components/user_manager/user_manager.h"
|
| -#include "content/public/browser/notification_observer.h"
|
| -#include "content/public/browser/notification_registrar.h"
|
| -#include "content/public/browser/notification_service.h"
|
| -#include "ui/wm/core/user_activity_detector.h"
|
| -
|
| -namespace chromeos {
|
| -
|
| -namespace {
|
| -
|
| -static base::LazyInstance<KioskModeIdleLogout>
|
| - g_kiosk_mode_idle_logout = LAZY_INSTANCE_INITIALIZER;
|
| -
|
| -} // namespace
|
| -
|
| -// static
|
| -void KioskModeIdleLogout::Initialize() {
|
| - g_kiosk_mode_idle_logout.Get();
|
| -}
|
| -
|
| -KioskModeIdleLogout::KioskModeIdleLogout() {
|
| - if (KioskModeSettings::Get()->is_initialized()) {
|
| - Setup();
|
| - } else {
|
| - KioskModeSettings::Get()->Initialize(base::Bind(&KioskModeIdleLogout::Setup,
|
| - base::Unretained(this)));
|
| - }
|
| -}
|
| -
|
| -KioskModeIdleLogout::~KioskModeIdleLogout() {
|
| - wm::UserActivityDetector* user_activity_detector =
|
| - wm::UserActivityDetector::Get();
|
| - if (user_activity_detector && user_activity_detector->HasObserver(this))
|
| - user_activity_detector->RemoveObserver(this);
|
| -}
|
| -
|
| -void KioskModeIdleLogout::Setup() {
|
| - if (user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) {
|
| - // This means that we're recovering from a crash. The user is already
|
| - // logged in, so go ahead and start the timer.
|
| - Start();
|
| - } else {
|
| - registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_CHANGED,
|
| - content::NotificationService::AllSources());
|
| - }
|
| -}
|
| -
|
| -void KioskModeIdleLogout::Observe(
|
| - int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
|
| - Start();
|
| - registrar_.RemoveAll();
|
| - }
|
| -}
|
| -
|
| -void KioskModeIdleLogout::OnUserActivity(const ui::Event* event) {
|
| - IdleLogoutDialogView::CloseDialog();
|
| - ResetTimer();
|
| -}
|
| -
|
| -void KioskModeIdleLogout::Start() {
|
| - if (!wm::UserActivityDetector::Get()->HasObserver(this))
|
| - wm::UserActivityDetector::Get()->AddObserver(this);
|
| - ResetTimer();
|
| -}
|
| -
|
| -void KioskModeIdleLogout::ResetTimer() {
|
| - if (timer_.IsRunning()) {
|
| - timer_.Reset();
|
| - } else {
|
| - // OneShotTimer destroys the posted task after running it, so Reset()
|
| - // isn't safe to call on a timer that's already fired.
|
| - timer_.Start(FROM_HERE, KioskModeSettings::Get()->GetIdleLogoutTimeout(),
|
| - base::Bind(&KioskModeIdleLogout::OnTimeout,
|
| - base::Unretained(this)));
|
| - }
|
| -}
|
| -
|
| -void KioskModeIdleLogout::OnTimeout() {
|
| - IdleLogoutDialogView::ShowDialog();
|
| -}
|
| -
|
| -} // namespace chromeos
|
|
|