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