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

Side by Side 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: . Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 var localStrings;
6
7 // Timer that will check and update the countdown every second.
8 var countdownTimer;
9 // Time at which we should logout the user unless we've been closed.
10 var logoutTime; // ms
11
12 /**
13 * Decrements the countdown timer and updates the display on the dialog.
14 */
15 function decrementTimer() {
16 var currentTime = Date.Now();
arv (Not doing code reviews) 2012/03/02 21:01:21 Date.now() Maybe you should add a test to ensure
rkc 2012/03/02 21:47:09 Fixed and tested manually. I've dedicated all of
17 if (logoutTime > currentTime) {
18 secondsToRestart = Math.round((logoutTime - currentTime) / 1000);
19 $('warning').innerHTML = localStrings.getStringF('warning',
20 secondsToRestart);
21 } else {
22 clearInterval(countdownTimer);
23 chrome.send('requestLogout');
24 }
25 }
26
27 /**
28 * Starts the countdown to logout.
29 */
30 function startCountdown(seconds) {
31 logoutTime = Date.Now() + (seconds * 1000);
arv (Not doing code reviews) 2012/03/02 21:01:21 useless parentheses
rkc 2012/03/02 21:47:09 Done.
32 $('warning').innerHTML = localStrings.getStringF('warning',
33 seconds);
34 countdownTimer = setInterval(decrementTimer, 1000);
35 }
36
37 /**
38 * Inserts translated strings on loading.
39 */
40 function initialize() {
41 localStrings = new LocalStrings();
42
43 i18nTemplate.process(document, templateData);
44 chrome.send('requestCountdown');
45 }
46
47 document.addEventListener('DOMContentLoaded', initialize);
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/idle_logout_dialog.html ('k') | chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698