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

Side by Side Diff: components/webapks_ui/resources/about_webapks.js

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Makes the listWebApks method receive a callback on the Java side Created 3 years, 11 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
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * Creates and returns a node (with |text| as content) assigning it the
7 * |className| class.
8 */
9 function createTextElementWithClassName(text, className) {
10 var node = document.createElement('span');
pkotwicz 2017/01/18 02:08:21 You should use createElementWithClassName() to mak
pkotwicz 2017/01/19 19:37:16 ^^^ I think that you missed this comment
11 node.textContent = text;
12 node.className = className;
13 return node;
14 }
15
16 /**
17 * Callback from the backend with the information of a WebAPK to display.
18 * This will be called once for each WebAPK available on the device and each
19 * one will be appended at the end of the other.
20 */
21 function returnWebApksInfo(webApksList) {
22 for (const i in webApksList) {
23 addWebApk(webApksList[i]);
24 }
25 }
26
27 function addWebApk(webApkInfo) {
28 var webApksList = $('webapks-list');
29
30 webApksList.appendChild(document.createElement("BR"));
pkotwicz 2017/01/18 02:08:21 Nit: It looks like most of the other places in the
pkotwicz 2017/01/19 19:37:16 ^^^ I think that you missed this comment
gonzalon 2017/01/19 23:50:15 Done.
31 webApksList.appendChild(document.createElement("BR"));
32 webApksList.appendChild(
33 createTextElementWithClassName(webApkInfo.shortName, "app-name"));
34
35 webApksList.appendChild(document.createElement("BR"));
36 webApksList.appendChild(createTextElementWithClassName(
37 loadTimeData.getString('packageName'), "app-property-label"));
38 webApksList.appendChild(document.createTextNode(webApkInfo.packageName));
39
40 webApksList.appendChild(document.createElement("BR"));
41 webApksList.appendChild(createTextElementWithClassName(
42 loadTimeData.getString('shellApkVersion'), "app-property-label"));
43 webApksList.appendChild(document.createTextNode(webApkInfo.shellApkVersion));
44
45 webApksList.appendChild(document.createElement("BR"));
46 webApksList.appendChild(createTextElementWithClassName(
47 loadTimeData.getString('versionCode'), "app-property-label"));
48 webApksList.appendChild(document.createTextNode(webApkInfo.versionCode));
49 }
50
51 /* All the work we do onload. */
52 function onLoadWork() {
53 chrome.send('requestWebApksInfo');
54 }
55
56 document.addEventListener('DOMContentLoaded', onLoadWork);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698