public bool ProcessRequest(CefSharp.IRequest request, ref string mimeType, ref System.IO.Stream stream) { if (request.Url.StartsWith("sp://")) { // On windows, we must replace the / with the \ String URL = request.Url.Replace("sp://", ResourceDirectory).Replace("/", "\\"); if (URL.EndsWith(".css")) { mimeType = "text/css"; } if (URL.EndsWith(".js")) { mimeType = "text/javascript"; } String contents = ""; using (StreamReader sr = new StreamReader(URL)) { contents = sr.ReadToEnd(); } byte[] bytes = Encoding.UTF8.GetBytes(contents); stream = new MemoryStream(bytes); return(true); } return(false); }
protected override bool DoBeforeBrowse(CefSharp.IWebBrowser browser, CefSharp.IRequest request, CefSharp.NavigationType naigationvType, bool isRedirect) { Uri uri = new Uri(request.Url); if (!uri.Host.EndsWith("euronews.com")) { return(true); // true == cancel } else { return(base.DoBeforeBrowse(browser, request, naigationvType, isRedirect)); } }
bool CefSharp.IRequestHandler.OnBeforeBrowse(CefSharp.IWebBrowser browser, CefSharp.IRequest request, CefSharp.NavigationType navigationType, bool isRedirect) { var uri = new Uri(request.Url); if (uri.Scheme != "chrome-devtools") { // hack since we can't tell if we're loading from an iframe or a new page. grr. if (uri.IsFile || navigationType != CefSharp.NavigationType.Other) { var args = new WebViewLoadingEventArgs(uri, true); Widget.OnDocumentLoading(args); return(args.Cancel); } } return(false); }
bool CefSharp.ISchemeHandler.ProcessRequest(CefSharp.IRequest request, ref string mimeType, ref System.IO.Stream stream) { if (request.Url.StartsWith("mako://", StringComparison.OrdinalIgnoreCase) && request.Url.EndsWith(".html")) { WebClient wc = new WebClient(); String data = wc.DownloadString(request.Url.ToString().Replace("mako://", "http://")); Program.me.Preprocess(data, "", false, request.Url.ToString()); stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(Program.me.Output)); mimeType = "text/html"; return(true); } return(false); }
public UrlRequest(CefSharp.IRequest request, CefSharp.IUrlRequestClient urlRequestClient, CefSharp.IRequestContext requestContext) { }
public CefSharp.IResourceRequestHandler GetResourceRequestHandler(CefSharp.IWebBrowser chromiumWebBrowser, CefSharp.IBrowser browser, CefSharp.IFrame frame, CefSharp.IRequest request, bool isNavigation, bool isDownload, string requestInitiator, ref bool disableDefaultHandling) { if (request.ResourceType == CefSharp.ResourceType.Image) { return(new CefResourceRequestHandler()); } return(null); }
protected override bool OnResourceResponse(CefSharp.IWebBrowser chromiumWebBrowser, CefSharp.IBrowser browser, CefSharp.IFrame frame, CefSharp.IRequest request, CefSharp.IResponse response) { return(base.OnResourceResponse(chromiumWebBrowser, browser, frame, request, response)); }
protected override CefSharp.IResponseFilter GetResourceResponseFilter(CefSharp.IWebBrowser chromiumWebBrowser, CefSharp.IBrowser browser, CefSharp.IFrame frame, CefSharp.IRequest request, CefSharp.IResponse response) { return(null); }
protected override CefSharp.CefReturnValue OnBeforeResourceLoad(CefSharp.IWebBrowser chromiumWebBrowser, CefSharp.IBrowser browser, CefSharp.IFrame frame, CefSharp.IRequest request, CefSharp.IRequestCallback callback) { return(CefSharp.CefReturnValue.Continue); }