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

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

Issue 2515293004: Chrome talks to Play to install WebAPKs. (Closed)
Patch Set: Add finch flag and don't use InstallerDelegate to monitor Play install. Created 4 years, 1 month 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 | « chrome/browser/android/webapk/webapk_installer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bb9e030916de819706c9df62fcac2f8e18429aad..6e11cc1ec9e31d23566c864094dd5735e3927e10 100644
--- a/chrome/browser/android/webapk/webapk_installer.cc
+++ b/chrome/browser/android/webapk/webapk_installer.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/android/webapk/webapk_installer.h"
+#include <stdlib.h>
+
#include "base/android/build_info.h"
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
@@ -22,6 +24,7 @@
#include "chrome/browser/android/webapk/webapk.pb.h"
#include "chrome/browser/android/webapk/webapk_icon_hasher.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_switches.h"
#include "components/variations/variations_associated_data.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
@@ -341,6 +344,14 @@ void WebApkInstaller::OnURLFetchComplete(const net::URLFetcher* source) {
OnFailure();
return;
}
+
+ if (base::FeatureList::IsEnabled(chrome::android::kPlayInstallWebApks)){
+ InstallWebApkFromPlayStore(response->package_name(),
+ std::atoi(response->version().c_str()),
+ response->token());
pkotwicz 2016/11/24 22:59:20 Ideally, Google Play installs will work when: - Go
+ return;
+ }
+
OnGotWebApkDownloadUrl(signed_download_url, response->package_name());
}
@@ -412,6 +423,22 @@ void WebApkInstaller::SendRequest(std::unique_ptr<webapk::WebApk> request_proto,
url_fetcher_->Start();
}
+void WebApkInstaller::InstallWebApkFromPlayStore(
+ const std::string& package_name, int version, const std::string& token) {
+ webapk_package_ = package_name;
+
+ JNIEnv* env = base::android::AttachCurrentThread();
+ base::android::ScopedJavaLocalRef<jstring> java_webapk_package =
+ base::android::ConvertUTF8ToJavaString(env, webapk_package_);
+ base::android::ScopedJavaLocalRef<jstring> java_title =
+ base::android::ConvertUTF16ToJavaString(env, shortcut_info_.user_title);
+ base::android::ScopedJavaLocalRef<jstring> java_token =
+ base::android::ConvertUTF8ToJavaString(env, token);
+
+ Java_WebApkInstaller_installWebApkFromPlayStoreAsyncAndMonitorInstallation(
+ env, java_ref_, java_webapk_package, version, java_title, java_token);
+}
+
void WebApkInstaller::OnGotWebApkDownloadUrl(const GURL& download_url,
const std::string& package_name) {
webapk_package_ = package_name;
« no previous file with comments | « chrome/browser/android/webapk/webapk_installer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698