Chromium Code Reviews| Index: chrome/browser/resources/about_nacl.js |
| diff --git a/chrome/browser/resources/about_nacl.js b/chrome/browser/resources/about_nacl.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4e43db3fe8b2ed4372068eaf185ca13d77bcb5fc |
| --- /dev/null |
| +++ b/chrome/browser/resources/about_nacl.js |
| @@ -0,0 +1,36 @@ |
| +var nacl = nacl || {}; |
|
James Hawkins
2012/08/11 19:21:07
This is still dangerous in that these methods may
jvoung (off chromium)
2012/08/13 22:15:43
Sorry a bit of a JS noob, so may be doing it wrong
|
| + |
| +/** |
| + * Takes the |moduleListData| input argument which represents data about |
| + * the currently available modules and populates the html jstemplate |
| + * with that data. It expects an object structure like the above. |
| + * @param {Object} moduleListData Information about available modules |
| + */ |
| +nacl.renderTemplate = function(moduleListData) { |
| + // Process the template. |
| + var input = new JsEvalContext(moduleListData); |
| + var output = $('naclInfoTemplate'); |
| + jstProcess(input, output); |
| +}; |
| + |
| +/** |
| + * Asks the C++ NaClUIDOMHandler to get details about the NaCl and return |
| + * the data in returnNaClInfo() (below). |
| + */ |
| +nacl.requestNaClInfo = function() { |
| + chrome.send('requestNaClInfo'); |
| +}; |
| + |
| +/** |
| + * Called by the WebUI to re-populate the page with data representing the |
| + * current state of NaCl. |
| + * @param {Object} moduleListData Information about available modules |
| + */ |
| +nacl.returnNaClInfo = function(moduleListData) { |
| + $('loading-message').hidden = 'hidden'; |
| + $('body-container').hidden = ''; |
| + nacl.renderTemplate(moduleListData); |
| +}; |
| + |
| +// Get data and have it displayed upon loading. |
| +document.addEventListener('DOMContentLoaded', nacl.requestNaClInfo); |