| Index: components/webapks_ui/resources/about_webapks.js
|
| diff --git a/components/webapks_ui/resources/about_webapks.js b/components/webapks_ui/resources/about_webapks.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9fdb7d10c8462bf465b32db49bdd7a402b73521a
|
| --- /dev/null
|
| +++ b/components/webapks_ui/resources/about_webapks.js
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +/**
|
| + * Creates and returns a node (with |text| as content) assigning it the
|
| + * |className| class.
|
| + */
|
| +function createSpanWithTextAndClass(text, className) {
|
| + var node = createElementWithClassName('span', className);
|
| + node.textContent = text;
|
| + return node;
|
| +}
|
| +
|
| +/**
|
| + * Callback from the backend with the information of a WebAPK to display.
|
| + * This will be called once for each WebAPK available on the device and each
|
| + * one will be appended at the end of the other.
|
| + *
|
| + * @param webApkList List of objects with information about WebAPKs installed.
|
| + */
|
| +function returnWebApksInfo(webApkList) {
|
| + for (const i in webApkList) {
|
| + addWebApk(webApkList[i]);
|
| + }
|
| +}
|
| +
|
| +/**
|
| + * Adds a new entry to the page with the information of a WebAPK.
|
| + *
|
| + * @param webApkInfo Information about an installed WebAPK.
|
| + */
|
| +function addWebApk(webApkInfo) {
|
| + var webApkList = $('webapk-list');
|
| +
|
| + webApkList.appendChild(
|
| + createSpanWithTextAndClass(webApkInfo.shortName, 'app-name'));
|
| +
|
| + webApkList.appendChild(
|
| + createSpanWithTextAndClass('Package name: ', 'app-property-label'));
|
| + webApkList.appendChild(document.createTextNode(webApkInfo.packageName));
|
| +
|
| + webApkList.appendChild(document.createElement('br'));
|
| + webApkList.appendChild(createSpanWithTextAndClass(
|
| + 'Shell APK version: ', 'app-property-label'));
|
| + webApkList.appendChild(document.createTextNode(webApkInfo.shellApkVersion));
|
| +
|
| + webApkList.appendChild(document.createElement('br'));
|
| + webApkList.appendChild(
|
| + createSpanWithTextAndClass('Version code: ', 'app-property-label'));
|
| + webApkList.appendChild(document.createTextNode(webApkInfo.versionCode));
|
| +}
|
| +
|
| +document.addEventListener('DOMContentLoaded', function() {
|
| + chrome.send('requestWebApksInfo');
|
| +});
|
|
|