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

Side by Side Diff: chrome/browser/resources/webapks/about_webapks.js

Issue 2714633003: Adds more metadata to the about:webapks page (Closed)
Patch Set: Created 3 years, 10 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @typedef {{ 6 * @typedef {{
7 * name: string,
7 * shortName: string, 8 * shortName: string,
8 * packageName: string, 9 * packageName: string,
9 * shellApkVersion: number, 10 * shellApkVersion: number,
10 * versionCode: number 11 * versionCode: number
12 * uri: string,
13 * scope: string,
14 * manifestUrl: string,
15 * manifestStartUrl: string,
16 * displayMode: string,
17 * orientation: string,
18 * themeColor: string,
19 * backgroundColor: string,
11 * }} 20 * }}
12 */ 21 */
13 var WebApkInfo; 22 var WebApkInfo;
14 23
15 /** 24 /**
16 * Creates and returns an element (with |text| as content) assigning it the 25 * Creates and returns an element (with |text| as content) assigning it the
17 * |className| class. 26 * |className| class.
18 * 27 *
19 * @param {string} text Text to be shown in the span. 28 * @param {string} text Text to be shown in the span.
20 * @param {string} className Class to be assigned to the new element. 29 * @param {string} className Class to be assigned to the new element.
(...skipping 11 matching lines...) Expand all
32 * one will be appended at the end of the other. 41 * one will be appended at the end of the other.
33 * 42 *
34 * @param {!Array<WebApkInfo>} webApkList List of objects with information about 43 * @param {!Array<WebApkInfo>} webApkList List of objects with information about
35 * WebAPKs installed. 44 * WebAPKs installed.
36 */ 45 */
37 function returnWebApksInfo(webApkList) { 46 function returnWebApksInfo(webApkList) {
38 for (let webApkInfo of webApkList) { 47 for (let webApkInfo of webApkList) {
39 addWebApk(webApkInfo); 48 addWebApk(webApkInfo);
40 } 49 }
41 } 50 }
42 51
Dan Beam 2017/02/24 18:36:16 can you add @param documentation here?
gonzalon 2017/02/24 22:30:52 Done.
52 function addWebApkField(webApkList, label, value) {
53 webApkList.appendChild(document.createElement('br'));
Dan Beam 2017/02/24 18:36:16 instead of <br><span>, why not just <div>?
gonzalon 2017/02/24 22:30:52 Done.
54 webApkList.appendChild(createSpanWithTextAndClass(
55 label, 'app-property-label'));
56 webApkList.appendChild(document.createTextNode(value));
57 }
58
43 /** 59 /**
44 * Adds a new entry to the page with the information of a WebAPK. 60 * Adds a new entry to the page with the information of a WebAPK.
45 * 61 *
46 * @param {WebApkInfo} webApkInfo Information about an installed WebAPK. 62 * @param {WebApkInfo} webApkInfo Information about an installed WebAPK.
47 */ 63 */
48 function addWebApk(webApkInfo) { 64 function addWebApk(webApkInfo) {
49 var webApkList = $('webapk-list'); 65 var webApkList = $('webapk-list');
50 66
51 webApkList.appendChild( 67 webApkList.appendChild(
52 createSpanWithTextAndClass(webApkInfo.shortName, 'app-name')); 68 createSpanWithTextAndClass(webApkInfo.name, 'app-name'));
53 69
54 webApkList.appendChild( 70 webApkList.appendChild(
55 createSpanWithTextAndClass('Package name: ', 'app-property-label')); 71 createSpanWithTextAndClass('Short name: ', 'app-property-label'));
56 webApkList.appendChild(document.createTextNode(webApkInfo.packageName)); 72 webApkList.appendChild(document.createTextNode(webApkInfo.shortName));
57 73
58 webApkList.appendChild(document.createElement('br')); 74 addWebApkField(webApkList, 'Package name: ', webApkInfo.packageName);
59 webApkList.appendChild(createSpanWithTextAndClass( 75 addWebApkField(webApkList, 'Shell APK version: ', webApkInfo.shellApkVersion);
60 'Shell APK version: ', 'app-property-label')); 76 addWebApkField(webApkList, 'Version code: ', webApkInfo.versionCode);
61 webApkList.appendChild(document.createTextNode(webApkInfo.shellApkVersion)); 77 addWebApkField(webApkList, 'URI: ', webApkInfo.uri);
62 78 addWebApkField(webApkList, 'Scope: ', webApkInfo.scope);
63 webApkList.appendChild(document.createElement('br')); 79 addWebApkField(webApkList, 'Manifest URL: ', webApkInfo.manifestUrl);
64 webApkList.appendChild( 80 addWebApkField(webApkList, 'Manifest Start URL: ', webApkInfo.manifestStartUrl );
Dan Beam 2017/02/24 18:36:16 80 col wrap
gonzalon 2017/02/24 22:30:52 Done.
65 createSpanWithTextAndClass('Version code: ', 'app-property-label')); 81 addWebApkField(webApkList, 'Display Mode: ', webApkInfo.displayMode);
66 webApkList.appendChild(document.createTextNode(webApkInfo.versionCode)); 82 addWebApkField(webApkList, 'Orientation: ', webApkInfo.orientation);
83 addWebApkField(webApkList, 'Theme color: ', webApkInfo.themeColor);
84 addWebApkField(webApkList, 'Background color: ', webApkInfo.backgroundColor);
67 } 85 }
68 86
69 document.addEventListener('DOMContentLoaded', function() { 87 document.addEventListener('DOMContentLoaded', function() {
70 chrome.send('requestWebApksInfo'); 88 chrome.send('requestWebApksInfo');
71 }); 89 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698