Chromium Code Reviews| Index: components/version_ui/resources/about_version.js |
| diff --git a/components/version_ui/resources/about_version.js b/components/version_ui/resources/about_version.js |
| index 476311bfae9837eed6419c27409ddf6eab078d8a..1235a3e8ea13877ada73283224455b2c710fc9a3 100644 |
| --- a/components/version_ui/resources/about_version.js |
| +++ b/components/version_ui/resources/about_version.js |
| @@ -2,47 +2,32 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -/** |
| - * Callback from the backend with the list of variations to display. |
| - * This call will build the variations section of the version page, or hide that |
| - * section if there are none to display. |
| - * @param {!Array<string>} variationsList The list of variations. |
| - */ |
| -function returnVariationInfo(variationsList) { |
| - $('variations-section').hidden = !variationsList.length; |
| - $('variations-list').appendChild( |
| - parseHtmlSubset(variationsList.join('<br>'), ['BR'])); |
| -} |
| +define([ |
| + 'mojo/public/js/connection', |
| + '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
|
| + 'content/public/renderer/service_provider', |
| +], function(connection, versionMojom, serviceProvider) { |
| + // TODO(dpapad): Need to wait for DOMContentLoaded too? |
| + var uiHandler = connection.bindHandleToProxy( |
| + serviceProvider.connectToService( |
| + versionMojom.VersionHandlerMojo.name), |
| + versionMojom.VersionHandlerMojo); |
| -/** |
| - * Callback from the backend with the executable and profile paths to display. |
| - * @param {string} execPath The executable path to display. |
| - * @param {string} profilePath The profile path to display. |
| - */ |
| -function returnFilePaths(execPath, profilePath) { |
| - $('executable_path').textContent = execPath; |
| - $('profile_path').textContent = profilePath; |
| -} |
| - |
| -/** |
| - * Callback from the backend with the Flash version to display. |
| - * @param {string} flashVersion The Flash version to display. |
| - */ |
| -function returnFlashVersion(flashVersion) { |
| - $('flash_version').textContent = flashVersion; |
| -} |
| - |
| -/** |
| - * Callback from the backend with the OS version to display. |
| - * @param {string} osVersion The OS version to display. |
| - */ |
| -function returnOsVersion(osVersion) { |
| - $('os_version').textContent = osVersion; |
| -} |
| - |
| -/* All the work we do onload. */ |
| -function onLoadWork() { |
| - chrome.send('requestVersionInfo'); |
| -} |
| - |
| -document.addEventListener('DOMContentLoaded', onLoadWork); |
| + uiHandler.getFilePaths().then(function(response) { |
| + $('executable_path').textContent = response.execPath; |
| + $('profile_path').textContent = response.profilePath; |
| + }); |
| + uiHandler.getFlashVersion().then(function(response) { |
| + $('flash_version').textContent = response.flashVersion; |
| + }); |
| + uiHandler.getVariations().then(function(response) { |
| + $('variations-section').hidden = response.variations.length == 0; |
| + $('variations-list').appendChild( |
| + parseHtmlSubset(response.variations.join('<br>'), ['BR'])); |
| + }); |
| + if (cr.isChromeOS) { |
| + uiHandler.getOsVersion().then(function(response) { |
| + $('os_version').textContent = response.osVersion; |
| + }); |
| + } |
| +}); |