public override bool OnContextMenuCommand(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags) { var webBrowser = (ChromiumWebBrowser)chromiumWebBrowser; var linkUrl = parameters.LinkUrl; var selectionText = parameters.SelectionText; switch (commandId) { case CefMenuCommand.ViewSource: { webBrowser.Invoke(new Action(() => { ViewSourceWindow.Show(webBrowser.Address); })); return(true); } case Search: { webBrowser.Invoke(new Action(() => { BrowserWindow.Show(SearchEngineUtil.GetUrl(selectionText, GlobalData.Settings.SearchEngine)); })); return(true); } case OpenInNewWindow: { webBrowser.Invoke(new Action(() => { BrowserWindow.Show(linkUrl); })); return(true); } default: { return(false); } } }
public void ViewSource(string url) { ViewSourceWindow.Show(url); }