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

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

Issue 9265026: Implement restart on Idle for Kiosk Mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments. 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/retail_mode_logout_dialog.js
diff --git a/chrome/browser/resources/chromeos/retail_mode_logout_dialog.js b/chrome/browser/resources/chromeos/retail_mode_logout_dialog.js
new file mode 100644
index 0000000000000000000000000000000000000000..c094dc0126600c585bf29835a541bf860783af8c
--- /dev/null
+++ b/chrome/browser/resources/chromeos/retail_mode_logout_dialog.js
@@ -0,0 +1,43 @@
+// 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.
+
+cr.define('retailModeLogoutDialog', function() {
+ 'use strict';
+ var timeToRestart = 20; // seconds
+ var localStrings;
+ var countdownTimer = -1;
flackr 2012/02/08 21:23:44 nit: leave value undefined.
+
+ /**
+ * Decrements the countdown timer and updates the display on the dialog.
+ */
+ function decrementTimer() {
+ if (timeToRestart > 0) {
+ --timeToRestart;
+ $('warning').innerHTML = localStrings.getStringF('warning',
+ timeToRestart);
+ } else {
+ clearInterval(countdownTimer);
+ chrome.send('requestRestart');
+ }
+ }
+
+ /**
+ * Inserts translated strings on loading.
+ */
+ function initialize() {
+ localStrings = new LocalStrings();
+
+ i18nTemplate.process(document, templateData);
+
+ $('warning').innerHTML = localStrings.getStringF('warning', timeToRestart);
+ countdownTimer = setInterval(decrementTimer, 1000);
+ }
+
+ return {
+ initialize: initialize,
+ };
+});
+
+document.addEventListener('DOMContentLoaded',
+ retailModeLogoutDialog.initialize);

Powered by Google App Engine
This is Rietveld 408576698