| 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 /** |
| 6 * Sets |value| to the element specified by |destination_id|. |
| 7 * Called from C++ code as a result of RequestCryptohomeProperty() call. |
| 8 * @param {string} destination_id Id of the element to be modified. |
| 9 * @param {string} value The value to be set. |
| 10 */ |
| 11 function SetCryptohomeProperty(destination_id, value) { |
| 12 $(destination_id).textContent = value; |
| 13 } |
| 14 |
| 15 /** |
| 16 * Requests updating the element specified by |destination_id|. |
| 17 * @param {string} destination_id Id of the element to be modified. |
| 18 */ |
| 19 function RequestCryptohomeProperty(destination_id) { |
| 20 chrome.send('requestCryptohomeProperty', [destination_id]); |
| 21 } |
| 22 |
| 23 document.addEventListener('DOMContentLoaded', function() { |
| 24 // Request update. |
| 25 RequestCryptohomeProperty('is-mounted'); |
| 26 RequestCryptohomeProperty('tpm-is-ready'); |
| 27 RequestCryptohomeProperty('tpm-is-enabled'); |
| 28 RequestCryptohomeProperty('tpm-is-owned'); |
| 29 RequestCryptohomeProperty('tpm-is-being-owned'); |
| 30 RequestCryptohomeProperty('pkcs11-is-tpm-token-ready'); |
| 31 RequestCryptohomeProperty('is-tpm-token-ready'); |
| 32 RequestCryptohomeProperty('token-name'); |
| 33 RequestCryptohomeProperty('user-pin'); |
| 34 |
| 35 // Auto-refresh when interval is given as pathname. |
| 36 var interval = parseInt(window.location.pathname.split('/')[1]); |
| 37 if (interval > 0) { |
| 38 $('refresh-message').textContent = |
| 39 '(Auto-refreshing page every ' + interval + 's)'; |
| 40 setTimeout(function() { window.location.reload(true); }, interval * 1000); |
| 41 } |
| 42 }); |
| OLD | NEW |