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

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

Issue 2363183002: Skip installation process if WebAPK is already installed. (Closed)
Patch Set: Created 4 years, 3 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/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 2c72f3389e442c83960c5c55ac7764a67831ad8f..cd6c56a2cc5a33029e21f89675d73a07684a8a4e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
@@ -455,16 +455,24 @@ public class ShortcutHelper {
}
/**
- * Returns true if WebAPKs are enabled and there is a WebAPK installed which can handle
- * {@link url}.
+ * Returns the package name of the WebAPK if WebAPKs are enabled and there is an installed
+ * WebAPK which can handle {@link url}. Returns null otherwise.
*/
@CalledByNative
- private static boolean isWebApkInstalled(String url) {
+ private static String queryWebApkPackage(String url) {
if (!ChromeWebApkHost.isEnabled()) {
dominickn 2016/09/28 02:10:25 Style nit: one-line this if statement and remove t
F 2016/09/30 18:02:01 Done.
pkotwicz 2016/10/03 17:17:10 Dominick, is there a place in the Google Java styl
F 2016/10/03 17:31:58 I found this on Google Android Java style guide: h
- return false;
+ return null;
}
- return WebApkValidator.queryWebApkPackage(ContextUtils.getApplicationContext(), url)
- != null;
+ return WebApkValidator.queryWebApkPackage(ContextUtils.getApplicationContext(), url);
+ }
+
+ /**
+ * Returns true if WebAPKs are enabled and there is an installed WebAPK which can handle
+ * {@link url}.
+ */
+ @CalledByNative
+ private static boolean isWebApkInstalled(String url) {
agrieve 2016/09/27 13:45:42 nit: probably better to delete this method now and
F 2016/09/30 18:02:01 Thanks for the suggestion! I'll do it in a follow
+ return queryWebApkPackage(url) != null;
}
/**

Powered by Google App Engine
This is Rietveld 408576698