| 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..0d14b86efd1383347f68a6e2c64c62f92882cdb8
|
| --- /dev/null
|
| +++ b/components/webapks_ui/resources/about_webapks.js
|
| @@ -0,0 +1,49 @@
|
| +// Copyright (c) 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 createTextElementWithClassName(text, className) {
|
| + var node = document.createElement('span');
|
| + node.textContent = text;
|
| + node.className = className;
|
| + 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.
|
| + */
|
| +function returnWebApksInfo(appName, packageName, shellApkVersion, versionCode) {
|
| + var webApksList = $('webapks-list');
|
| +
|
| + webApksList.appendChild(document.createElement("BR"));
|
| + webApksList.appendChild(document.createElement("BR"));
|
| + webApksList.appendChild(createTextElementWithClassName(appName, "app-name"));
|
| +
|
| + webApksList.appendChild(document.createElement("BR"));
|
| + webApksList.appendChild(createTextElementWithClassName(
|
| + loadTimeData.getString('packageName'), "app-property-label"));
|
| + webApksList.appendChild(document.createTextNode(packageName));
|
| +
|
| + webApksList.appendChild(document.createElement("BR"));
|
| + webApksList.appendChild(createTextElementWithClassName(
|
| + loadTimeData.getString('shellApkVersion'), "app-property-label"));
|
| + webApksList.appendChild(document.createTextNode(shellApkVersion));
|
| +
|
| + webApksList.appendChild(document.createElement("BR"));
|
| + webApksList.appendChild(createTextElementWithClassName(
|
| + loadTimeData.getString('versionCode'), "app-property-label"));
|
| + webApksList.appendChild(document.createTextNode(versionCode));
|
| +}
|
| +
|
| +/* All the work we do onload. */
|
| +function onLoadWork() {
|
| + chrome.send('requestWebApksInfo');
|
| +}
|
| +
|
| +document.addEventListener('DOMContentLoaded', onLoadWork);
|
|
|