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

Unified Diff: chrome/browser/resources/chromeos/idle_logout_dialog.js

Issue 9568038: Implement the auto-logout on idle feature for Kiosk mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review changes. Created 8 years, 10 months 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/resources/chromeos/idle_logout_dialog.js
diff --git a/chrome/browser/resources/chromeos/idle_logout_dialog.js b/chrome/browser/resources/chromeos/idle_logout_dialog.js
new file mode 100644
index 0000000000000000000000000000000000000000..ad3abcefaaadd0458ccb39f83d25c596f3937766
--- /dev/null
+++ b/chrome/browser/resources/chromeos/idle_logout_dialog.js
@@ -0,0 +1,38 @@
+// 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.
+
+var timeToRestart;
+var localStrings;
+var countdownTimer;
+
+/**
+ * Decrements the countdown timer and updates the display on the dialog.
+ */
+function decrementTimer() {
+ if (timeToRestart >= 0) {
+ $('warning').innerHTML = localStrings.getStringF('warning',
arv (Not doing code reviews) 2012/03/02 00:15:33 Why innerHTML instead of textContent? Why is this
rkc 2012/03/02 01:20:56 Because we need to keep updating the text. Also, s
+ timeToRestart);
+ --timeToRestart;
arv (Not doing code reviews) 2012/03/02 00:15:33 prefer post decr in js
arv (Not doing code reviews) 2012/03/02 00:15:33 This does not seem quite right. How about checking
rkc 2012/03/02 01:20:56 Done.
rkc 2012/03/02 01:20:56 This code is no longer there. Done.
+ } else {
+ clearInterval(countdownTimer);
+ chrome.send('requestLogout');
+ }
+}
+
+function startCountdown(seconds) {
+ timeToRestart = seconds;
+ countdownTimer = setInterval(decrementTimer, 1000);
+}
+
+/**
+ * Inserts translated strings on loading.
+ */
+function initialize() {
+ localStrings = new LocalStrings();
+
+ i18nTemplate.process(document, templateData);
+ chrome.send('requestCountdown');
+}
+
+document.addEventListener('DOMContentLoaded', initialize);

Powered by Google App Engine
This is Rietveld 408576698