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 | |
| 10 function decrementTimer(time) { | |
|
flackr
2012/01/27 07:48:04
Document me, remove time argument.
rkc
2012/02/08 02:52:19
Done.
| |
| 11 if (timeToRestart > 0) { | |
| 12 --timeToRestart; | |
| 13 $('warning').innerHTML = localStrings.getStringF('warning', | |
| 14 timeToRestart); | |
| 15 setTimeout(decrementTimer, 1000); | |
| 16 } else { | |
| 17 chrome.send('requestRestart'); | |
| 18 } | |
| 19 } | |
| 20 | |
| 21 /** | |
| 22 * Inserts translated strings on loading. | |
| 23 */ | |
| 24 function initialize() { | |
| 25 localStrings = new LocalStrings(); | |
| 26 | |
| 27 i18nTemplate.process(document, templateData); | |
| 28 | |
| 29 $('warning').innerHTML = localStrings.getStringF('warning', timeToRestart); | |
| 30 setTimeout(decrementTimer, 1000); | |
|
flackr
2012/01/27 07:48:04
Use setInterval and remove it when time reaches 0.
rkc
2012/02/08 02:52:19
Done.
| |
| 31 } | |
| 32 | |
| 33 return { | |
| 34 initialize: initialize, | |
| 35 }; | |
| 36 }); | |
| 37 | |
| 38 document.addEventListener('DOMContentLoaded', | |
| 39 retailModeLogoutDialog.initialize); | |
| OLD | NEW |