using System; namespace CefSharp { /// /// A delegate type used to listen to LoadError messages. /// /// The URL that failed to load. /// The error code. /// The error text. public delegate void LoadErrorEventHandler(string failedUrl, CefErrorCode errorCode, string errorText); public interface IWebBrowser { /// /// Event handler for receiving Javascript console messages being sent from web pages. /// event ConsoleMessageEventHandler ConsoleMessage; /// /// Event handler that will get called whenever loading of a frame starts. /// event FrameLoadStartEventHandler FrameLoadStart; /// /// Event handler that will get called whenever loading of a frame is complete. /// event FrameLoadEndEventHandler FrameLoadEnd; /// /// Event handler that will get called whenever a load error occurs. /// event LoadErrorEventHandler LoadError; void Load(string url); /// /// Loads custom HTML content into the web browser. /// /// The HTML content. /// The URL that will be treated as the address of the content. void LoadHtml(string html, string url); /// /// Registers a Javascript object in this specific browser instance. /// /// The name of the object. (e.g. "foo", if you want the object to be accessible as window.foo). /// The object to be made accessible to Javascript. void RegisterJsObject(string name, object objectToBind); /// /// Execute some Javascript code in the context of this WebBrowser. As the method name implies, the script will be /// executed asynchronously, and the method therefore returns before the script has actually been executed. /// /// The Javascript code that should be executed. void ExecuteScriptAsync(string script); /// /// Execute some Javascript code in the context of this WebBrowser, and return the result of the evaluation. /// /// The Javascript code that should be executed. /// The timeout after which the Javascript code execution should be aborted. object EvaluateScript(string script, TimeSpan? timeout = null); IRequestHandler RequestHandler { get; set; } bool IsBrowserInitialized { get; } /// /// A flag that indicates whether the control is currently loading one or more web pages (true) or not (false). /// /// This property is a Dependency Property and fully supports data binding. bool IsLoading { get; set; } bool CanGoBack { get; } bool CanGoForward { get; } /// /// The address (URL) which the browser control is currently displaying. Can be set to a simplified URL /// (e.g. www.google.com) or a full URL (e.g. http://www.google.com). Will automatically be updated as the user /// navigates to another page (e.g. by clicking on a link). /// /// This property is a Dependency Property and fully supports data binding. string Address { get; set; } /// /// The title of the web page being currently displayed. /// /// This property is a Dependency Property and fully supports data binding. string Title { get; } string TooltipText { get; set; } } }