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

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

Issue 2814593002: WebView: add {set,get}SafeBrowsingEnabled per WebView (Closed)
Patch Set: Add comment about getSafeBrowsingEnabled() 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
Index: android_webview/java/src/org/chromium/android_webview/AwSettings.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
index 392faac4fe8bfba67159e53fd57980b529a85ded..94cbd29bd0cf05a7faf1a0f49542a4fbfcd6c793 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
@@ -92,6 +92,9 @@ public class AwSettings {
// Although this bit is stored on AwSettings it is actually controlled via the CookieManager.
private boolean mAcceptThirdPartyCookies;
+ // if null, default to AwContentsStatics.getSafeBrowsingEnabled()
+ private Boolean mSafeBrowsingEnabled;
+
private final boolean mSupportLegacyQuirks;
private final boolean mAllowEmptyDocumentPersistence;
private final boolean mAllowGeolocationOnInsecureOrigins;
@@ -331,6 +334,16 @@ public class AwSettings {
}
/**
+ * Enable/Disable SafeBrowsing per WebView
+ * @param enabled true if this WebView should have SafeBrowsing
+ */
+ public void setSafeBrowsingEnabled(boolean enabled) {
+ synchronized (mAwSettingsLock) {
+ mSafeBrowsingEnabled = enabled;
+ }
+ }
+
+ /**
* Return whether third party cookies are enabled for an AwContents
* @return true if accept third party cookies
*/
@@ -341,6 +354,19 @@ public class AwSettings {
}
/**
+ * Return whether Safe Browsing has been enabled for the current WebView
+ * @return true if SafeBrowsing is enabled
+ */
+ public boolean getSafeBrowsingEnabled() {
+ synchronized (mAwSettingsLock) {
+ if (mSafeBrowsingEnabled == null) {
+ return AwContentsStatics.getSafeBrowsingEnabled();
+ }
+ return mSafeBrowsingEnabled;
+ }
+ }
+
+ /**
* See {@link android.webkit.WebSettings#setAllowFileAccess}.
*/
public void setAllowFileAccess(boolean allow) {

Powered by Google App Engine
This is Rietveld 408576698