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

Side by Side Diff: chrome/browser/resources/webapks/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 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.
Dan Beam 2017/01/25 23:27:33 @return {HTMLElement}
gonzalon 2017/01/26 17:02:49 Done.
8 */
9 function createSpanWithTextAndClass(text, className) {
10 var node = createElementWithClassName('span', className);
Dan Beam 2017/01/25 23:27:33 nit: name this el? Node and Element are different
gonzalon 2017/01/26 17:02:49 Done.
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.
19 *
20 * @param webApkList List of objects with information about WebAPKs installed.
Dan Beam 2017/01/25 23:27:33 you need a type name in this @param. an example:
gonzalon 2017/01/26 17:02:49 Done.
21 */
22 function returnWebApksInfo(webApkList) {
23 for (var i in webApkList) {
24 addWebApk(webApkList[i]);
25 }
26 }
27
28 /**
29 * Adds a new entry to the page with the information of a WebAPK.
30 *
31 * @param webApkInfo Information about an installed WebAPK.
Dan Beam 2017/01/25 23:27:33 @param {WebApkInfo} webApkInfo
gonzalon 2017/01/26 17:02:49 Done.
32 */
33 function addWebApk(webApkInfo) {
34 var webApkList = $('webapk-list');
35
36 webApkList.appendChild(
37 createSpanWithTextAndClass(webApkInfo.shortName, 'app-name'));
38
39 webApkList.appendChild(
40 createSpanWithTextAndClass('Package name: ', 'app-property-label'));
41 webApkList.appendChild(document.createTextNode(webApkInfo.packageName));
42
43 webApkList.appendChild(document.createElement('br'));
44 webApkList.appendChild(createSpanWithTextAndClass(
45 'Shell APK version: ', 'app-property-label'));
46 webApkList.appendChild(document.createTextNode(webApkInfo.shellApkVersion));
47
48 webApkList.appendChild(document.createElement('br'));
49 webApkList.appendChild(
50 createSpanWithTextAndClass('Version code: ', 'app-property-label'));
51 webApkList.appendChild(document.createTextNode(webApkInfo.versionCode));
52 }
53
54 document.addEventListener('DOMContentLoaded', function() {
55 chrome.send('requestWebApksInfo');
56 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698