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 /** | 5 /** |
6 * Takes the |moduleListData| input argument which represents data about | 6 * Takes the |moduleListData| input argument which represents data about |
7 * the currently available modules and populates the html jstemplate | 7 * the currently available modules and populates the html jstemplate |
8 * with that data. It expects an object structure like the above. | 8 * with that data. It expects an object structure like the above. |
9 * @param {Object} moduleListData Information about available modules | 9 * @param {Object} moduleListData Information about available modules |
10 */ | 10 */ |
11 function renderTemplate(moduleListData) { | 11 function renderTemplate(moduleListData) { |
12 // This is the javascript code that processes the template: | 12 // This is the javascript code that processes the template: |
13 var input = new JsEvalContext(moduleListData); | 13 var input = new JsEvalContext(moduleListData); |
14 var output = $('flashInfoTemplate'); | 14 var output = $('flashInfoTemplate'); |
15 jstProcess(input, output); | 15 jstProcess(input, output); |
16 } | 16 } |
17 | 17 |
18 /** | 18 /** |
19 * Asks the C++ FlashUIDOMHandler to get details about the Flash and return | 19 * Asks the C++ FlashUIDOMHandler to get details about the Flash and return |
20 * the data in returnFlashInfo() (below). | 20 * the data in returnFlashInfo() (below). |
21 */ | 21 */ |
22 function requestFlashInfo() { | 22 function requestFlashInfo() { |
23 chrome.send('requestFlashInfo'); | 23 chrome.send('requestFlashInfo'); |
24 } | 24 } |
25 | 25 |
26 /** | 26 /** |
27 * Called by the WebUI to re-populate the page with data representing the | 27 * Called by the WebUI to re-populate the page with data representing the |
28 * current state of Flash. | 28 * current state of Flash. |
29 * @param {Object} moduleListData Information about available modules. | 29 * @param {Object} moduleListData Information about available modules. |
30 */ | 30 */ |
31 function returnFlashInfo(moduleListData) { | 31 function returnFlashInfo(moduleListData) { |
32 $('loading-message').style.visibility = 'hidden'; | 32 $('loading-message').style.visibility = 'hidden'; |
33 $('body-container').style.visibility = 'visible'; | 33 $('body-container').style.visibility = 'visible'; |
34 renderTemplate(moduleListData); | 34 renderTemplate(moduleListData); |
35 } | 35 } |
36 | 36 |
37 // Get data and have it displayed upon loading. | 37 // Get data and have it displayed upon loading. |
38 document.addEventListener('DOMContentLoaded', requestFlashInfo); | 38 document.addEventListener('DOMContentLoaded', requestFlashInfo); |
OLD | NEW |