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..344918dd731e3c48ac11be637e1938780aab1a49 |
--- /dev/null |
+++ b/chrome/browser/resources/about_nacl.js |
@@ -0,0 +1,34 @@ |
+/** |
+* Takes the |moduleListData| input argument which represents data about |
James Hawkins
2012/08/09 17:16:55
Indentation is off, should be two more spaces.
jvoung (off chromium)
2012/08/09 20:03:35
double checking on two more spaces:
/**
*
*/
James Hawkins
2012/08/11 19:24:28
Sorry, the latter.
|
+* 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 |
+*/ |
+function renderTemplate(moduleListData) { |
James Hawkins
2012/08/09 17:16:55
These need to be wrapped in a namespace.
jvoung (off chromium)
2012/08/09 20:03:35
Done.
|
+ // This is the javascript code that processes the template: |
James Hawkins
2012/08/09 17:16:55
nit: // Process the template.
jvoung (off chromium)
2012/08/09 20:03:35
Done.
|
+ var input = new JsEvalContext(moduleListData); |
+ var output = document.getElementById('naclInfoTemplate'); |
+ jstProcess(input, output); |
+} |
+ |
+/** |
+* Asks the C++ NaClUIDOMHandler to get details about the NaCl and return |
+* the data in returnNaClInfo() (below). |
+*/ |
+function requestNaClInfo() { |
+ 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 |
+*/ |
+function returnNaClInfo(moduleListData) { |
+ document.getElementById('loading-message').style.visibility = 'hidden'; |
+ document.getElementById('body-container').style.visibility = 'visible'; |
+ renderTemplate(moduleListData); |
+} |
+ |
+// Get data and have it displayed upon loading. |
+document.addEventListener('DOMContentLoaded', requestNaClInfo); |