1 // Copyright 2014 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.
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
11 function renderTemplate(moduleListData) {
12 var input = new JsEvalContext(moduleListData);
13 var output = $('voice-search-info-template');
14 jstProcess(input, output);
18 * Asks the C++ VoiceSearchUIDOMHandler to get details about voice search and
19 * return the data in returnVoiceSearchInfo() (below).
21 function requestVoiceSearchInfo() {
22 chrome.send('requestVoiceSearchInfo');
26 * Called by the WebUI to re-populate the page with data representing the
27 * current state of voice search.
28 * @param {Object} moduleListData Information about available modules.
30 function returnVoiceSearchInfo(moduleListData) {
31 $('loading-message').hidden = true;
32 $('body-container').hidden = false;
33 renderTemplate(moduleListData);
36 // Get data and have it displayed upon loading.
37 document.addEventListener('DOMContentLoaded', requestVoiceSearchInfo);