Chromium Code Reviews| 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..3bb5bf9887390ecc38bf431635cba79267b15d44 |
| --- /dev/null |
| +++ b/chrome/browser/resources/chromeos/retail_mode_logout_dialog.js |
| @@ -0,0 +1,39 @@ |
| +// 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; |
| + |
| + function decrementTimer(time) { |
|
flackr
2012/01/27 07:48:04
Document me, remove time argument.
rkc
2012/02/08 02:52:19
Done.
|
| + if (timeToRestart > 0) { |
| + --timeToRestart; |
| + $('warning').innerHTML = localStrings.getStringF('warning', |
| + timeToRestart); |
| + setTimeout(decrementTimer, 1000); |
| + } else { |
| + chrome.send('requestRestart'); |
| + } |
| + } |
| + |
| + /** |
| + * Inserts translated strings on loading. |
| + */ |
| + function initialize() { |
| + localStrings = new LocalStrings(); |
| + |
| + i18nTemplate.process(document, templateData); |
| + |
| + $('warning').innerHTML = localStrings.getStringF('warning', timeToRestart); |
| + 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.
|
| + } |
| + |
| + return { |
| + initialize: initialize, |
| + }; |
| +}); |
| + |
| +document.addEventListener('DOMContentLoaded', |
| + retailModeLogoutDialog.initialize); |