Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 define([ |
| 6 * Callback from the backend with the list of variations to display. | 6 'mojo/public/js/connection', |
| 7 * This call will build the variations section of the version page, or hide that | 7 'chrome/browser/ui/webui/version.mojom', |
|
Evan Stade
2015/12/04 22:30:20
why is this not version.mojom.js (with the same ch
dpapad
2015/12/04 23:28:14
I was just following the pattern, see the other tw
Evan Stade
2015/12/04 23:32:26
now seems like a great time to set the right prece
sky
2015/12/04 23:58:39
That's the id of the module, which need not match
Evan Stade
2015/12/05 00:07:25
OK, I guess there's more precedent for this than I
| |
| 8 * section if there are none to display. | 8 'content/public/renderer/service_provider', |
| 9 * @param {!Array<string>} variationsList The list of variations. | 9 ], function(connection, versionMojom, serviceProvider) { |
| 10 */ | 10 // TODO(dpapad): Need to wait for DOMContentLoaded too? |
| 11 function returnVariationInfo(variationsList) { | 11 var uiHandler = connection.bindHandleToProxy( |
| 12 $('variations-section').hidden = !variationsList.length; | 12 serviceProvider.connectToService( |
| 13 $('variations-list').appendChild( | 13 versionMojom.VersionHandlerMojo.name), |
| 14 parseHtmlSubset(variationsList.join('<br>'), ['BR'])); | 14 versionMojom.VersionHandlerMojo); |
| 15 } | |
| 16 | 15 |
| 17 /** | 16 uiHandler.getFilePaths().then(function(response) { |
| 18 * Callback from the backend with the executable and profile paths to display. | 17 $('executable_path').textContent = response.execPath; |
| 19 * @param {string} execPath The executable path to display. | 18 $('profile_path').textContent = response.profilePath; |
| 20 * @param {string} profilePath The profile path to display. | 19 }); |
| 21 */ | 20 uiHandler.getFlashVersion().then(function(response) { |
| 22 function returnFilePaths(execPath, profilePath) { | 21 $('flash_version').textContent = response.flashVersion; |
| 23 $('executable_path').textContent = execPath; | 22 }); |
| 24 $('profile_path').textContent = profilePath; | 23 uiHandler.getVariations().then(function(response) { |
| 25 } | 24 $('variations-section').hidden = response.variations.length == 0; |
| 26 | 25 $('variations-list').appendChild( |
| 27 /** | 26 parseHtmlSubset(response.variations.join('<br>'), ['BR'])); |
| 28 * Callback from the backend with the Flash version to display. | 27 }); |
| 29 * @param {string} flashVersion The Flash version to display. | 28 if (cr.isChromeOS) { |
| 30 */ | 29 uiHandler.getOsVersion().then(function(response) { |
| 31 function returnFlashVersion(flashVersion) { | 30 $('os_version').textContent = response.osVersion; |
| 32 $('flash_version').textContent = flashVersion; | 31 }); |
| 33 } | 32 } |
| 34 | 33 }); |
| 35 /** | |
| 36 * Callback from the backend with the OS version to display. | |
| 37 * @param {string} osVersion The OS version to display. | |
| 38 */ | |
| 39 function returnOsVersion(osVersion) { | |
| 40 $('os_version').textContent = osVersion; | |
| 41 } | |
| 42 | |
| 43 /* All the work we do onload. */ | |
| 44 function onLoadWork() { | |
| 45 chrome.send('requestVersionInfo'); | |
| 46 } | |
| 47 | |
| 48 document.addEventListener('DOMContentLoaded', onLoadWork); | |
| OLD | NEW |