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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebapkInfoCallback.java

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: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebapkInfoCallback.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebapkInfoCallback.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebapkInfoCallback.java
new file mode 100644
index 0000000000000000000000000000000000000000..2288622cd627c9372b7542b714d069f89dc4b821
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebapkInfoCallback.java
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
hartmanng 2017/01/13 15:40:21 Update the year - it's 2017 now :)
gonzalon 2017/01/13 20:24:38 I copy pasted this everywhere without checking the
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.webapps;
+
+import org.chromium.base.annotations.CalledByNative;
+
+/** A simple callback to load the information on web APKs. */
+public class WebapkInfoCallback {
Xi Han 2017/01/13 15:50:15 Anyone has suggestion about the naming of this cla
+ private long mNativeWebapkInfoCallback;
+
+ /**
+ * Called with information of one Web APK. When information is requested, it will be called once
hartmanng 2017/01/13 15:40:21 nit: for consistency, we generally spell it "WebAP
gonzalon 2017/01/13 20:24:38 Done.
+ * for each Web APK installed on the device.
+ *
+ * @param name The name of the Web APK.
+ * @param packageName The package name of the Web APK.
+ * @param shellApkVersion The version of the shell APK of the Web APK.
+ * @param versionCode The version code associated with the Web APK.
+ */
+ public void onWebApkFound(
+ String name, String packageName, int shellApkVersion, int versionCode) {
+ nativeOnWebApkFound(
+ mNativeWebapkInfoCallback, name, packageName, shellApkVersion, versionCode);
+ }
+
+ /** Destroys the native counterpart of this object. */
+ public void destroy() {
pkotwicz 2017/01/13 17:00:58 I must be missing something. Who calls destroy()?
gonzalon 2017/01/13 20:24:38 I forgot to add the call, I added it on the listWe
+ nativeDestroy(mNativeWebapkInfoCallback);
+ mNativeWebapkInfoCallback = 0;
+ }
+
+ /**
+ * Called from C++ by |nativeWebApkInfoCallback| to instantiate this class. Note that this is
+ * the only way to construct an WebapkInfoCallback; the constructor is private.
+ * @param nativeWebApkInfoCallback The native counterpart that creates and owns this object.
+ */
+ @CalledByNative
+ private static WebapkInfoCallback create(long nativeWebApkInfoCallback) {
+ return new WebapkInfoCallback(nativeWebApkInfoCallback);
+ }
+
+ private WebapkInfoCallback(long nativeWebapkInfoCallback) {
+ mNativeWebapkInfoCallback = nativeWebapkInfoCallback;
+ }
+
+ private native void nativeOnWebApkFound(long nativeWebapkInfoCallback, String name,
+ String packageName, int shellApkVersion, int versionCode);
+ private native void nativeDestroy(long nativeWebapkInfoCallback);
+}

Powered by Google App Engine
This is Rietveld 408576698