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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java

Issue 2739003002: Change WebView's Safe Browsing opt-in requirements (Closed)
Patch Set: Removing targetSdk logic Created 3 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java b/android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java
index 8aa544f5e7aa8f37c2fe02f5f7a74adcfd2f0927..c6b6a144e230b54ae2c8e2899eaa426ec0d2b403 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java
@@ -12,7 +12,6 @@ import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.provider.Settings;
-import org.chromium.base.BuildInfo;
import org.chromium.base.CommandLine;
import org.chromium.base.Log;
import org.chromium.base.annotations.JNINamespace;
@@ -43,11 +42,10 @@ public class AwSafeBrowsingConfigHelper {
private static boolean shouldEnableSafeBrowsingSupport(Context appContext) {
return CommandLine.getInstance().hasSwitch(AwSwitches.WEBVIEW_ENABLE_SAFEBROWSING_SUPPORT)
- || (BuildInfo.isAtLeastO()
- && !appHasMetadataKeyValue(appContext, OPT_IN_META_DATA_STR, false));
+ || appHasOptedIn(appContext);
}
- private static boolean appHasMetadataKeyValue(Context appContext, String key, boolean value) {
+ private static boolean appHasOptedIn(Context appContext) {
try {
ApplicationInfo info = appContext.getPackageManager().getApplicationInfo(
appContext.getPackageName(), PackageManager.GET_META_DATA);
@@ -55,7 +53,9 @@ public class AwSafeBrowsingConfigHelper {
// null means no such tag was found.
return false;
}
- return info.metaData.containsKey(key) ? info.metaData.getBoolean(key) == value : false;
+ return info.metaData.containsKey(OPT_IN_META_DATA_STR)
+ ? info.metaData.getBoolean(OPT_IN_META_DATA_STR)
+ : false;
} catch (PackageManager.NameNotFoundException e) {
// This should never happen.
Log.e(TAG, "App could not find itself by package name!");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698