X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fviews%2FNestedScrollWebView.kt;h=4011f5a5aba4fe689a628fbd8523afa306e634f6;hb=e2d4437956f57b50bda1f27c9b4eea9367de7758;hp=1eefe7378006ea496de2bdba521b0da9b26dc303;hpb=8142ac5fc2489de735de4b6fa21a1eae733ccfce;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt index 1eefe737..4011f5a5 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt @@ -27,9 +27,9 @@ import android.graphics.drawable.BitmapDrawable import android.os.Bundle import android.util.AttributeSet import android.view.MotionEvent -import android.webkit.WebView -import android.webkit.SslErrorHandler import android.webkit.HttpAuthHandler +import android.webkit.SslErrorHandler +import android.webkit.WebView import androidx.core.content.ContextCompat import androidx.core.view.NestedScrollingChild2 @@ -137,6 +137,7 @@ class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeS private var ultraListBlockedRequests = 0 private var ultraPrivacyBlockedRequests = 0 private var thirdPartyBlockedRequests = 0 + private var xRequestedWithHeader = mutableMapOf() init { // Enable nested scrolling by default. @@ -208,22 +209,15 @@ class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeS hasPinnedSslCertificate = true } - fun getPinnedSslCertificate(): ArrayList { - // Initialize an array list. - val arrayList = ArrayList() - + fun getPinnedSslCertificate(): Pair, Array> { // Create the SSL certificate string array. val sslCertificateStringArray = arrayOf(pinnedSslIssuedToCName, pinnedSslIssuedToOName, pinnedSslIssuedToUName, pinnedSslIssuedByCName, pinnedSslIssuedByOName, pinnedSslIssuedByUName) // Create the SSL certificate date array. val sslCertificateDateArray = arrayOf(pinnedSslStartDate, pinnedSslEndDate) - // Add the arrays to the array list. - arrayList.add(sslCertificateStringArray) - arrayList.add(sslCertificateDateArray) - - // Return the pinned SSL certificate array list. - return arrayList + // Return the pinned SSL certificate pair. + return Pair(sslCertificateStringArray, sslCertificateDateArray) } fun clearPinnedSslCertificate() { @@ -302,6 +296,24 @@ class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeS } + // X-Requested-With header. + fun getXRequestedWithHeader() : MutableMap { + // Return the X-Requested-With header. + return xRequestedWithHeader + } + + fun setXRequestedWithHeader() { + // Set the X-Requested-With header to use a null value. + if (xRequestedWithHeader.isEmpty()) + xRequestedWithHeader["X-Requested-With"] = "" + } + + fun resetXRequestedWithHeader() { + // Clear the map, which resets the X-Requested-With header to use the default value of the application ID (com.stoutner.privacybrowser.standard). + xRequestedWithHeader.clear() + } + + // Publicly expose the scroll ranges. fun getHorizontalScrollRange(): Int { // Return the horizontal scroll range.