diff --git a/CefSharp/IBrowser.cs b/CefSharp/IBrowser.cs index bb49140e5..c3283aa5b 100644 --- a/CefSharp/IBrowser.cs +++ b/CefSharp/IBrowser.cs @@ -44,15 +44,15 @@ namespace CefSharp bool IsLoading { get; } /// - /// Request that the browser close. The JavaScript 'onbeforeunload' event will - /// be fired. If |forceClose| is false the event handler, if any, will be - /// allowed to prompt the user and the user can optionally cancel the close. - /// If |force_close| is true the prompt will not be displayed and the close - /// will proceed. Results in a call to CefLifeSpanHandler::DoClose() if the - /// event handler allows the close or if |force_close| is true. See - /// CefLifeSpanHandler::DoClose() documentation for additional usage - /// information. + /// Request that the browser close. The JavaScript 'onbeforeunload' event will be fired. /// + /// + /// If forceClose is false the event handler, if any, will be allowed to prompt the user and the + /// user can optionally cancel the close. If forceClose is true the prompt will not be displayed + /// and the close will proceed. Results in a call to if + /// the event handler allows the close or if forceClose is true + /// See documentation for additional usage information. + /// void CloseBrowser(bool forceClose); /// diff --git a/CefSharp/IBrowserHost.cs b/CefSharp/IBrowserHost.cs index c1d319370..1f5522490 100644 --- a/CefSharp/IBrowserHost.cs +++ b/CefSharp/IBrowserHost.cs @@ -21,7 +21,7 @@ namespace CefSharp /// /// Add the specified word to the spelling dictionary. /// - /// + /// custom word to be added to dictionary void AddWordToDictionary(string word); /// @@ -66,7 +66,7 @@ namespace CefSharp void DragTargetDragDrop(MouseEvent mouseEvent); /// - /// Call this method when the drag operation started by a call has ended either in a drop or by being cancelled. + /// Call this method when the drag operation started by a call has ended either in a drop or by being cancelled. /// If the web view is both the drag source and the drag target then all DragTarget* methods should be called before DragSource* methods. /// This method is only used when window rendering is disabled. /// @@ -82,7 +82,7 @@ namespace CefSharp void DragTargetDragLeave(); /// - /// Call this method when the drag operation started by a call has completed. + /// Call this method when the drag operation started by a call has completed. /// This method may be called immediately without first calling DragSourceEndedAt to cancel a drag operation. /// If the web view is both the drag source and the drag target then all DragTarget* methods should be called before DragSource* mthods. /// This method is only used when window rendering is disabled. diff --git a/CefSharp/IDragData.cs b/CefSharp/IDragData.cs index db4eae6db..10b758a88 100644 --- a/CefSharp/IDragData.cs +++ b/CefSharp/IDragData.cs @@ -17,7 +17,7 @@ namespace CefSharp /// /// Gets a copy of the current drag data /// - /// + /// a clone of the current object IDragData Clone(); /// @@ -124,4 +124,4 @@ namespace CefSharp /// bool IsDisposed { get; } } -} \ No newline at end of file +} diff --git a/CefSharp/IFrame.cs b/CefSharp/IFrame.cs index 0ddd852a4..76e6d0989 100644 --- a/CefSharp/IFrame.cs +++ b/CefSharp/IFrame.cs @@ -195,6 +195,8 @@ namespace CefSharp /// /// The request object will be marked as read-only after calling this method. /// + /// the web request + /// the client IUrlRequest CreateUrlRequest(IRequest request, IUrlRequestClient client); } } diff --git a/CefSharp/WebBrowserExtensions.cs b/CefSharp/WebBrowserExtensions.cs index b1b57a2ed..03b05e94b 100644 --- a/CefSharp/WebBrowserExtensions.cs +++ b/CefSharp/WebBrowserExtensions.cs @@ -14,8 +14,7 @@ using CefSharp.Web; namespace CefSharp { /// - /// WebBrowser extensions - These methods make performing common tasks - /// easier. + /// WebBrowser extensions - These methods make performing common tasks easier. /// public static class WebBrowserExtensions { @@ -23,10 +22,10 @@ namespace CefSharp /// /// Registers a Javascript object in this specific browser instance. /// - /// The browser to perform the registering on + /// The browser to perform the registering on. /// 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. - /// binding options - camelCaseJavascriptNames default to true + /// (Optional) binding options - camelCaseJavascriptNames default to true. /// Browser is already initialized. RegisterJsObject must be + /// called before the underlying CEF browser is created. [Obsolete("This method has been removed, see https://github.com/cefsharp/CefSharp/issues/2990 for details on migrating your code.")] @@ -57,8 +56,8 @@ namespace CefSharp /// /// Returns the main (top-level) frame for the browser window. /// - /// the ChromiumWebBrowser instance - /// Frame + /// the ChromiumWebBrowser instance. + /// the main frame. public static IFrame GetMainFrame(this IWebBrowser browser) { var cefBrowser = browser.GetBrowser(); @@ -71,7 +70,8 @@ namespace CefSharp /// /// Returns the focused frame for the browser window. /// - /// Frame + /// the ChromiumWebBrowser instance. + /// the focused frame. public static IFrame GetFocusedFrame(this IWebBrowser browser) { var cefBrowser = browser.GetBrowser(); @@ -82,9 +82,9 @@ namespace CefSharp } /// - /// Execute Undo on the focused frame + /// Execute Undo on the focused frame. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void Undo(this IWebBrowser browser) { using (var frame = browser.GetFocusedFrame()) @@ -96,9 +96,9 @@ namespace CefSharp } /// - /// Execute Redo on the focused frame + /// Execute Redo on the focused frame. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void Redo(this IWebBrowser browser) { using (var frame = browser.GetFocusedFrame()) @@ -110,9 +110,9 @@ namespace CefSharp } /// - /// Execute Cut on the focused frame + /// Execute Cut on the focused frame. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void Cut(this IWebBrowser browser) { using (var frame = browser.GetFocusedFrame()) @@ -124,9 +124,9 @@ namespace CefSharp } /// - /// Execute Copy on the focused frame + /// Execute Copy on the focused frame. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void Copy(this IWebBrowser browser) { using (var frame = browser.GetFocusedFrame()) @@ -138,9 +138,9 @@ namespace CefSharp } /// - /// Execute Paste on the focused frame + /// Execute Paste on the focused frame. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void Paste(this IWebBrowser browser) { using (var frame = browser.GetFocusedFrame()) @@ -152,9 +152,9 @@ namespace CefSharp } /// - /// Execute Delete on the focused frame + /// Execute Delete on the focused frame. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void Delete(this IWebBrowser browser) { using (var frame = browser.GetFocusedFrame()) @@ -166,9 +166,9 @@ namespace CefSharp } /// - /// Execute SelectAll on the focused frame + /// Execute SelectAll on the focused frame. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void SelectAll(this IWebBrowser browser) { using (var frame = browser.GetFocusedFrame()) @@ -180,10 +180,10 @@ namespace CefSharp } /// - /// Opens up a new program window (using the default text editor) where the source code of the currently displayed web - /// page is shown. + /// Opens up a new program window (using the default text editor) where the source code of the currently displayed web page is + /// shown. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void ViewSource(this IWebBrowser browser) { using (var frame = browser.GetMainFrame()) @@ -197,8 +197,10 @@ namespace CefSharp /// /// Retrieve the main frame's HTML source using a . /// - /// The ChromiumWebBrowser instance this method extends - /// that when executed returns the frame source as a string + /// The ChromiumWebBrowser instance this method extends. + /// + /// that when executed returns the main frame source as a string. + /// public static Task GetSourceAsync(this IWebBrowser browser) { using (var frame = browser.GetMainFrame()) @@ -212,8 +214,10 @@ namespace CefSharp /// /// Retrieve the main frame's display text using a . /// - /// The ChromiumWebBrowser instance this method extends - /// that when executed returns the frame display text as a string. + /// The ChromiumWebBrowser instance this method extends. + /// + /// that when executed returns the main frame display text as a string. + /// public static Task GetTextAsync(this IWebBrowser browser) { using (var frame = browser.GetMainFrame()) @@ -225,14 +229,14 @@ namespace CefSharp } /// - /// 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. - /// This simple helper extension will encapsulate params in single quotes (unless int, uint, etc) + /// 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. This simple helper extension + /// will encapsulate params in single quotes (unless int, uint, etc) /// - /// The ChromiumWebBrowser instance this method extends - /// The javascript method name to execute - /// the arguments to be passed as params to the method. Args are encoded using , - /// you can provide a custom implementation if you require a custom implementation + /// The ChromiumWebBrowser instance this method extends. + /// The javascript method name to execute. + /// the arguments to be passed as params to the method. Args are encoded using + /// , you can provide a custom implementation if you require a custom implementation. public static void ExecuteScriptAsync(this IWebBrowser browser, string methodName, params object[] args) { var script = GetScriptForJavascriptMethodWithArgs(methodName, args); @@ -241,10 +245,10 @@ namespace CefSharp } /// - /// 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. + /// 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 ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. /// The Javascript code that should be executed. public static void ExecuteScriptAsync(this IWebBrowser browser, string script) { @@ -262,16 +266,18 @@ namespace CefSharp } /// - /// Execute Javascript code in the context of this WebBrowser. This extension method uses the LoadingStateChanged event. - /// As the method name implies, the script will be executed asynchronously, and the method therefore returns before the - /// script has actually been executed. + /// Execute Javascript code in the context of this WebBrowser. This extension method uses the LoadingStateChanged event. As the + /// method name implies, the script will be executed asynchronously, and the method therefore returns before the script has + /// actually been executed. /// - /// The ChromiumWebBrowser instance this method extends + /// + /// Best effort is made to make sure the script is executed, there are likely a few edge cases where the script won't be executed, + /// if you suspect your script isn't being executed, then try executing in the LoadingStateChanged event handler to confirm that + /// it does indeed get executed. + /// + /// The ChromiumWebBrowser instance this method extends. /// The Javascript code that should be executed. - /// The script will only be executed on first page load, subsiquent page loads will be ignored - /// Best effort is made to make sure the script is executed, there are likely a few edge cases where the script - /// won't be executed, if you suspect your script isn't being executed, then try executing in the LoadingStateChanged - /// event handler to confirm that it does indeed get executed. + /// (Optional) The script will only be executed on first page load, subsiquent page loads will be ignored. public static void ExecuteScriptAsyncWhenPageLoaded(this IWebBrowser webBrowser, string script, bool oneTime = true) { var useLoadingStateChangedEventHandler = webBrowser.IsBrowserInitialized == false || oneTime == false; @@ -316,18 +322,16 @@ namespace CefSharp } /// - /// Creates a new instance of IRequest with the specified Url and Method = POST - /// and then calls . + /// Creates a new instance of IRequest with the specified Url and Method = POST and then calls + /// . /// can only be used if a renderer process already exists. - /// In newer versions initially loading about:blank no longer creates a renderer process. You - /// can load a Data Uri initially then call this method. - /// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs + /// In newer versions initially loading about:blank no longer creates a renderer process. You can load a Data Uri initially then + /// call this method. https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs. /// - /// - /// - /// - /// - /// This is an extension method + /// browser this method extends + /// url to load + /// post data as byte array + /// (Optional) if set the Content-Type header will be set [Obsolete("This method will be removed in version 75 as it has become unreliable see https://github.com/cefsharp/CefSharp/issues/2705 for details.")] public static void LoadUrlWithPostData(this IWebBrowser browser, string url, byte[] postDataBytes, string contentType = null) { @@ -361,30 +365,29 @@ namespace CefSharp /// Registers and loads a that represents the HTML content. /// /// - /// `Cef` Native `LoadHtml` is unpredictable and only works sometimes, this method wraps - /// the provided HTML in a and loads the provided url using - /// the method. - /// Defaults to using for character encoding - /// The url must start with a valid schema, other uri's such as about:blank are invalid - /// A valid example looks like http://test/page + /// `Cef` Native `LoadHtml` is unpredictable and only works sometimes, this method wraps the provided HTML in a + /// and loads the provided url using the method. Defaults to using + /// for character encoding The url must start with a valid schema, other uri's such as about:blank + /// are invalid A valid example looks like http://test/page. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. /// The HTML content. /// The URL that will be treated as the address of the content. - /// returns false if the Url was not successfully parsed into a Uri + /// + /// returns false if the Url was not successfully parsed into a Uri. + /// public static bool LoadHtml(this IWebBrowser browser, string html, string url) { return browser.LoadHtml(html, url, Encoding.UTF8); } /// - /// Loads html as Data Uri - /// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs for details - /// If base64Encode is false then html will be Uri encoded + /// Loads html as Data Uri See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs for details If + /// base64Encode is false then html will be Uri encoded. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. /// Html to load as data uri. - /// if true the html string will be base64 encoded using UTF8 encoding. + /// (Optional) if true the html string will be base64 encoded using UTF8 encoding. public static void LoadHtml(this IWebBrowser browser, string html, bool base64Encode = false) { var htmlString = new HtmlString(html, base64Encode); @@ -393,13 +396,12 @@ namespace CefSharp } /// - /// Loads html as Data Uri - /// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs for details - /// If base64Encode is false then html will be Uri encoded + /// Loads html as Data Uri See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs for details If + /// base64Encode is false then html will be Uri encoded. /// - /// The instance this method extends + /// The instance this method extends. /// Html to load as data uri. - /// if true the html string will be base64 encoded using UTF8 encoding. + /// (Optional) if true the html string will be base64 encoded using UTF8 encoding. public static void LoadHtml(this IFrame frame, string html, bool base64Encode = false) { var htmlString = new HtmlString(html, base64Encode); @@ -411,16 +413,19 @@ namespace CefSharp /// Registers and loads a that represents the HTML content. /// /// - /// `Cef` Native `LoadHtml` is unpredictable and only works sometimes, this method wraps - /// the provided HTML in a and loads the provided url using - /// the method. + /// `Cef` Native `LoadHtml` is unpredictable and only works sometimes, this method wraps the provided HTML in a + /// and loads the provided url using the method. /// - /// The ChromiumWebBrowser instance this method extends + /// Thrown when an exception error condition occurs. + /// The ChromiumWebBrowser instance this method extends. /// The HTML content. /// The URL that will be treated as the address of the content. - /// Character Encoding - /// Whether or not the handler should be used once (true) or until manually unregistered (false) - /// returns false if the Url was not successfully parsed into a Uri + /// Character Encoding. + /// (Optional) Whether or not the handler should be used once (true) or until manually unregistered + /// (false) + /// + /// returns false if the Url was not successfully parsed into a Uri. + /// public static bool LoadHtml(this IWebBrowser browser, string html, string url, Encoding encoding, bool oneTimeUse = false) { if (browser.ResourceRequestHandlerFactory == null) @@ -444,14 +449,17 @@ namespace CefSharp } /// - /// Register a ResourceHandler. Can only be used when browser.ResourceHandlerFactory is an instance of DefaultResourceHandlerFactory + /// Register a ResourceHandler. Can only be used when browser.ResourceHandlerFactory is an instance of + /// DefaultResourceHandlerFactory. /// - /// The ChromiumWebBrowser instance this method extends - /// the url of the resource to unregister - /// Stream to be registered, the stream should not be shared with any other instances of DefaultResourceHandlerFactory - /// the mimeType - /// Whether or not the handler should be used once (true) or until manually unregistered (false). If true the Stream - /// will be Diposed of when finished. + /// Thrown when an exception error condition occurs. + /// The ChromiumWebBrowser instance this method extends. + /// the url of the resource to unregister. + /// Stream to be registered, the stream should not be shared with any other instances of + /// DefaultResourceHandlerFactory. + /// (Optional) the mimeType. + /// (Optional) Whether or not the handler should be used once (true) or until manually unregistered + /// (false). If true the Stream will be Diposed of when finished. public static void RegisterResourceHandler(this IWebBrowser browser, string url, Stream stream, string mimeType = ResourceHandler.DefaultMimeType, bool oneTimeUse = false) { @@ -476,10 +484,12 @@ namespace CefSharp } /// - /// Unregister a ResourceHandler. Can only be used when browser.ResourceHandlerFactory is an instance of DefaultResourceHandlerFactory + /// Unregister a ResourceHandler. Can only be used when browser.ResourceHandlerFactory is an instance of + /// DefaultResourceHandlerFactory. /// - /// The ChromiumWebBrowser instance this method extends - /// the url of the resource to unregister + /// Thrown when an exception error condition occurs. + /// The ChromiumWebBrowser instance this method extends. + /// the url of the resource to unregister. public static void UnRegisterResourceHandler(this IWebBrowser browser, string url) { var handler = browser.ResourceRequestHandlerFactory as ResourceRequestHandlerFactory; @@ -495,6 +505,7 @@ namespace CefSharp /// /// Stops loading the current page. /// + /// The ChromiumWebBrowser instance this method extends. public static void Stop(this IWebBrowser browser) { var cefBrowser = browser.GetBrowser(); @@ -507,6 +518,7 @@ namespace CefSharp /// /// Navigates back, must check before calling this method. /// + /// The ChromiumWebBrowser instance this method extends. public static void Back(this IWebBrowser browser) { var cefBrowser = browser.GetBrowser(); @@ -519,6 +531,7 @@ namespace CefSharp /// /// Navigates forward, must check before calling this method. /// + /// The ChromiumWebBrowser instance this method extends. public static void Forward(this IWebBrowser browser) { var cefBrowser = browser.GetBrowser(); @@ -531,18 +544,19 @@ namespace CefSharp /// /// Reloads the page being displayed. This method will use data from the browser's cache, if available. /// + /// The ChromiumWebBrowser instance this method extends. public static void Reload(this IWebBrowser browser) { browser.Reload(false); } /// - /// Reloads the page being displayed, optionally ignoring the cache (which means the whole page including all .css, .js - /// etc. resources will be re-fetched). + /// Reloads the page being displayed, optionally ignoring the cache (which means the whole page including all .css, .js etc. + /// resources will be re-fetched). /// - /// The ChromiumWebBrowser instance this method extends - /// true A reload is performed ignoring browser cache; false A reload is - /// performed using files from the browser cache, if available. + /// The ChromiumWebBrowser instance this method extends. + /// true A reload is performed ignoring browser cache; false A reload is performed using + /// files from the browser cache, if available. public static void Reload(this IWebBrowser browser, bool ignoreCache) { var cefBrowser = browser.GetBrowser(); @@ -553,12 +567,15 @@ namespace CefSharp } /// - /// Gets the default cookie manager associated with the IWebBrowser + /// Gets the default cookie manager associated with the IWebBrowser. /// - /// The ChromiumWebBrowser instance this method extends - /// If not null it will be executed asnychronously on the - /// CEF IO thread after the manager's storage has been initialized. - /// Cookie Manager + /// Thrown when an exception error condition occurs. + /// The ChromiumWebBrowser instance this method extends. + /// (Optional) If not null it will be executed asnychronously on the CEF IO thread after the manager's + /// storage has been initialized. + /// + /// Cookie Manager. + /// public static ICookieManager GetCookieManager(this IWebBrowser browser, ICompletionCallback callback = null) { var host = browser.GetBrowserHost(); @@ -578,6 +595,10 @@ namespace CefSharp /// /// Asynchronously gets the current Zoom Level. /// + /// The ChromiumWebBrowser instance this method extends. + /// + /// An asynchronous result that yields the zoom level. + /// public static Task GetZoomLevelAsync(this IBrowser cefBrowser) { var host = cefBrowser.GetHost(); @@ -589,6 +610,10 @@ namespace CefSharp /// /// Asynchronously gets the current Zoom Level. /// + /// the ChromiumWebBrowser instance. + /// + /// An asynchronous result that yields the zoom level. + /// public static Task GetZoomLevelAsync(this IWebBrowser browser) { var cefBrowser = browser.GetBrowser(); @@ -599,12 +624,11 @@ namespace CefSharp /// Change the ZoomLevel to the specified value. Can be set to 0.0 to clear the zoom level. /// /// - /// If called on the CEF UI thread the change will be applied immediately. - /// Otherwise, the change will be applied asynchronously on the CEF UI thread. - /// The CEF UI thread is different to the WPF/WinForms UI Thread + /// If called on the CEF UI thread the change will be applied immediately. Otherwise, the change will be applied asynchronously + /// on the CEF UI thread. The CEF UI thread is different to the WPF/WinForms UI Thread. /// - /// The ChromiumWebBrowser instance this method extends - /// zoom level + /// The ChromiumWebBrowser instance this method extends. + /// zoom level. public static void SetZoomLevel(this IBrowser cefBrowser, double zoomLevel) { cefBrowser.ThrowExceptionIfBrowserNull(); @@ -619,12 +643,11 @@ namespace CefSharp /// Change the ZoomLevel to the specified value. Can be set to 0.0 to clear the zoom level. /// /// - /// If called on the CEF UI thread the change will be applied immediately. - /// Otherwise, the change will be applied asynchronously on the CEF UI thread. - /// The CEF UI thread is different to the WPF/WinForms UI Thread + /// If called on the CEF UI thread the change will be applied immediately. Otherwise, the change will be applied asynchronously + /// on the CEF UI thread. The CEF UI thread is different to the WPF/WinForms UI Thread. /// - /// The ChromiumWebBrowser instance this method extends - /// zoom level + /// The ChromiumWebBrowser instance this method extends. + /// zoom level. public static void SetZoomLevel(this IWebBrowser browser, double zoomLevel) { var cefBrowser = browser.GetBrowser(); @@ -634,12 +657,11 @@ namespace CefSharp /// /// Search for text within the current page. /// - /// The ChromiumWebBrowser instance this method extends - /// Can be used in can conjunction with searchText to have multiple - /// searches running simultaneously. - /// search text + /// The ChromiumWebBrowser instance this method extends. + /// Can be used in can conjunction with searchText to have multiple searches running simultaneously. + /// search text. /// indicates whether to search forward or backward within the page. - /// indicates whether the search should be case-sensitive. + /// indicates whether the search should be case-sensitive. /// indicates whether this is the first request or a follow-up. public static void Find(this IBrowser cefBrowser, int identifier, string searchText, bool forward, bool matchCase, bool findNext) { @@ -652,12 +674,11 @@ namespace CefSharp /// /// Search for text within the current page. /// - /// The ChromiumWebBrowser instance this method extends - /// Can be used in can conjunction with searchText to have multiple - /// searches running simultaneously. - /// search text + /// The ChromiumWebBrowser instance this method extends. + /// Can be used in can conjunction with searchText to have multiple searches running simultaneously. + /// search text. /// indicates whether to search forward or backward within the page. - /// indicates whether the search should be case-sensitive. + /// indicates whether the search should be case-sensitive. /// indicates whether this is the first request or a follow-up. public static void Find(this IWebBrowser browser, int identifier, string searchText, bool forward, bool matchCase, bool findNext) { @@ -670,8 +691,8 @@ namespace CefSharp /// /// Cancel all searches that are currently going on. /// - /// The ChromiumWebBrowser instance this method extends - /// clear the current search selection + /// The ChromiumWebBrowser instance this method extends. + /// clear the current search selection. public static void StopFinding(this IBrowser cefBrowser, bool clearSelection) { cefBrowser.ThrowExceptionIfBrowserNull(); @@ -685,8 +706,8 @@ namespace CefSharp /// /// Cancel all searches that are currently going on. /// - /// The ChromiumWebBrowser instance this method extends - /// clear the current search selection + /// The ChromiumWebBrowser instance this method extends. + /// clear the current search selection. public static void StopFinding(this IWebBrowser browser, bool clearSelection) { var cefBrowser = browser.GetBrowser(); @@ -698,7 +719,7 @@ namespace CefSharp /// /// Opens a Print Dialog which if used (can be user cancelled) will print the browser contents. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void Print(this IBrowser cefBrowser) { var host = cefBrowser.GetHost(); @@ -708,14 +729,16 @@ namespace CefSharp } /// - /// Asynchronously prints the current browser contents to the PDF file specified. - /// The caller is responsible for deleting the file when done. + /// Asynchronously prints the current browser contents to the PDF file specified. The caller is responsible for deleting the file + /// when done. /// /// The object this method extends. /// Output file location. - /// Print Settings. - /// A task that represents the asynchronous print operation. - /// The result is true on success or false on failure to generate the Pdf. + /// (Optional) Print Settings. + /// + /// A task that represents the asynchronous print operation. The result is true on success or false on failure to generate the + /// Pdf. + /// public static Task PrintToPdfAsync(this IBrowser cefBrowser, string path, PdfPrintSettings settings = null) { var host = cefBrowser.GetHost(); @@ -730,7 +753,7 @@ namespace CefSharp /// /// Opens a Print Dialog which if used (can be user cancelled) will print the browser contents. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void Print(this IWebBrowser browser) { var cefBrowser = browser.GetBrowser(); @@ -740,14 +763,16 @@ namespace CefSharp } /// - /// Asynchronously prints the current browser contents to the PDF file specified. - /// The caller is responsible for deleting the file when done. + /// Asynchronously prints the current browser contents to the PDF file specified. The caller is responsible for deleting the file + /// when done. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. /// Output file location. - /// Print Settings. - /// A task that represents the asynchronous print operation. - /// The result is true on success or false on failure to generate the Pdf. + /// (Optional) Print Settings. + /// + /// A task that represents the asynchronous print operation. The result is true on success or false on failure to generate the + /// Pdf. + /// public static Task PrintToPdfAsync(this IWebBrowser browser, string path, PdfPrintSettings settings = null) { var cefBrowser = browser.GetBrowser(); @@ -757,12 +782,12 @@ namespace CefSharp } /// - /// Open developer tools in its own window. + /// Open developer tools in its own window. /// - /// The ChromiumWebBrowser instance this method extends - /// window info used for showing dev tools - /// x coordinate (used for inspectElement) - /// y coordinate (used for inspectElement) + /// The ChromiumWebBrowser instance this method extends. + /// (Optional) window info used for showing dev tools. + /// (Optional) x coordinate (used for inspectElement) + /// (Optional) y coordinate (used for inspectElement) public static void ShowDevTools(this IBrowser cefBrowser, IWindowInfo windowInfo = null, int inspectElementAtX = 0, int inspectElementAtY = 0) { var host = cefBrowser.GetHost(); @@ -772,12 +797,12 @@ namespace CefSharp } /// - /// Open developer tools in its own window. + /// Open developer tools in its own window. /// - /// The ChromiumWebBrowser instance this method extends - /// window info used for showing dev tools - /// x coordinate (used for inspectElement) - /// y coordinate (used for inspectElement) + /// The ChromiumWebBrowser instance this method extends. + /// (Optional) window info used for showing dev tools. + /// (Optional) x coordinate (used for inspectElement) + /// (Optional) y coordinate (used for inspectElement) public static void ShowDevTools(this IWebBrowser browser, IWindowInfo windowInfo = null, int inspectElementAtX = 0, int inspectElementAtY = 0) { var cefBrowser = browser.GetBrowser(); @@ -788,7 +813,7 @@ namespace CefSharp /// /// Explicitly close the developer tools window if one exists for this browser instance. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void CloseDevTools(this IBrowser cefBrowser) { var host = cefBrowser.GetHost(); @@ -800,7 +825,7 @@ namespace CefSharp /// /// Explicitly close the developer tools window if one exists for this browser instance. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. public static void CloseDevTools(this IWebBrowser browser) { var cefBrowser = browser.GetBrowser(); @@ -809,10 +834,9 @@ namespace CefSharp } /// - /// If a misspelled word is currently selected in an editable node calling - /// this method will replace it with the specified word. + /// If a misspelled word is currently selected in an editable node calling this method will replace it with the specified word. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. /// The new word that will replace the currently selected word. public static void ReplaceMisspelling(this IBrowser cefBrowser, string word) { @@ -823,10 +847,9 @@ namespace CefSharp } /// - /// If a misspelled word is currently selected in an editable node calling - /// this method will replace it with the specified word. + /// If a misspelled word is currently selected in an editable node calling this method will replace it with the specified word. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. /// The new word that will replace the currently selected word. public static void ReplaceMisspelling(this IWebBrowser browser, string word) { @@ -839,7 +862,7 @@ namespace CefSharp /// /// Add the specified word to the spelling dictionary. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. /// The new word that will be added to the dictionary. public static void AddWordToDictionary(this IBrowser cefBrowser, string word) { @@ -850,10 +873,12 @@ namespace CefSharp } /// - /// Shortcut method to get the browser IBrowserHost + /// Shortcut method to get the browser IBrowserHost. /// - /// The ChromiumWebBrowser instance this method extends - /// browserHost or null + /// The ChromiumWebBrowser instance this method extends. + /// + /// browserHost or null. + /// public static IBrowserHost GetBrowserHost(this IWebBrowser browser) { var cefBrowser = browser.GetBrowser(); @@ -864,7 +889,7 @@ namespace CefSharp /// /// Add the specified word to the spelling dictionary. /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. /// The new word that will be added to the dictionary. public static void AddWordToDictionary(this IWebBrowser browser, string word) { @@ -944,12 +969,12 @@ namespace CefSharp } /// - /// Send a mouse move event to the browser + /// Send a mouse move event to the browser. /// /// browserHost. /// The x coordinate relative to upper-left corner of view. /// The y coordinate relative to upper-left corner of view. - /// mouse leave + /// mouse leave. /// The modifiers. public static void SendMouseMoveEvent(this IBrowserHost host, int x, int y, bool mouseLeave, CefEventFlags modifiers) { @@ -991,30 +1016,34 @@ namespace CefSharp } /// - /// Evaluate some Javascript code in the context of this WebBrowser. The script will be executed asynchronously and the - /// method returns a Task encapsulating the response from the Javascript - /// This simple helper extension will encapsulate params in single quotes (unless int, uint, etc) + /// Evaluate some Javascript code in the context of this WebBrowser. The script will be executed asynchronously and the method + /// returns a Task encapsulating the response from the Javascript This simple helper extension will encapsulate params in single + /// quotes (unless int, uint, etc) /// - /// The ChromiumWebBrowser instance this method extends - /// The javascript method name to execute - /// the arguments to be passed as params to the method - /// that can be awaited to perform the script execution + /// The ChromiumWebBrowser instance this method extends. + /// The javascript method name to execute. + /// the arguments to be passed as params to the method. + /// + /// that can be awaited to perform the script execution. + /// public static Task EvaluateScriptAsync(this IWebBrowser browser, string methodName, params object[] args) { return browser.EvaluateScriptAsync(null, methodName, args); } /// - /// Evaluate some Javascript code in the context of this WebBrowser using the specified timeout. The script will be executed asynchronously and the - /// method returns a Task encapsulating the response from the Javascript - /// This simple helper extension will encapsulate params in single quotes (unless int, uint, etc). + /// Evaluate some Javascript code in the context of this WebBrowser using the specified timeout. The script will be executed + /// asynchronously and the method returns a Task encapsulating the response from the Javascript This simple helper extension will + /// encapsulate params in single quotes (unless int, uint, etc). /// - /// The ChromiumWebBrowser instance this method extends + /// The ChromiumWebBrowser instance this method extends. /// The timeout after which the Javascript code execution should be aborted. - /// The javascript method name to execute - /// the arguments to be passed as params to the method. Args are encoded using , - /// you can provide a custom implementation if you require a custom implementation - /// that can be awaited to perform the script execution + /// The javascript method name to execute. + /// the arguments to be passed as params to the method. Args are encoded using + /// , you can provide a custom implementation if you require a custom implementation. + /// + /// that can be awaited to perform the script execution. + /// public static Task EvaluateScriptAsync(this IWebBrowser browser, TimeSpan? timeout, string methodName, params object[] args) { var script = GetScriptForJavascriptMethodWithArgs(methodName, args); @@ -1036,10 +1065,14 @@ namespace CefSharp /// /// Function used to encode the params passed to , - /// and - /// Provide your own custom function to perform custom encoding. You can use your choice - /// of JSON encoder here if you should so choose. + /// and + /// + /// Provide your own custom function to perform custom encoding. You can use your choice of JSON encoder here if you should so + /// choose. /// + /// + /// A function delegate that yields a string. + /// public static Func EncodeScriptParam { get; set; } = (str) => { return str.Replace("\\", "\\\\") @@ -1050,10 +1083,12 @@ namespace CefSharp }; /// - /// Checks if the given object is a numerical object + /// Checks if the given object is a numerical object. /// - /// The object to check - /// True if numeric, otherwise false + /// The object to check. + /// + /// True if numeric, otherwise false. + /// private static bool IsNumeric(this object value) { return value is sbyte @@ -1070,11 +1105,14 @@ namespace CefSharp } /// - /// Transforms the methodName and arguments into valid Javascript code. Will encapsulate params in single quotes (unless int, uint, etc) + /// Transforms the methodName and arguments into valid Javascript code. Will encapsulate params in single quotes (unless int, + /// uint, etc) /// - /// The javascript method name to execute - /// the arguments to be passed as params to the method - /// The Javascript code + /// The javascript method name to execute. + /// the arguments to be passed as params to the method. + /// + /// The Javascript code. + /// public static string GetScriptForJavascriptMethodWithArgs(string methodName, object[] args) { var stringBuilder = new StringBuilder(); @@ -1117,6 +1155,11 @@ namespace CefSharp return stringBuilder.ToString(); } + /// + /// An IWebBrowser extension method that throw exception if browser not initialized. + /// + /// Thrown when an exception error condition occurs. + /// The ChromiumWebBrowser instance this method extends. internal static void ThrowExceptionIfBrowserNotInitialized(this IWebBrowser browser) { if (!browser.IsBrowserInitialized) @@ -1127,6 +1170,11 @@ namespace CefSharp } } + /// + /// An IWebBrowser extension method that throw exception if disposed. + /// + /// Thrown when a supplied object has been disposed. + /// The ChromiumWebBrowser instance this method extends. internal static void ThrowExceptionIfDisposed(this IWebBrowser browser) { if (browser.IsDisposed) @@ -1135,6 +1183,11 @@ namespace CefSharp } } + /// + /// Throw exception if frame null. + /// + /// Thrown when an exception error condition occurs. + /// The instance this method extends. private static void ThrowExceptionIfFrameNull(IFrame frame) { if (frame == null) @@ -1143,6 +1196,11 @@ namespace CefSharp } } + /// + /// An IBrowser extension method that throw exception if browser null. + /// + /// Thrown when an exception error condition occurs. + /// The ChromiumWebBrowser instance this method extends. private static void ThrowExceptionIfBrowserNull(this IBrowser browser) { if (browser == null) @@ -1151,6 +1209,11 @@ namespace CefSharp } } + /// + /// Throw exception if browser host null. + /// + /// Thrown when an exception error condition occurs. + /// The browser host. private static void ThrowExceptionIfBrowserHostNull(IBrowserHost browserHost) { if (browserHost == null) @@ -1159,6 +1222,10 @@ namespace CefSharp } } + /// + /// Throw exception if can execute javascript in main frame false. + /// + /// Thrown when an exception error condition occurs. private static void ThrowExceptionIfCanExecuteJavascriptInMainFrameFalse() { throw new Exception("Unable to execute javascript at this time, scripts can only be executed within a V8Context. " +