OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var nacl = nacl || {}; | 5 var nacl = nacl || {}; |
6 | 6 |
7 (function() { | 7 (function() { |
8 /** | 8 /** |
9 * Takes the |moduleListData| input argument which represents data about | 9 * Takes the |moduleListData| input argument which represents data about |
10 * the currently available modules and populates the html jstemplate | 10 * the currently available modules and populates the html jstemplate |
11 * with that data. It expects an object structure like the above. | 11 * with that data. It expects an object structure like the above. |
12 * @param {Object} moduleListData Information about available modules | 12 * @param {Object} moduleListData Information about available modules |
13 */ | 13 */ |
14 function renderTemplate(moduleListData) { | 14 function renderTemplate(moduleListData) { |
15 // Process the template. | 15 // Process the template. |
16 var input = new JsEvalContext(moduleListData); | 16 var input = new JsEvalContext(moduleListData); |
17 var output = $('naclInfoTemplate'); | 17 var output = $('naclInfoTemplate'); |
18 jstProcess(input, output); | 18 jstProcess(input, output); |
19 } | 19 } |
20 | 20 |
21 /** | 21 /** |
22 * Asks the C++ NaClUIDOMHandler to get details about the NaCl and return | 22 * Asks the C++ NaClUIDOMHandler to get details about the NaCl and return |
23 * the data in returnNaClInfo() (below). | 23 * the data in returnNaClInfo() (below). |
24 */ | 24 */ |
25 function requestNaClInfo() { | 25 function requestNaClInfo() { |
26 chrome.send('requestNaClInfo'); | 26 chrome.send('requestNaClInfo'); |
27 } | 27 } |
28 | 28 |
29 /** | 29 /** |
30 * Called by the WebUI to re-populate the page with data representing the | 30 * Called by the WebUI to re-populate the page with data representing the |
31 * current state of NaCl. | 31 * current state of NaCl. |
32 * @param {Object} moduleListData Information about available modules | 32 * @param {Object} moduleListData Information about available modules |
33 */ | 33 */ |
34 nacl.returnNaClInfo = function(moduleListData) { | 34 nacl.returnNaClInfo = function(moduleListData) { |
35 $('loading-message').hidden = 'hidden'; | 35 $('loading-message').hidden = 'hidden'; |
36 $('body-container').hidden = ''; | 36 $('body-container').hidden = ''; |
37 renderTemplate(moduleListData); | 37 renderTemplate(moduleListData); |
38 }; | 38 }; |
39 | 39 |
40 // Get data and have it displayed upon loading. | 40 // Get data and have it displayed upon loading. |
41 document.addEventListener('DOMContentLoaded', requestNaClInfo); | 41 document.addEventListener('DOMContentLoaded', requestNaClInfo); |
42 })(); | 42 })(); |
OLD | NEW |