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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java

Issue 2124703003: Do not show "Add to Home Screen" info bar if WebAPK is installed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_app_banner_already_installed 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
« no previous file with comments | « no previous file | chrome/browser/android/banners/app_banner_data_fetcher_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
index eccfd16e4b410642453111e2b3bd04aaf9196db3..d81bf558405f6e68a9719b22714ccb61bb81c257 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
@@ -45,6 +45,7 @@ import org.chromium.chrome.browser.widget.RoundedIconGenerator;
import org.chromium.content_public.common.ScreenOrientationConstants;
import org.chromium.net.GURLUtils;
import org.chromium.ui.widget.Toast;
+import org.chromium.webapk.lib.client.WebApkValidator;
import java.io.ByteArrayOutputStream;
import java.util.List;
@@ -432,6 +433,19 @@ public class ShortcutHelper {
}
/**
+ * Returns true if WebAPKs are enabled and there is a WebAPK installed which can handle
+ * {@link url}.
+ */
+ @CalledByNative
+ public static boolean isWebApkInstalled(String url) {
+ if (!CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_WEBAPK)) {
+ return false;
+ }
+ return WebApkValidator.queryWebApkPackage(ContextUtils.getApplicationContext(), url)
+ != null;
+ }
+
+ /**
* Compresses a bitmap into a PNG and converts into a Base64 encoded string.
* The encoded string can be decoded using {@link decodeBitmapFromString(String)}.
* @param bitmap The Bitmap to compress and encode.
« no previous file with comments | « no previous file | chrome/browser/android/banners/app_banner_data_fetcher_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698