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..7d0f55341d454f586b6dc06d2f94a2fa059f867a 100644 |
| --- a/components/version_ui/resources/about_version.js |
| +++ b/components/version_ui/resources/about_version.js |
| @@ -2,47 +2,73 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +(function() { |
| + |
| +define([ |
| + 'mojo/public/js/connection', |
| + 'chrome/browser/ui/webui/version.mojom', |
| + '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); |
| + |
| + uiHandler.getFilePaths().then(function(response) { |
| + setFilePaths(response.execPath, response.profilePath); |
| + }); |
| + uiHandler.getFlashVersion().then(function(response) { |
| + setFlashVersion(response.flashVersion); |
| + }); |
| + uiHandler.getVariations().then(function(response) { |
| + setVariationInfo(response.variations); |
| + }); |
| + if (cr.isChromeOS) { |
| + uiHandler.getOsVersion().then(function(response) { |
| + setOsVersion(response.osVersion); |
| + }); |
| + } |
| +}); |
| + |
| /** |
| - * Callback from the backend with the list of variations to display. |
| + * Sets the 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) { |
| +function setVariationInfo(variationsList) { |
| $('variations-section').hidden = !variationsList.length; |
| $('variations-list').appendChild( |
| parseHtmlSubset(variationsList.join('<br>'), ['BR'])); |
| } |
| /** |
| - * Callback from the backend with the executable and profile paths to display. |
| + * Sets 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) { |
| +function setFilePaths(execPath, profilePath) { |
| $('executable_path').textContent = execPath; |
| $('profile_path').textContent = profilePath; |
| } |
| /** |
| - * Callback from the backend with the Flash version to display. |
| + * Sets the Flash version to display. |
| * @param {string} flashVersion The Flash version to display. |
| */ |
| -function returnFlashVersion(flashVersion) { |
| +function setFlashVersion(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'); |
| +if (cr.isChromeOS) { |
|
Evan Stade
2015/12/04 19:50:28
why does this need to be guarded with this conditi
dpapad
2015/12/04 22:01:51
Changed it so that this is obsolete (inlined the m
|
| + /** |
| + * Sets the OS version to display. |
| + * @param {string} osVersion The OS version to display. |
| + */ |
| + function setOsVersion(osVersion) { |
| + $('os_version').textContent = osVersion; |
| + } |
| } |
| -document.addEventListener('DOMContentLoaded', onLoadWork); |
| +})(); |