]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java
Track URL loading by tab.
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / views / NestedScrollWebView.java
index c7e5ade3dee5a2a45dfe5b970bac98c6c10e9a70..b6708a40a2558e72a71c4cc6e8dff94f34370b82 100644 (file)
@@ -24,6 +24,7 @@ import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.webkit.WebView;
 
+import androidx.annotation.NonNull;
 import androidx.core.view.NestedScrollingChild2;
 import androidx.core.view.NestedScrollingChildHelper;
 import androidx.core.view.ViewCompat;
@@ -49,6 +50,9 @@ public class NestedScrollWebView extends WebView implements NestedScrollingChild
     private boolean domainSettingsApplied;
     private int domainSettingsDatabaseId;
 
+    // Keep track of when the domain name changes so that domain settings can be reapplied.  This should never be null.
+    private String currentDomainName = "";
+
     // Track the resource requests.
     private ArrayList<String[]> resourceRequests = new ArrayList<>();
     private int blockedRequests;
@@ -151,6 +155,23 @@ public class NestedScrollWebView extends WebView implements NestedScrollingChild
     }
 
 
+    // Current domain name.  To function well when called, the domain name should never be allowed to be null.
+    public void setCurrentDomainName(@NonNull String domainName) {
+        // Store the current domain name.
+        currentDomainName = domainName;
+    }
+
+    public void resetCurrentDomainName() {
+        // Reset the current domain name.
+        currentDomainName = "";
+    }
+
+    public String getCurrentDomainName() {
+        // Return the current domain name.
+        return currentDomainName;
+    }
+
+
     // Resource requests.
     public void addResourceRequest(String[] resourceRequest) {
         // Add the resource request to the list.