OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.webapps; |
| 6 |
| 7 import android.content.Context; |
| 8 |
| 9 import org.chromium.base.ContextUtils; |
| 10 import org.chromium.base.annotations.CalledByNative; |
| 11 import org.chromium.chrome.browser.ChromeApplication; |
| 12 |
| 13 /** |
| 14 * Java counterpart to webapk_installer.h |
| 15 * Contains functionality to install WebAPKs. |
| 16 */ |
| 17 public class WebApkInstallerBridge { |
| 18 // Prevent instantiation. |
| 19 private WebApkInstallerBridge() {} |
| 20 |
| 21 /** |
| 22 * Installs a WebAPK. |
| 23 * @param filePath File to install. |
| 24 * @param packageName Package name to install WebAPK at. |
| 25 * @return True if the install was started. A "true" return value does not g
uarantee that the |
| 26 * install succeeds. |
| 27 */ |
| 28 @CalledByNative |
| 29 static boolean installAsync(String filePath, String packageName) { |
| 30 Context context = ContextUtils.getApplicationContext(); |
| 31 WebApkInstaller apkInstaller = ((ChromeApplication) context).createWebAp
kInstaller(); |
| 32 if (apkInstaller == null) { |
| 33 return false; |
| 34 } |
| 35 apkInstaller.installAsync(filePath, packageName); |
| 36 return true; |
| 37 } |
| 38 } |
OLD | NEW |