]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/interceptors/UrlRequestInterceptor.cpp
Add a background tab action to the context menu. https://redmine.stoutner.com/issues/949
[PrivacyBrowserPC.git] / src / interceptors / UrlRequestInterceptor.cpp
index 634889867ad386464e5472b1d01c5ff1ccca6075..83f104595ac8ab67e904d04b48b769b3c05556f8 100644 (file)
@@ -31,34 +31,6 @@ UrlRequestInterceptor::UrlRequestInterceptor(QObject *parentObjectPointer) : QWe
 
 void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &urlRequestInfo)
 {
-    // Handle the request according to the navigation type.
-    switch (urlRequestInfo.navigationType())
-    {
-        case QWebEngineUrlRequestInfo::NavigationTypeLink:
-        case QWebEngineUrlRequestInfo::NavigationTypeTyped:
-        case QWebEngineUrlRequestInfo::NavigationTypeBackForward:
-        case QWebEngineUrlRequestInfo::NavigationTypeRedirect:
-        {
-            // Only check the hosts if the main URL is changing.
-            if (urlRequestInfo.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame)
-            {
-                // Get the hosts.
-                QString requestingHost = urlRequestInfo.initiator().host();
-                QString requestedHost = urlRequestInfo.requestUrl().host();
-
-                // Reapply the domain settings if the host is changing.
-                if (requestingHost != requestedHost)
-                    emit applyDomainSettings(requestedHost);
-            }
-
-            break;
-        }
-
-        default:
-            // Do nothing.
-            break;
-    }
-
     // Handle the request according to the resource type.
     switch (urlRequestInfo.resourceType())
     {
@@ -96,4 +68,33 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &urlReques
             break;
         }
     }
+
+    // Handle the request according to the navigation type.
+    switch (urlRequestInfo.navigationType())
+    {
+        case QWebEngineUrlRequestInfo::NavigationTypeLink:
+        case QWebEngineUrlRequestInfo::NavigationTypeTyped:
+        case QWebEngineUrlRequestInfo::NavigationTypeBackForward:
+        // case QWebEngineUrlRequestInfo::NavigationTypeReload:  This can be uncommented once https://redmine.stoutner.com/issues/821 has been fixed.
+        case QWebEngineUrlRequestInfo::NavigationTypeRedirect:
+        {
+            // Only check the hosts if the main URL is changing.
+            if (urlRequestInfo.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame)
+            {
+                // Get the hosts.
+                QString requestingHost = urlRequestInfo.initiator().host();
+                QString requestedHost = urlRequestInfo.requestUrl().host();
+
+                // Reapply the domain settings if the host is changing.
+                if (requestingHost != requestedHost)
+                    emit applyDomainSettings(requestedHost);
+            }
+
+            break;
+        }
+
+        default:
+            // Do nothing.
+            break;
+    }
 }