| 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..95dc6b305a476972e43c52a6af8fa1967f436465 100644
|
| --- a/android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java
|
| +++ b/android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java
|
| @@ -41,10 +41,24 @@ public class AwSafeBrowsingConfigHelper {
|
| }
|
| }
|
|
|
| + /**
|
| + * If the app has set its opt-in/opt-out preference for SafeBrowsing, this fetches it.
|
| + * Otherwise, this returns the default value, depending on the version of Android we're running
|
| + * on (On by default for O+, off by default otherwise).
|
| + */
|
| + private static boolean getEffectiveSafeBrowsingOptInChoice(Context appContext) {
|
| + if (BuildInfo.isAtLeastO()) {
|
| + boolean hasOptedOut = appHasMetadataKeyValue(appContext, OPT_IN_META_DATA_STR, false);
|
| + return !hasOptedOut;
|
| + } else {
|
| + boolean hasOptedIn = appHasMetadataKeyValue(appContext, OPT_IN_META_DATA_STR, true);
|
| + return hasOptedIn;
|
| + }
|
| + }
|
| +
|
| 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));
|
| + || getEffectiveSafeBrowsingOptInChoice(appContext);
|
| }
|
|
|
| private static boolean appHasMetadataKeyValue(Context appContext, String key, boolean value) {
|
|
|