Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 cr.define('retailModeLogoutDialog', function() { | |
| 6 'use strict'; | |
| 7 var timeToRestart = 20; // seconds | |
| 8 var localStrings; | |
| 9 var countdownTimer = -1; | |
|
flackr
2012/02/08 21:23:44
nit: leave value undefined.
| |
| 10 | |
| 11 /** | |
| 12 * Decrements the countdown timer and updates the display on the dialog. | |
| 13 */ | |
| 14 function decrementTimer() { | |
| 15 if (timeToRestart > 0) { | |
| 16 --timeToRestart; | |
| 17 $('warning').innerHTML = localStrings.getStringF('warning', | |
| 18 timeToRestart); | |
| 19 } else { | |
| 20 clearInterval(countdownTimer); | |
| 21 chrome.send('requestRestart'); | |
| 22 } | |
| 23 } | |
| 24 | |
| 25 /** | |
| 26 * Inserts translated strings on loading. | |
| 27 */ | |
| 28 function initialize() { | |
| 29 localStrings = new LocalStrings(); | |
| 30 | |
| 31 i18nTemplate.process(document, templateData); | |
| 32 | |
| 33 $('warning').innerHTML = localStrings.getStringF('warning', timeToRestart); | |
| 34 countdownTimer = setInterval(decrementTimer, 1000); | |
| 35 } | |
| 36 | |
| 37 return { | |
| 38 initialize: initialize, | |
| 39 }; | |
| 40 }); | |
| 41 | |
| 42 document.addEventListener('DOMContentLoaded', | |
| 43 retailModeLogoutDialog.initialize); | |
| OLD | NEW |