OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 android.support.annotation.IntDef; |
| 8 |
| 9 import org.chromium.base.Callback; |
| 10 |
| 11 import java.lang.annotation.Retention; |
| 12 import java.lang.annotation.RetentionPolicy; |
| 13 |
| 14 /** |
| 15 * Defines an interface for installing WebAPKs via Google Play. |
| 16 */ |
| 17 public interface GooglePlayWebApkInstallDelegate { |
| 18 /** |
| 19 * The app state transitions provided by Google Play during download and ins
tallation process. |
| 20 */ |
| 21 @Retention(RetentionPolicy.SOURCE) |
| 22 @IntDef({INVALID, DOWNLOAD_PENDING, DOWNLOADING, DOWNLOAD_CANCELLED, DOWNLOA
D_ERROR, |
| 23 INSTALLING, INSTALL_ERROR, INSTALLED}) |
| 24 public @interface InstallerPackageEvent {} |
| 25 public static final int INVALID = -1; |
| 26 public static final int DOWNLOAD_PENDING = 0; |
| 27 public static final int DOWNLOADING = 1; |
| 28 public static final int DOWNLOAD_CANCELLED = 2; |
| 29 public static final int DOWNLOAD_ERROR = 3; |
| 30 public static final int INSTALLING = 4; |
| 31 public static final int INSTALL_ERROR = 5; |
| 32 public static final int INSTALLED = 6; |
| 33 |
| 34 /** |
| 35 * Uses Google Play to install WebAPK asynchronously. |
| 36 * @param packageName The package name of WebAPK to install. |
| 37 * @param version The version of WebAPK to install. |
| 38 * @param title The title of the WebAPK to display during installation. |
| 39 * @param token The token from WebAPK Minter Server. |
| 40 * @param url The start URL of the WebAPK to install. |
| 41 * @param callback The callback to invoke when the install is either complet
ed or failed. |
| 42 * @return True if the install was started. A "true" value does not guarante
e that the install |
| 43 * succeeds. |
| 44 */ |
| 45 boolean installAsync(String packageName, int version, String title, String t
oken, |
| 46 String url, Callback<Boolean> callback); |
| 47 |
| 48 /** |
| 49 * Calls the callback once the installation either succeeded or failed. |
| 50 * @param packageName The package name of WebAPK for the installation. |
| 51 * @param event The result of the install. |
| 52 */ |
| 53 void onGotInstallEvent(String packageName, @InstallerPackageEvent int event)
; |
| 54 } |
OLD | NEW |