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

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

Issue 2264753002: Update WebAPK using downloaded apk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compiling error. 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 adfdbb5ba95f1913e53a4bd2eb0d73d043f7cbd4..18b49873b8798bad6e098096c50031b0f2a0de16 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
@@ -39,6 +39,9 @@ public class WebApkInstaller {
/** Monitors installation progress. */
private InstallerDelegate mInstallTask;
+ /** Indicates whether to install or update a WebAPK. */
+ private boolean mIsInstall;
+
/** Weak pointer to the native WebApkInstaller. */
private long mNativePointer;
@@ -71,12 +74,17 @@ public class WebApkInstaller {
"WebAPK install failed because installation from unknown sources is disabled.");
return false;
}
+ mIsInstall = true;
+ return installDownloadedWebApk(filePath, packageName);
+ }
+
+ private boolean installDownloadedWebApk(String filePath, String packageName) {
mWebApkPackageName = packageName;
// Start monitoring the installation.
PackageManager packageManager = ContextUtils.getApplicationContext().getPackageManager();
mInstallTask = new InstallerDelegate(Looper.getMainLooper(), packageManager,
- createInstallerDelegateObserver(), packageName);
+ createInstallerDelegateObserver(), mWebApkPackageName);
mInstallTask.start();
// Start monitoring the application state changes.
mListener = createApplicationStateListener();
@@ -110,11 +118,12 @@ public class WebApkInstaller {
if (mNativePointer != 0) {
nativeOnInstallFinished(mNativePointer, success);
}
- if (success) {
+ if (success && mIsInstall) {
ShortcutHelper.addWebApkShortcut(ContextUtils.getApplicationContext(),
mWebApkPackageName);
}
}
+
/**
* Updates a WebAPK.
* @param filePath File to update.
@@ -124,9 +133,8 @@ public class WebApkInstaller {
*/
@CalledByNative
private boolean updateAsyncFromNative(String filePath, String packageName) {
- // TODO(hanxi): Calls back to C++ when the updating is complete or return a failure status
- // if fails.
- return false;
+ mIsInstall = false;
+ return installDownloadedWebApk(filePath, packageName);
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698