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

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

Issue 2791983003: Remove untrusted sources installation flow. (Closed)
Patch Set: Remove untrusted sources installation flow. Created 3 years, 8 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/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java » ('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/webapps/ChromeWebApkHost.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java
index 3ca4a81dc52613c0a44094481c4d388412375046..86ff686797bec2bcf119e30a2d63749e0d8274a0 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java
@@ -4,9 +4,7 @@
package org.chromium.chrome.browser.webapps;
-import android.content.Context;
import android.os.StrictMode;
-import android.provider.Settings;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
@@ -37,6 +35,8 @@ public class ChromeWebApkHost {
public static void initForTesting(boolean enabled) {
sEnabledForTesting = enabled;
+ sGooglePlayInstallState = enabled ? GooglePlayInstallState.SUPPORTED
+ : GooglePlayInstallState.NO_PLAY_SERVICES;
}
public static boolean isEnabled() {
@@ -47,13 +47,7 @@ public class ChromeWebApkHost {
// Returns whether updating the WebAPK is enabled.
public static boolean areUpdatesEnabled() {
- if (!isEnabled()) return false;
-
- // Updating a WebAPK without going through Google Play requires "installation from unknown
- // sources" to be enabled. It is confusing for a user to see a dialog asking them to enable
- // "installation from unknown sources" when they are in the middle of using the WebAPK (as
- // opposed to after requesting to add a WebAPK to the homescreen).
- return installingFromUnknownSourcesAllowed() || canUseGooglePlayToInstallWebApk();
+ return canInstallWebApk();
}
/** Computes the GooglePlayInstallState. */
@@ -73,23 +67,10 @@ public class ChromeWebApkHost {
return GooglePlayInstallState.SUPPORTED;
}
- /**
- * Returns whether installing WebAPKs from Google Play is possible.
- * If {@link sCanUseGooglePlayInstall} hasn't been set yet, it returns false immediately and
- * calls the Google Play Install API to update {@link sCanUseGooglePlayInstall} asynchronously.
- */
- private static boolean canUseGooglePlayToInstallWebApk() {
- return getGooglePlayInstallState() == GooglePlayInstallState.SUPPORTED;
- }
-
- /**
- * Returns whether installing WebAPKs is possible either from "unknown resources" or Google
- * Play.
- */
+ /** Returns whether installing WebAPKs is possible. */
@CalledByNative
private static boolean canInstallWebApk() {
- return isEnabled()
- && (canUseGooglePlayToInstallWebApk() || nativeCanInstallFromUnknownSources());
+ return isEnabled() && getGooglePlayInstallState() == GooglePlayInstallState.SUPPORTED;
}
@CalledByNative
@@ -136,21 +117,5 @@ public class ChromeWebApkHost {
}
}
- /**
- * Returns whether the user has enabled installing apps from sources other than the Google Play
- * Store.
- */
- private static boolean installingFromUnknownSourcesAllowed() {
- Context applicationContext = ContextUtils.getApplicationContext();
- try {
- return Settings.Secure.getInt(applicationContext.getContentResolver(),
- Settings.Secure.INSTALL_NON_MARKET_APPS)
- == 1;
- } catch (Settings.SettingNotFoundException e) {
- return false;
- }
- }
-
private static native boolean nativeCanLaunchRendererInWebApkProcess();
- private static native boolean nativeCanInstallFromUnknownSources();
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698