Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/GooglePlayWebApkInstallDelegate.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/GooglePlayWebApkInstallDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/GooglePlayWebApkInstallDelegate.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f790dd47a9df612ff7427301849a32e61fb05b5a |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/GooglePlayWebApkInstallDelegate.java |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// 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 android.support.annotation.IntDef; |
| + |
| +import org.chromium.base.Callback; |
| + |
| +import java.lang.annotation.Retention; |
| +import java.lang.annotation.RetentionPolicy; |
| + |
| +/** |
| + * Defines an interface for installing WebAPKs via Google Play. |
| + */ |
| +public interface GooglePlayWebApkInstallDelegate { |
|
dominickn
2016/12/08 03:31:26
Can this just be the PlayWebApkInstaller? Or some
Xi Han
2016/12/08 18:03:07
PlayWebApkInstallClientInterface? The delegate is
|
| + /** |
| + * The app state transitions provided by Google Play during download and installation process. |
| + */ |
| + @Retention(RetentionPolicy.SOURCE) |
| + @IntDef({INVALID, DOWNLOAD_PENDING, DOWNLOADING, DOWNLOAD_CANCELLED, DOWNLOAD_ERROR, |
| + INSTALLING, INSTALL_ERROR, INSTALLED}) |
| + public @interface InstallerPackageEvent {} |
| + public static final int INVALID = -1; |
| + public static final int DOWNLOAD_PENDING = 0; |
| + public static final int DOWNLOADING = 1; |
| + public static final int DOWNLOAD_CANCELLED = 2; |
| + public static final int DOWNLOAD_ERROR = 3; |
| + public static final int INSTALLING = 4; |
| + public static final int INSTALL_ERROR = 5; |
| + public static final int INSTALLED = 6; |
| + |
| + /** |
| + * Uses Google Play to install WebAPK asynchronously. |
| + * @param packageName The package name of WebAPK to install. |
| + * @param version The version of WebAPK to install. |
| + * @param title The title of the WebAPK to display during installation. |
| + * @param token The token from WebAPK Minter Server. |
|
dominickn
2016/12/08 03:31:26
Missing an @param for callback
Xi Han
2016/12/08 18:03:07
Done.
|
| + * @return True if the install was started. A "true" value does not guarantee that the install |
| + * succeeds. |
| + */ |
| + boolean installAsync(String packageName, int version, String title, String token, |
| + Callback<Boolean> callback); |
| + |
| + /** |
| + * Calls the callback once the installation either succeeded or failed. |
| + * @param packageName The package name of WebAPK for the installation. |
| + * @param event The result of the install. |
| + */ |
| + void onGotInstallEvent(String packageName, @InstallerPackageEvent int event); |
| +} |