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

Unified Diff: chrome/browser/android/webapk/webapk_installer.cc

Issue 2733543002: [Android:WebAPK] Don't add webapp to homescreen if WebAPK install times out part 1/3 (Closed)
Patch Set: Merge branch 'refactor_shortcut_helper29' into refactor_shortcut_helper3 Created 3 years, 10 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/browser/android/webapk/webapk_installer.cc
diff --git a/chrome/browser/android/webapk/webapk_installer.cc b/chrome/browser/android/webapk/webapk_installer.cc
index 7df48b20facd97280314ca703e2ea27735ab8632..9eb79081493d5844e5b53632ce9b69de1d91eb7e 100644
--- a/chrome/browser/android/webapk/webapk_installer.cc
+++ b/chrome/browser/android/webapk/webapk_installer.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/android/shortcut_helper.h"
#include "chrome/browser/android/webapk/webapk.pb.h"
#include "chrome/browser/android/webapk/webapk_icon_hasher.h"
+#include "chrome/browser/android/webapk/webapk_install_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "components/version_info/version_info.h"
@@ -273,11 +274,8 @@ void WebApkInstaller::SetTimeoutMs(int timeout_ms) {
void WebApkInstaller::OnInstallFinished(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
- jboolean success) {
- if (success)
- OnSuccess();
- else
- OnFailure();
+ jint result) {
+ OnResult(static_cast<WebApkInstallResult>(result));
}
void WebApkInstaller::BuildWebApkProtoInBackgroundForTesting(
@@ -343,6 +341,10 @@ void WebApkInstaller::InstallOrUpdateWebApkFromGooglePlay(
}
}
+void WebApkInstaller::OnSuccess() {
dominickn 2017/03/05 23:52:40 Can you remove this method and just call OnResult
+ OnResult(WebApkInstallResult::INSTALLED);
+}
+
WebApkInstaller::WebApkInstaller(content::BrowserContext* browser_context,
const ShortcutInfo& shortcut_info,
const SkBitmap& shortcut_icon)
@@ -626,12 +628,11 @@ void WebApkInstaller::OnTimeout() {
OnFailure();
}
-void WebApkInstaller::OnSuccess() {
- finish_callback_.Run(true, webapk_package_);
- delete this;
+void WebApkInstaller::OnFailure() {
dominickn 2017/03/05 23:52:40 Can you remove this method and call OnResult direc
+ OnResult(WebApkInstallResult::INSTALL_FAILED);
}
-void WebApkInstaller::OnFailure() {
- finish_callback_.Run(false, webapk_package_);
+void WebApkInstaller::OnResult(WebApkInstallResult result) {
+ finish_callback_.Run(result, webapk_package_);
delete this;
}

Powered by Google App Engine
This is Rietveld 408576698