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); |
+} |