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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkBuilder.java

Issue 2138973002: Initial CL for talking to the WebAPK server to generate WebAPK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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..86e44bc0359c588aa5f2dae0bf10e167b2cec59a 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,30 @@
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.
Yaron 2016/07/13 00:24:00 missing "." (or newline)
pkotwicz 2016/07/13 02:15:30 I do not understand. The comment has a "." at the
Yaron 2016/07/19 17:31:13 The capitalized "C" is threw me off. Seems like th
pkotwicz 2016/07/20 05:13:41 Ok, I added a new line
*/
-public interface WebApkBuilder {
+public class WebApkBuilder {
Yaron 2016/07/13 00:24:00 add a private constructor since this is just a uti
pkotwicz 2016/07/13 02:15:30 Done.
/**
- * 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;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698