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

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: Add missing include Created 4 years, 6 months 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 /** 5 /** @return {!Promise} */
6 * Callback from the backend with the list of variations to display. 6 function getUiHandler() {
7 * This call will build the variations section of the version page, or hide that 7 return new Promise(function(resolve, reject) {
8 * section if there are none to display. 8 define([
Eugene But (OOO till 7-30) 2016/06/02 22:23:12 define('main', [ Otherwise this does not work on
9 * @param {!Array<string>} variationsList The list of variations. 9 'mojo/public/js/connection',
10 */ 10 'chrome/browser/ui/webui/version.mojom',
11 function returnVariationInfo(variationsList) { 11 'content/public/renderer/frame_service_registry',
12 $('variations-section').hidden = !variationsList.length; 12 ], function(connection, versionMojom, serviceRegistry) {
13 $('variations-list').appendChild( 13 var uiHandler = connection.bindHandleToProxy(
14 parseHtmlSubset(variationsList.join('<br>'), ['BR'])); 14 serviceRegistry.connectToService(
15 versionMojom.VersionPageHandler.name),
16 versionMojom.VersionPageHandler);
17 resolve(uiHandler);
18 });
19 });
15 } 20 }
16 21
17 /** 22 /**
18 * Callback from the backend with the executable and profile paths to display. 23 * @return {!Promise} Fires when DOMContentLoaded event is received.
19 * @param {string} execPath The executable path to display.
20 * @param {string} profilePath The profile path to display.
21 */ 24 */
22 function returnFilePaths(execPath, profilePath) { 25 function whenDomContentLoaded() {
23 $('executable_path').textContent = execPath; 26 return new Promise(function(resolve, reject) {
24 $('profile_path').textContent = profilePath; 27 document.addEventListener('DOMContentLoaded', resolve);
28 });
25 } 29 }
26 30
27 /** 31 function main() {
28 * Callback from the backend with the Flash version to display. 32 Promise.all([
29 * @param {string} flashVersion The Flash version to display. 33 whenDomContentLoaded(), getUiHandler()
30 */ 34 ]).then(function(results) {
31 function returnFlashVersion(flashVersion) { 35 var uiHandler = results[1];
32 $('flash_version').textContent = flashVersion; 36 uiHandler.getFilePaths().then(function(response) {
Eugene But (OOO till 7-30) 2016/06/04 01:15:25 This should not be called for iOS
37 $('executable_path').textContent = response.execPath;
38 $('profile_path').textContent = response.profilePath;
39 });
40 uiHandler.getVariations().then(function(response) {
41 $('variations-section').hidden = response.variations.length == 0;
42 $('variations-list').appendChild(
43 parseHtmlSubset(response.variations.join('<br>'), ['BR']));
44 });
45
46 if (!cr.isAndroid) {
Eugene But (OOO till 7-30) 2016/06/04 01:15:25 ditto
47 uiHandler.getFlashVersion().then(function(response) {
48 $('flash_version').textContent = response.flashVersion;
49 });
50 }
51
52 if (cr.isChromeOS) {
53 uiHandler.getOsVersion().then(function(response) {
54 $('os_version').textContent = response.osVersion;
55 });
56 uiHandler.getArcVersion().then(function(response) {
57 $('arc_version').textContent = response.arcVersion;
58 $('arc_holder').hidden = !response.arcVersion;
59 });
60 }
61 });
33 } 62 }
34 63 main();
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
44 /**
45 * Callback from the backend with the ARC version to display.
46 * @param {string} arcVersion The ARC version to display.
47 */
48 function returnARCVersion(arcVersion) {
49 $('arc_version').textContent = arcVersion;
50 $('arc_holder').hidden = !arcVersion;
51 }
52
53 /* All the work we do onload. */
54 function onLoadWork() {
55 chrome.send('requestVersionInfo');
56 $('arc_holder').hidden = true;
57 }
58
59 document.addEventListener('DOMContentLoaded', onLoadWork);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698