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

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

Issue 2184913005: Add calls to the server to request WebAPK updates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and pkotwicz@'s comments. Created 4 years, 4 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/WebApkInstaller.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
index 86aa4f5ad46bfb55e4e1b59918aa0a6f5b735d88..43ef016e3f2d3347174e31e3f502a295f8939299 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
@@ -12,7 +12,7 @@ import org.chromium.chrome.browser.ChromeApplication;
/**
* Java counterpart to webapk_installer.h
- * Contains functionality to install WebAPKs.
+ * Contains functionality to install / update WebAPKs.
*/
public abstract class WebApkInstaller {
/**
@@ -24,14 +24,37 @@ public abstract class WebApkInstaller {
*/
public abstract boolean installAsync(String filePath, String packageName);
+ /**
+ * Updates a WebAPK.
+ * @param filePath File to update.
+ * @param packageName Package name to update WebAPK at.
+ * @return True if the update was started. A "true" return value does not guarantee that the
+ * update succeeds.
+ */
+ public abstract boolean updateAsync(String filePath, String packageName);
+
@CalledByNative
- static boolean installAsyncFromNative(String filePath, String packageName) {
- Context context = ContextUtils.getApplicationContext();
- WebApkInstaller apkInstaller = ((ChromeApplication) context).createWebApkInstaller();
+ private static boolean installAsyncFromNative(String filePath, String packageName) {
+ WebApkInstaller apkInstaller = createWebApkInstaller();
if (apkInstaller == null) {
return false;
}
apkInstaller.installAsync(filePath, packageName);
return true;
}
+
+ @CalledByNative
+ private static boolean updateAsyncFromNative(String filePath, String packageName) {
+ WebApkInstaller apkInstaller = createWebApkInstaller();
+ if (apkInstaller == null) {
+ return false;
+ }
+ apkInstaller.updateAsync(filePath, packageName);
+ return true;
+ }
+
+ private static WebApkInstaller createWebApkInstaller() {
+ Context context = ContextUtils.getApplicationContext();
+ return ((ChromeApplication) context).createWebApkInstaller();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698