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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfoCallback.java

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Adds comment to explain the reason of an empty param 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.webapps;
6
7 import org.chromium.base.annotations.CalledByNative;
8 import org.chromium.chrome.browser.ShortcutHelper;
9
10 /** A simple callback to load the information on WebAPKs. */
11 public class WebApkInfoCallback {
12 private long mNativeWebApkInfoCallback;
13
14 /**
15 * Fetches the information of all WebAPKs installed on the device and return s them to the
16 * caller using a callback.
17 *
18 * @param webApkInfoCallback Callback to be called with each WebAPK found on the device.
19 */
20 @CalledByNative
21 private static void listWebApks(WebApkInfoCallback webApkInfoCallback) {
22 ShortcutHelper.listWebApks(webApkInfoCallback);
23 }
24
25 /**
26 * Called with information of one WebAPK. When information is requested, it will be called once
27 * for each WebAPK installed on the device.
28 *
29 * @param name The name of the WebAPK.
30 * @param packageName The package name of the WebAPK.
31 * @param shellApkVersion The version of the shell APK of the WebAPK.
32 * @param versionCode The version code associated with the WebAPK.
33 */
34 public void onWebApkFound(
35 String name, String packageName, int shellApkVersion, int versionCod e) {
36 nativeOnWebApkFound(
37 mNativeWebApkInfoCallback, name, packageName, shellApkVersion, v ersionCode);
38 }
39
40 /** Destroys the native counterpart of this object. */
41 public void destroy() {
42 nativeDestroy(mNativeWebApkInfoCallback);
43 mNativeWebApkInfoCallback = 0;
44 }
45
46 /**
47 * Called from C++ by |nativeWebApkInfoCallback| to instantiate this class. Note that this is
48 * the only way to construct an WebApkInfoCallback; the constructor is priva te.
49 * @param nativeWebApkInfoCallback The native counterpart that creates and o wns this object.
50 */
51 @CalledByNative
52 private static WebApkInfoCallback create(long nativeWebApkInfoCallback) {
53 return new WebApkInfoCallback(nativeWebApkInfoCallback);
54 }
55
56 private WebApkInfoCallback(long nativeWebApkInfoCallback) {
57 mNativeWebApkInfoCallback = nativeWebApkInfoCallback;
58 }
59
60 private native void nativeOnWebApkFound(long nativeWebApkInfoCallback, Strin g name,
61 String packageName, int shellApkVersion, int versionCode);
62 private native void nativeDestroy(long nativeWebApkInfoCallback);
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698