using System.Net; namespace CefSharp { public enum NavigationType { LinkClicked, FormSubmitted, BackForward, Reload, FormResubmitted, Other }; public interface IRequestHandler { /// /// Called before browser navigation. /// If the navigation is allowed and /// will be called. If the navigation is canceled will be called with an ErrorCode /// value of . /// /// the browser object /// the request object - cannot be modified in this callback /// has the request been redirected /// Return true to cancel the navigation or false to allow the navigation to proceed. bool OnBeforeBrowse(IWebBrowser browser, IRequest request, bool isRedirect); /// /// Called when a plugin has crashed /// /// the browser object /// path of the plugin that crashed void OnPluginCrashed(IWebBrowser browser, string pluginPath); /// /// Called before a resource request is loaded. /// /// the browser object /// the request response object - can be modified in this callback /// To cancel loading of the resource return true or false o allow the resource to load normally. bool OnBeforeResourceLoad(IWebBrowser browser, IRequestResponse requestResponse); void OnResourceResponse(IWebBrowser browser, string url, int status, string statusText, string mimeType, WebHeaderCollection headers); /// /// Called when a server indicates via the 'Content-Disposition' header that a response represents a file to download. /// /// the browser object /// Set instance of IDownloadHandler that will recieve the file contents /// Return true to download the file or false to cancel the file download bool GetDownloadHandler(IWebBrowser browser, out IDownloadHandler handler); /// /// Called when the browser needs credentials from the user. /// /// the browser object /// indicates whether the host is a proxy server /// hostname /// port number /// realm /// scheme /// requested username /// requested password /// Return true to continue the request and call CefAuthCallback::Continue() when the authentication information is available. Return false to cancel the request. bool GetAuthCredentials(IWebBrowser browser, bool isProxy, string host, int port, string realm, string scheme, ref string username, ref string password); /// /// Called on the browser process IO thread before a plugin is loaded. /// /// the browser object /// URL /// policy URL /// plugin information /// Return true to block loading of the plugin. bool OnBeforePluginLoad(IWebBrowser browser, string url, string policyUrl, IWebPluginInfo info); } }