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

Unified Diff: components/webapks_ui/resources/about_webapks.js

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Adds an about:webapks page with information about all installed Web APKs on the device 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 side-by-side diff with in-line comments
Download patch
Index: components/webapks_ui/resources/about_webapks.js
diff --git a/components/webapks_ui/resources/about_webapks.js b/components/webapks_ui/resources/about_webapks.js
new file mode 100644
index 0000000000000000000000000000000000000000..12eb4193ef84d309af38454ac4f97afd08fedc74
--- /dev/null
+++ b/components/webapks_ui/resources/about_webapks.js
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
hartmanng 2017/01/13 15:40:22 s/(c) 2011/2017/
gonzalon 2017/01/13 20:24:40 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * Creates and returns a text node (with |text| as content) wrapped around a <b>
+ * tag and assigning it the |className| class.
+ */
+function boldedTextNode(text, className) {
pkotwicz 2017/01/13 17:00:59 Can you instead: Call createElementWithClassName()
gonzalon 2017/01/13 20:24:40 Done.
+ var node = document.createElement("B");
+ node.appendChild(document.createTextNode(text));
pkotwicz 2017/01/13 17:00:59 Can you set the text by setting node.textContent ?
gonzalon 2017/01/13 20:24:40 Done.
+ node.className = className;
+ return node;
+}
+
+/**
+ * Callback from the backend with the information of a Web APK to display.
+ * This will be called once for each web APK available on the device and each
pkotwicz 2017/01/13 17:00:59 "web APK" -> WebAPK
gonzalon 2017/01/13 20:24:40 Done.
+ * one will be appended at the end of the other.
+ */
+function returnWebAPKsInfo(appName, packageName, shellApkVersion, versionCode) {
pkotwicz 2017/01/13 17:00:59 Can this function be called just once with the inf
gonzalon 2017/01/13 20:24:40 From what I understood, the history page works a b
+ var webApksList = $('webapks-list');
+
+ webApksList.appendChild(document.createElement("BR"));
+ webApksList.appendChild(document.createElement("BR"));
+ webApksList.appendChild(boldedTextNode(appName, "app-name"));
+
+ webApksList.appendChild(document.createElement("BR"));
+ webApksList.appendChild(boldedTextNode(
+ loadTimeData.getString('packageName'), "app-property-label"));
+ webApksList.appendChild(document.createTextNode(packageName));
+
+ webApksList.appendChild(document.createElement("BR"));
+ webApksList.appendChild(boldedTextNode(
+ loadTimeData.getString('shellApkVersion'), "app-property-label"));
+ webApksList.appendChild(document.createTextNode(shellApkVersion));
+
+ webApksList.appendChild(document.createElement("BR"));
+ webApksList.appendChild(boldedTextNode(
+ loadTimeData.getString('versionCode'), "app-property-label"));
+ webApksList.appendChild(document.createTextNode(versionCode));
+}
+
+/* All the work we do onload. */
+function onLoadWork() {
+ chrome.send('requestWebAPKsInfo');
+}
+
+document.addEventListener('DOMContentLoaded', onLoadWork);

Powered by Google App Engine
This is Rietveld 408576698