// Copyright © 2011 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; using System.Threading.Tasks; namespace CefSharp { /// /// ChromiumWebBrowser implementations implement this interface. Can be cast to /// the concrete implementation to access UI specific features. /// public interface IWebBrowser : IChromiumWebBrowserBase { /// /// Event handler that will get called when the message that originates from CefSharp.PostMessage /// event EventHandler JavascriptMessageReceived; /// /// Loads the specified in the Main Frame. /// If is true then the method call will be ignored. /// Same as calling /// /// The URL to be loaded. void Load(string url); /// /// Wait for the Browser to finish loading the initial web page. /// /// /// A that can be awaited which returns the HttpStatusCode and . /// A HttpStatusCode equal to 200 and is considered a success. /// Task WaitForInitialLoadAsync(); /// /// The javascript object repository, one repository per ChromiumWebBrowser instance. /// IJavascriptObjectRepository JavascriptObjectRepository { get; } /// /// Implement and assign to handle dialog events. /// /// The dialog handler. IDialogHandler DialogHandler { get; set; } /// /// Implement and assign to handle events related to browser requests. /// /// The request handler. IRequestHandler RequestHandler { get; set; } /// /// Implement and assign to handle events related to browser display state. /// /// The display handler. IDisplayHandler DisplayHandler { get; set; } /// /// Implement and assign to handle events related to browser load status. /// /// The load handler. ILoadHandler LoadHandler { get; set; } /// /// Implement and assign to handle events related to popups. /// /// The life span handler. ILifeSpanHandler LifeSpanHandler { get; set; } /// /// Implement and assign to handle events related to key press. /// /// The keyboard handler. IKeyboardHandler KeyboardHandler { get; set; } /// /// Implement and assign to handle events related to JavaScript Dialogs. /// /// The js dialog handler. IJsDialogHandler JsDialogHandler { get; set; } /// /// Implement and assign to handle events related to dragging. /// /// The drag handler. IDragHandler DragHandler { get; set; } /// /// Implement and assign to handle events related to downloading files. /// /// The download handler. IDownloadHandler DownloadHandler { get; set; } /// /// Implement and assign to handle events related to the browser context menu /// /// The menu handler. IContextMenuHandler MenuHandler { get; set; } /// /// Implement and assign to handle events related to the browser component's focus /// /// The focus handler. IFocusHandler FocusHandler { get; set; } /// /// Implement and control the loading of resources /// /// The resource handler factory. IResourceRequestHandlerFactory ResourceRequestHandlerFactory { get; set; } /// /// Implement and assign to handle messages from the render process. /// /// The render process message handler. IRenderProcessMessageHandler RenderProcessMessageHandler { get; set; } /// /// Implement to handle events related to find results. /// /// The find handler. IFindHandler FindHandler { get; set; } /// /// Implement to handle audio events. /// IAudioHandler AudioHandler { get; set; } /// /// Implement to handle frame events. /// IFrameHandler FrameHandler { get; set; } /// /// Implement to handle events related to permission requests. /// IPermissionHandler PermissionHandler { get; set; } /// /// The text that will be displayed as a ToolTip /// /// The tooltip text. string TooltipText { get; } /// /// A flag that indicates if you can execute javascript in the main frame. /// Flag is set to true in IRenderProcessMessageHandler.OnContextCreated. /// and false in IRenderProcessMessageHandler.OnContextReleased /// bool CanExecuteJavascriptInMainFrame { get; } /// /// Gets the custom request context assigned to this browser instance /// If no instance was assigned this will be null and the global /// request context will have been used for this browser. /// You can access the global request context through Cef.GetGlobalRequestContext() /// IRequestContext RequestContext { get; } /// /// Returns the current CEF Browser Instance /// /// browser instance or null IBrowser GetBrowser(); /// /// Try and get a reference to the instance that matches the . /// Primarily used for geting a reference to the used by popups. /// /// browser Id /// When this method returns, contains the object reference that matches the specified , or null if no matching instance found. /// true if a instance was found matching ; otherwise, false. bool TryGetBrowserCoreById(int browserId, out IBrowser browser); /// /// Size of scrollable area in CSS pixels /// /// A task that can be awaited to get the size of the scrollable area in CSS pixels. Task GetContentSizeAsync(); } }