| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkBuilder.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkBuilder.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkBuilder.java
|
| index 41514368cd1a9e02125c9d5e1fc7b4e8451edd58..d16bd593cc847317a90516fac1ead25705cf373b 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkBuilder.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkBuilder.java
|
| @@ -4,31 +4,33 @@
|
|
|
| package org.chromium.chrome.browser.webapps;
|
|
|
| -import android.graphics.Bitmap;
|
| +import android.content.Context;
|
| +
|
| +import org.chromium.base.ContextUtils;
|
| +import org.chromium.base.annotations.CalledByNative;
|
| +import org.chromium.chrome.browser.ChromeApplication;
|
|
|
| /**
|
| - * Interface for building WebAPKs.
|
| + * Java counterpart to webapk_builder.h Contains functionality to download and install WebAPKs.
|
| */
|
| -public interface WebApkBuilder {
|
| +public class WebApkBuilder {
|
| + // Prevent instantiation.
|
| + private WebApkBuilder() {}
|
| +
|
| /**
|
| - * Asynchronously build WebAPK.
|
| - * @param startUrl The url that the WebAPK should navigate to when launched from the app
|
| - * list.
|
| - * @param scope Navigations from the WebAPK to URLs with sub-origin {@link scope} will
|
| - * stay within the WebAPK.
|
| - * @param name "name" from the Web Manifest.
|
| - * @param shortName "short_name" from the Web Manifest.
|
| - * @param iconUrl Url of the icon for the app list. Url of the favicon if the Web
|
| - * Manifest does not specify an icon.
|
| - * @param icon Icon for the app list. Generated icon or favicon if the Web Manifest
|
| - * does not specify an icon.
|
| - * @param displayMode "display" from the Web Manifest.
|
| - * @param orientation "orientation" from the Web Manifest.
|
| - * @param themeColor "theme_color" from the Web Manifest.
|
| - * @param backgroundColor "background_color" from the Web Manifest.
|
| - * @param manifestUrl The URL of the Web Manifest.
|
| + * Downloads and installs a WebAPK.
|
| + * @param signedMarketUrl Url to provide to Google Play.
|
| + * @return True if the download was started. A "true" return value does not guarantee that the
|
| + * download succeeds.
|
| */
|
| - void buildWebApkAsync(String startUrl, String scope, String name, String shortName,
|
| - String iconUrl, Bitmap icon, int displayMode, int orientation, long themeColor,
|
| - long backgroundColor, String manifestUrl);
|
| + @CalledByNative
|
| + static boolean downloadAndInstallAsync(String signedMarketUrl) {
|
| + Context context = ContextUtils.getApplicationContext();
|
| + WebApkInstaller apkInstaller = ((ChromeApplication) context).createWebApkInstaller();
|
| + if (apkInstaller == null) {
|
| + return false;
|
| + }
|
| + apkInstaller.downloadAndInstallAsync(signedMarketUrl);
|
| + return true;
|
| + }
|
| }
|
|
|