Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: components/version_ui/resources/about_version.js

Issue 1486403002: Mojo-ifying chrome://version. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 (function() {
6
7 define([
8 'mojo/public/js/connection',
9 'chrome/browser/ui/webui/version.mojom',
10 'content/public/renderer/service_provider',
11 ], function(connection, versionMojom, serviceProvider) {
12 // TODO(dpapad): Need to wait for DOMContentLoaded too?
13 var uiHandler = connection.bindHandleToProxy(
14 serviceProvider.connectToService(
15 versionMojom.VersionHandlerMojo.name),
16 versionMojom.VersionHandlerMojo);
17
18 uiHandler.getFilePaths().then(function(response) {
19 setFilePaths(response.execPath, response.profilePath);
20 });
21 uiHandler.getFlashVersion().then(function(response) {
22 setFlashVersion(response.flashVersion);
23 });
24 uiHandler.getVariations().then(function(response) {
25 setVariationInfo(response.variations);
26 });
27 if (cr.isChromeOS) {
28 uiHandler.getOsVersion().then(function(response) {
29 setOsVersion(response.osVersion);
30 });
31 }
32 });
33
5 /** 34 /**
6 * Callback from the backend with the list of variations to display. 35 * Sets the variations to display.
7 * This call will build the variations section of the version page, or hide that 36 * This call will build the variations section of the version page, or hide that
8 * section if there are none to display. 37 * section if there are none to display.
9 * @param {!Array<string>} variationsList The list of variations. 38 * @param {!Array<string>} variationsList The list of variations.
10 */ 39 */
11 function returnVariationInfo(variationsList) { 40 function setVariationInfo(variationsList) {
12 $('variations-section').hidden = !variationsList.length; 41 $('variations-section').hidden = !variationsList.length;
13 $('variations-list').appendChild( 42 $('variations-list').appendChild(
14 parseHtmlSubset(variationsList.join('<br>'), ['BR'])); 43 parseHtmlSubset(variationsList.join('<br>'), ['BR']));
15 } 44 }
16 45
17 /** 46 /**
18 * Callback from the backend with the executable and profile paths to display. 47 * Sets the executable and profile paths to display.
19 * @param {string} execPath The executable path to display. 48 * @param {string} execPath The executable path to display.
20 * @param {string} profilePath The profile path to display. 49 * @param {string} profilePath The profile path to display.
21 */ 50 */
22 function returnFilePaths(execPath, profilePath) { 51 function setFilePaths(execPath, profilePath) {
23 $('executable_path').textContent = execPath; 52 $('executable_path').textContent = execPath;
24 $('profile_path').textContent = profilePath; 53 $('profile_path').textContent = profilePath;
25 } 54 }
26 55
27 /** 56 /**
28 * Callback from the backend with the Flash version to display. 57 * Sets the Flash version to display.
29 * @param {string} flashVersion The Flash version to display. 58 * @param {string} flashVersion The Flash version to display.
30 */ 59 */
31 function returnFlashVersion(flashVersion) { 60 function setFlashVersion(flashVersion) {
32 $('flash_version').textContent = flashVersion; 61 $('flash_version').textContent = flashVersion;
33 } 62 }
34 63
35 /** 64 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
36 * Callback from the backend with the OS version to display. 65 /**
37 * @param {string} osVersion The OS version to display. 66 * Sets the OS version to display.
38 */ 67 * @param {string} osVersion The OS version to display.
39 function returnOsVersion(osVersion) { 68 */
40 $('os_version').textContent = osVersion; 69 function setOsVersion(osVersion) {
70 $('os_version').textContent = osVersion;
71 }
41 } 72 }
42 73
43 /* All the work we do onload. */ 74 })();
44 function onLoadWork() {
45 chrome.send('requestVersionInfo');
46 }
47
48 document.addEventListener('DOMContentLoaded', onLoadWork);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698