Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1982)

Unified Diff: chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.cc

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698