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

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

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Add a chrome://webapks page. 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) {
Dan Beam 2017/01/24 18:41:50 createSpanWithTextAndClass?
gonzalon 2017/01/24 20:43:29 Done.
10 var node = createElementWithClassName('span', className);
11 node.textContent = text;
12 return node;
13 }
14
15 /**
16 * Callback from the backend with the information of a WebAPK to display.
17 * This will be called once for each WebAPK available on the device and each
18 * one will be appended at the end of the other.
Dan Beam 2017/01/24 18:41:50 @param {...some type goes here...} webApksList ...
gonzalon 2017/01/24 20:43:29 Done.
19 */
20 function returnWebApksInfo(webApksList) {
Dan Beam 2017/01/24 18:41:50 can this just be webApkList?
gonzalon 2017/01/24 20:43:29 Done.
21 for (const i in webApksList) {
22 addWebApk(webApksList[i]);
23 }
24 }
25
Dan Beam 2017/01/24 18:41:50 @param for webApkInfo
gonzalon 2017/01/24 20:43:29 Done.
26 function addWebApk(webApkInfo) {
27 var webApksList = $('webapks-list');
28
29 webApksList.appendChild(document.createElement('br'));
30 webApksList.appendChild(document.createElement('br'));
Dan Beam 2017/01/24 18:41:50 don't use br
gonzalon 2017/01/24 20:43:29 Done.
31 webApksList.appendChild(
32 createTextElementWithClassName(webApkInfo.shortName, 'app-name'));
33
34 webApksList.appendChild(document.createElement('br'));
35 webApksList.appendChild(
36 createTextElementWithClassName('Package name: ', 'app-property-label'));
37 webApksList.appendChild(document.createTextNode(webApkInfo.packageName));
38
39 webApksList.appendChild(document.createElement('br'));
40 webApksList.appendChild(createTextElementWithClassName(
41 'Shell APK version: ', 'app-property-label'));
42 webApksList.appendChild(document.createTextNode(webApkInfo.shellApkVersion));
43
44 webApksList.appendChild(document.createElement('br'));
45 webApksList.appendChild(
46 createTextElementWithClassName('Version code: ', 'app-property-label'));
47 webApksList.appendChild(document.createTextNode(webApkInfo.versionCode));
48 }
49
50 /* All the work we do onload. */
51 function onLoadWork() {
52 chrome.send('requestWebApksInfo');
53 }
54
55 document.addEventListener('DOMContentLoaded', onLoadWork);
Dan Beam 2017/01/24 18:41:50 can we just inline this function? document.addEve
gonzalon 2017/01/24 20:43:29 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698