Chromium Code Reviews| Index: chrome/browser/resources/webapks/about_webapks.js |
| diff --git a/chrome/browser/resources/webapks/about_webapks.js b/chrome/browser/resources/webapks/about_webapks.js |
| index ae929d6ed4c1a2b5e4d0cf3ad78bc26693bde1e3..d9f208dd621822ae446dcef5e6bedb13f621711c 100644 |
| --- a/chrome/browser/resources/webapks/about_webapks.js |
| +++ b/chrome/browser/resources/webapks/about_webapks.js |
| @@ -4,10 +4,19 @@ |
| /** |
| * @typedef {{ |
| + * name: string, |
| * shortName: string, |
| * packageName: string, |
| * shellApkVersion: number, |
| * versionCode: number |
| + * uri: string, |
| + * scope: string, |
| + * manifestUrl: string, |
| + * manifestStartUrl: string, |
| + * displayMode: string, |
| + * orientation: string, |
| + * themeColor: string, |
| + * backgroundColor: string, |
| * }} |
| */ |
| var WebApkInfo; |
| @@ -20,8 +29,8 @@ var WebApkInfo; |
| * @param {string} className Class to be assigned to the new element. |
| * @return {Element} The created element. |
| */ |
| -function createSpanWithTextAndClass(text, className) { |
| - var element = createElementWithClassName('span', className); |
| +function createElementWithTextAndClass(text, type, className) { |
| + var element = createElementWithClassName(type, className); |
| element.textContent = text; |
| return element; |
| } |
| @@ -41,6 +50,20 @@ function returnWebApksInfo(webApkList) { |
| } |
| /** |
| + * @param {!Array<Element>} webApkList List of elements which contain WebAPK |
| + * attributes. |
| + * @param {string} label Text that identifies the new element. |
| + * @param {string} value Text to set in the new element. |
| + */ |
| +function addWebApkField(webApkList, label, value) { |
| + divElement = createElementWithTextAndClass( |
| + label, 'div', 'app-property-label'); |
|
Dan Beam
2017/02/28 17:40:52
this indent is slightly off, maybe run `git cl for
gonzalon
2017/02/28 17:56:50
I didn't know the '--js' option existed, I was won
|
| + divElement.appendChild( |
| + createElementWithTextAndClass(value, 'span', 'app-property-value')); |
| + webApkList.appendChild(divElement); |
| +} |
| + |
| +/** |
| * Adds a new entry to the page with the information of a WebAPK. |
| * |
| * @param {WebApkInfo} webApkInfo Information about an installed WebAPK. |
| @@ -49,21 +72,24 @@ function addWebApk(webApkInfo) { |
| var webApkList = $('webapk-list'); |
| webApkList.appendChild( |
| - createSpanWithTextAndClass(webApkInfo.shortName, 'app-name')); |
| + createElementWithTextAndClass(webApkInfo.name, 'span', 'app-name')); |
| - webApkList.appendChild( |
| - createSpanWithTextAndClass('Package name: ', 'app-property-label')); |
| - webApkList.appendChild(document.createTextNode(webApkInfo.packageName)); |
| - |
| - webApkList.appendChild(document.createElement('br')); |
| - webApkList.appendChild(createSpanWithTextAndClass( |
| - 'Shell APK version: ', 'app-property-label')); |
| - webApkList.appendChild(document.createTextNode(webApkInfo.shellApkVersion)); |
| + webApkList.appendChild(createElementWithTextAndClass( |
| + 'Short name: ', 'span', 'app-property-label')); |
| + webApkList.appendChild(document.createTextNode(webApkInfo.shortName)); |
| - webApkList.appendChild(document.createElement('br')); |
| - webApkList.appendChild( |
| - createSpanWithTextAndClass('Version code: ', 'app-property-label')); |
| - webApkList.appendChild(document.createTextNode(webApkInfo.versionCode)); |
| + addWebApkField(webApkList, 'Package name: ', webApkInfo.packageName); |
| + addWebApkField(webApkList, 'Shell APK version: ', webApkInfo.shellApkVersion); |
| + addWebApkField(webApkList, 'Version code: ', webApkInfo.versionCode); |
| + addWebApkField(webApkList, 'URI: ', webApkInfo.uri); |
| + addWebApkField(webApkList, 'Scope: ', webApkInfo.scope); |
| + addWebApkField(webApkList, 'Manifest URL: ', webApkInfo.manifestUrl); |
| + addWebApkField(webApkList, |
| + 'Manifest Start URL: ', webApkInfo.manifestStartUrl); |
| + addWebApkField(webApkList, 'Display Mode: ', webApkInfo.displayMode); |
| + addWebApkField(webApkList, 'Orientation: ', webApkInfo.orientation); |
| + addWebApkField(webApkList, 'Theme color: ', webApkInfo.themeColor); |
| + addWebApkField(webApkList, 'Background color: ', webApkInfo.backgroundColor); |
| } |
| document.addEventListener('DOMContentLoaded', function() { |