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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstallerBridge.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: Merge branch 'master' into webapk_builder_impl2 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/WebApkInstallerBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstallerBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstallerBridge.java
new file mode 100644
index 0000000000000000000000000000000000000000..396b98522487e99f3ebac79d2ee02c3e459b40a2
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstallerBridge.java
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.webapps;
+
+import android.content.Context;
+
+import org.chromium.base.ContextUtils;
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.chrome.browser.ChromeApplication;
+
+/**
+ * Java counterpart to webapk_installer.h
gone 2016/07/29 21:20:28 It's weird that you have a webapk_installer.h that
pkotwicz 2016/08/02 04:09:37 The Java WebApkInstaller implements the calls to t
gone 2016/08/03 19:03:20 Yeah. Thought you'd already done this for the lat
+ * Contains functionality to install WebAPKs.
+ */
+public class WebApkInstallerBridge {
+ // Prevent instantiation.
+ private WebApkInstallerBridge() {}
+
+ /**
+ * Installs a WebAPK.
+ * @param filePath File to install.
+ * @param packageName Package name to install WebAPK at.
+ * @return True if the install was started. A "true" return value does not guarantee that the
+ * install succeeds.
+ */
+ @CalledByNative
+ static boolean installAsync(String filePath, String packageName) {
+ Context context = ContextUtils.getApplicationContext();
+ WebApkInstaller apkInstaller = ((ChromeApplication) context).createWebApkInstaller();
+ if (apkInstaller == null) {
+ return false;
+ }
+ apkInstaller.installAsync(filePath, packageName);
+ return true;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698