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