public IWebURLRequest willSendRequest(WebView WebView, uint identifier, IWebURLRequest request, IWebURLResponse redirectResponse, IWebDataSource dataSource)
        {
            string ret = ResourceRequestSent(request.url());

            if (Owner.Preferences.IgnoreSSLErrors)
            {
                request.mutableCopy().setAllowsAnyHTTPSCertificate();
            }
            if (string.IsNullOrEmpty(ret))
            {
                return(null);
            }
            else
            {
                if (ret == request.url())
                {
                    return(request);
                }
                else
                {
                    IWebURLRequest req = new WebURLRequestClass();
                    req.initWithURL(ret, _WebURLRequestCachePolicy.WebURLRequestUseProtocolCachePolicy, 60);
                    return(req);
                }
            }
        }
Beispiel #2
0
        public void decidePolicyForNewWindowAction(WebView WebView, CFDictionaryPropertyBag actionInformation, IWebURLRequest request, string frameName, IWebPolicyDecisionListener listener)
        {
            if (listener != null)
            {
                listener.use();
            }
            string url = request.url();

            NewWindowRequestUrlAvailable(url);
        }
 public void decidePolicyForMIMEType(WebView WebView, string type, IWebURLRequest request, webFrame frame, IWebPolicyDecisionListener listener)
 {
     if (WebView.canShowMIMEType(type) == 0 && !request.url().StartsWith("file:") && !type.Contains("pdf"))
     {
         if (AllowDownloads)
             listener.download();
         else
             listener.ignore();
     }
     else
     {
         listener.use();
         Owner.tempmimetype = type;
     }
 }
        private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView)
        {
            // Todo: find out why url seems to always be empty
            string url = (request == null) ? "" : request.url();
            NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);

            NewWindowRequest(this, args);

            if (!args.Cancel)
            {
                WebKitBrowser b = new WebKitBrowser();
                webView = (WebView)b.webView;
                NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
            }
            else
            {
                webView = null;
            }
        }
 public void decidePolicyForMIMEType(WebView WebView, string type, IWebURLRequest request, webFrame frame, IWebPolicyDecisionListener listener)
 {
     if (WebView.canShowMIMEType(type) == 0 && !request.url().StartsWith("file:") && !type.Contains("pdf"))
     {
         if (AllowDownloads)
         {
             listener.download();
         }
         else
         {
             listener.ignore();
         }
     }
     else
     {
         listener.use();
         Owner.tempmimetype = type;
     }
 }
        private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView)
        {
            // TODO: find out why url seems to always be empty:
            // https://bugs.webkit.org/show_bug.cgi?id=41441 explains all
            string url = (request == null) ? "" : request.url();
            NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);

            NewWindowRequest(this, args);

            if (!args.Cancel)
            {
                WebKitBrowserCore b = new WebKitBrowserCore(host);
                webView = (WebView)b.webView;
                NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
            }
            else
            {
                webView = null;
            }
        }
Beispiel #7
0
 private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView, bool popup = false)
 {
     WebKitBrowser b = new WebKitBrowser();
     if (request != null)
     {
         if (!string.IsNullOrEmpty(request.url()))
             b.Navigate(request.url());
     }
     webView = (WebView) b.webView;
     string url = newwindowurl;
     if (string.IsNullOrEmpty(newwindowurl) && request != null)
         url = request.url();
     
     NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);
     if (popup == true)
     {
         PopupCreated(this, new NewWindowCreatedEventArgs(b));
     }
     else
     {
         NewWindowRequest(this, args);
         NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
     }
     //if (this.Focused == false || ElementAtPoint(this.PointToClient(Cursor.Current.HotSpot)).Type == ElementType.Body || (GetCurrentElement().Type != ElementType.LinkOrUknown || GetCurrentElement().TagName == "BODY" || GetCurrentElement().TagName == "IFRAME" || GetCurrentElement() == null && GetCurrentElement().TagName != "OBJECT"))
     //    {
     //        PopupCreated(this, new NewWindowCreatedEventArgs(b));
     //    }
     //    else
     //    {
     //        NewWindowRequest(this, args);
     //        NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
     //    }
 }
        private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView)
        {
            // TODO: find out why url seems to always be empty:
            // https://bugs.webkit.org/show_bug.cgi?id=41441 explains all
            string url = (request == null) ? "" : request.url();
            NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);
            NewWindowRequest(this, args);

            if (!args.Cancel)
            {
                WebKitBrowserCore b = new WebKitBrowserCore(host);
                webView = (WebView) b.webView;
                NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
            }
            else
            {
                webView = null;
            }
        }
 public void decidePolicyForNewWindowAction(WebView WebView, CFDictionaryPropertyBag actionInformation, IWebURLRequest request, string frameName, IWebPolicyDecisionListener listener)
 {
     if (listener != null)
        listener.use();
     string url = request.url();
     NewWindowRequestUrlAvailable(url);
 }
 public IWebURLRequest willSendRequest(WebView WebView, uint identifier, IWebURLRequest request, IWebURLResponse redirectResponse, IWebDataSource dataSource)
 {
     string ret = ResourceRequestSent(request.url());
     if (Owner.Preferences.IgnoreSSLErrors)
         request.mutableCopy().setAllowsAnyHTTPSCertificate();
     if (string.IsNullOrEmpty(ret))
     {
         return null;
     }
     else
     {
         if (ret == request.url())
         {
             return request;
         }
         else
         {
             IWebURLRequest req = new WebURLRequestClass();
             req.initWithURL(ret, _WebURLRequestCachePolicy.WebURLRequestUseProtocolCachePolicy, 60);
             return req;
         }
     }
 }
        private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView)
        {
            // Todo: find out why url seems to always be empty
            string url = (request == null) ? "" : request.url();
            NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);
            NewWindowRequest(this, args);

            if (!args.Cancel)
            {
                WebKitBrowser b = new WebKitBrowser();
                webView = (WebView) b.webView;
                NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
            }
            else
            {
                webView = null;
            }
        }
        public void decidePolicyForNavigationAction(WebView WebView, CFDictionaryPropertyBag actionInformation, IWebURLRequest request, webFrame frame, IWebPolicyDecisionListener listener)
        {
            if (AllowNavigation || AllowInitialNavigation)
            {
                //use basic authentication if username and password are supplied.
                if (pwdEnabled && string.IsNullOrEmpty(request.valueForHTTPHeaderField("Authorization")) && wbc!=null)
                {

                    wbc.Navigate(request.url());
                    listener.ignore();
                    return;
                }

                listener.use();
            }
            else
                listener.ignore();
        }