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 abstract class WebApkInstaller { |
| 18 /** |
| 19 * Installs a WebAPK. |
| 20 * @param filePath File to install. |
| 21 * @param packageName Package name to install WebAPK at. |
| 22 * @return True if the install was started. A "true" return value does not g
uarantee that the |
| 23 * install succeeds. |
| 24 */ |
| 25 public abstract boolean installAsync(String filePath, String packageName); |
| 26 |
| 27 @CalledByNative |
| 28 static boolean installAsyncFromNative(String filePath, String packageName) { |
| 29 Context context = ContextUtils.getApplicationContext(); |
| 30 WebApkInstaller apkInstaller = ((ChromeApplication) context).createWebAp
kInstaller(); |
| 31 if (apkInstaller == null) { |
| 32 return false; |
| 33 } |
| 34 apkInstaller.installAsync(filePath, packageName); |
| 35 return true; |
| 36 } |
| 37 } |
OLD | NEW |