protected override void OnRenderProcessTerminated(CefBrowser browser, CefTerminationStatus status) { var e = new RenderProcessTerminatedEventArgs(browser, status); _owner.InvokeIfRequired(() => _owner.OnRenderProcessTerminated(e)); _owner.WebView.ProcessMessageBridge.OnRenderProcessTerminated(browser); if (e.ShouldTryResetProcess && status != CefTerminationStatus.Termination) { //browser.Reload(); //browser.Reload(); // System.Windows.Forms.MessageBox.Show(browser.GetMainFrame().Url); if (!browser.GetMainFrame().Url.Contains("?fromCustormBrowser=1")) { browser.GetMainFrame().LoadUrl(browser.GetMainFrame().Url + "?fromCustormBrowser=1"); } else { browser.GetMainFrame().LoadUrl(browser.GetMainFrame().Url); } _owner.AttachChromeWidgetMessageHandler(); } }
public void ExecuteJavaScript(string script) { if (_browser != null) { _browser.GetMainFrame().ExecuteJavaScript(script, null, 0); } }
internal void DoLoadURL(string url) { using (var mainFrame = FBrowser.GetMainFrame()) { mainFrame.LoadURL(url); } }
protected override void OnLoadStart(CefBrowser browser, CefFrame frame, CefTransitionType transitionType) { if (frame.IsMain) { client.UrlChange(browser.GetMainFrame().Url); Logger.Debug($"START: {browser.GetMainFrame().Url}"); } }
public InternalHandle copy(V8Engine engine, bool isConstructCall, InternalHandle _this, InternalHandle[] args) { if (browser != null) { browser.GetMainFrame().Copy(); } return(Engine.CreateNullValue()); }
public void LoadURL(string url) { // Remove leading whitespace from the URL string url2 = url.TrimStart(); if (browser != null) { browser.GetMainFrame().LoadUrl(url2); } }
public void eval(string code) { if (!_localMode) { return; } if (!CefUtil.DISABLE_CEF) { _browser.GetMainFrame().ExecuteJavaScript(code, null, 0); } }
public void LoadURL(string url) { // Remove leading whitespace from the URL string url2 = url.TrimStart(); if (string.IsNullOrEmpty(url2)) { url2 = "about:blank"; } browser?.GetMainFrame().LoadUrl(url2); }
public void ExecuteScript(string script) { CefFrame frame = _browser?.GetMainFrame(); if (frame == null) { Logger.Instance.Log.Error("Mainframe is nullt."); return; } frame.ExecuteJavaScript(script, null, 0); }
public object ExecuteScript(string script) { var frame = _browser?.GetMainFrame(); if (frame == null) { Logger.Instance.Log.LogWarning("Cannot accces main frame."); return(null); } frame.ExecuteJavaScript(script, null, 0); return(null); }
public DXResource <EX9.Texture, CefBrowser> RenderString( out XDocument dom, out XElement rootElement, out bool isLoading, out string currentUrl, out string errorText, string baseUrl = DEFAULT_URL, string html = null, bool reload = false, int width = DEFAULT_WIDTH, int height = DEFAULT_HEIGHT, double zoomLevel = 0, MouseState mouseState = default(MouseState), KeyboardState keyboardState = default(KeyboardState), Vector2D scrollTo = default(Vector2D), string javaScript = null, bool executeJavaScript = false, bool enabled = true ) { if (!CheckState(out dom, out rootElement, out isLoading, out currentUrl, out errorText, enabled)) { return(FTextureResource); } SetDimensions(width, height); if (FUrl != baseUrl || FHtml != html) { FUrl = baseUrl; FHtml = html ?? string.Empty; using (var mainFrame = FBrowser.GetMainFrame()) { byte[] utf8bytes = Encoding.Default.GetBytes(html); html = Encoding.UTF8.GetString(utf8bytes); mainFrame.LoadString(html, baseUrl); } } if (reload) { FBrowser.Reload(); } SetZoomLevel(zoomLevel); SendEvents(mouseState, keyboardState); SetScroll(scrollTo); DoJavaScript(executeJavaScript, javaScript); return(FTextureResource); }
public void NavigateTo(string url) { // Remove leading whitespace from the URL url = url.TrimStart(); if (_browser != null) { _browser.GetMainFrame().LoadUrl(url); } else { StartUrl = url; } }
public void NavigateTo(Uri uri) { // Remove leading whitespace from the URL var url = uri.AbsoluteUri.TrimStart(); if (_browser != null) { _browser.GetMainFrame().LoadUrl(url); } else { StartUrl = url; } }
protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { if (frame.IsMain) { Logger.Debug($"END: {browser.GetMainFrame().Url}, {httpStatusCode}"); } }
private Task <IWebBrowserWindowProvider> InitTask(string fullpath, IWebSessionLogger logger) { TaskCompletionSource <IWebBrowserWindowProvider> tcs = new TaskCompletionSource <IWebBrowserWindowProvider>(); Task.Run(async() => { var cefWindowInfo = CefWindowInfo.Create(); cefWindowInfo.SetAsWindowless(IntPtr.Zero, true); //// Settings for the browser window itself (e.g. enable JavaScript?). var cefBrowserSettings = new CefBrowserSettings(); // Initialize some the cust interactions with the browser process. var cefClient = new TestCefClient(); // Start up the browser instance. CefBrowserHost.CreateBrowser(cefWindowInfo, cefClient, cefBrowserSettings, fullpath); _CefBrowser = await cefClient.GetLoadedBrowserAsync(); _CefFrame = _CefBrowser.GetMainFrame(); _TestCefGlueHTMLWindowProvider = new TestCefGlueHTMLWindowProvider(_CefFrame, cefClient); tcs.SetResult(_TestCefGlueHTMLWindowProvider); }); return(tcs.Task); }
protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { if (frame.IsMain) { Debug.Log(string.Format("END: {0}, {1}", browser.GetMainFrame().Url, httpStatusCode.ToString())); } }
protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { if (frame.IsMain) { Console.WriteLine("END: {0}, {1}", browser.GetMainFrame().Url, httpStatusCode); } }
protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { //if (frame.IsMain) { LogManager.CefLog(string.Format("-> End: {0}, {1}", browser.GetMainFrame().Url, httpStatusCode)); } }
protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { if (frame.IsMain) { LogUtilility.LogI("END: {0}, {1}", browser.GetMainFrame().Url, httpStatusCode.ToString()); } }
public void LoadUrl(string url) { if (bs != null) { bs.GetMainFrame().LoadUrl(url); } }
public static Task <string> GetSourceAsync(this CefBrowser browser) { TaskStringVisitor taskStringVisitor = new TaskStringVisitor(); browser.GetMainFrame().GetSource(taskStringVisitor); return(taskStringVisitor.Task); }
protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { //if (frame.IsMain) { LogManager.CefLog($"-> End: {browser.GetMainFrame().Url}, {httpStatusCode}"); } }
protected override void OnLoadStart(CefBrowser browser, CefFrame frame) { this.Browser = browser; try { //通知事件创建完毕 cef browser 对象 if (null != this.BrowserCreated) { this.BrowserCreated.Invoke(this, new BrowserCreatedEventArgs { Browser = browser }); } // A single CefBrowser instance can handle multiple requests // for a single URL if there are frames (i.e. <FRAME>, <IFRAME>). if (frame.IsMain) { Console.WriteLine("START: {0}", browser.GetMainFrame().Url); } } catch (Exception ex) { throw ex; } }
protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { if (httpStatusCode == 200 && browser.GetMainFrame().Url == frame.Url) { _core.LoadEnd(browser, frame); } }
protected override void OnLoadStart(CefBrowser browser, CefFrame frame) { if (browser.GetMainFrame().Url == frame.Url) { _core.LoadStart(browser, frame); } }
public static CefBrowser Clone(this CefBrowser browser) { if (browser == null) { throw new ArgumentNullException("browser"); } return(browser.GetMainFrame().Browser); }
protected override void OnLoadStart(CefBrowser browser, CefFrame frame) { // A single CefBrowser instance can handle multiple requests // for a single URL if there are frames (i.e. <FRAME>, <IFRAME>). if (frame.IsMain) { Console.WriteLine("START: {0}", browser.GetMainFrame().Url); } }
protected override void OnLoadStart(CefBrowser browser, CefFrame frame, CefTransitionType transitionType) { // A single CefBrowser instance can handle multiple requests // for a single URL if there are frames (i.e. <FRAME>, <IFRAME>). //if (frame.IsMain) { LogManager.CefLog("-> Start: " + browser.GetMainFrame().Url); } }
protected override bool OnBeforePopup(CefBrowser browser, CefFrame frame, string targetUrl, string targetFrameName, CefWindowOpenDisposition targetDisposition, bool userGesture, CefPopupFeatures popupFeatures, CefWindowInfo windowInfo, ref CefClient client, CefBrowserSettings settings, ref bool noJavascriptAccess) { // Block a new popup window. // Instead just redirect the popup target to the current browser. browser.GetMainFrame().LoadUrl(targetUrl); return(true); }
protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) { if (frame.IsMain) { Console.WriteLine("END: {0}, {1}", browser.GetMainFrame().Url, httpStatusCode); } if (this.LoadEnd != null) { this.LoadEnd.Invoke(this, new LoadEndEventArgs(frame, httpStatusCode)); } }
internal void Attach(CefBrowser browser) { if (this.browser != null) { throw new InvalidOperationException("Browser already attached."); } this.browser = browser; this.windowHandle = browser.WindowHandle; this.ClearFrames(); this.AttachMainFrame(browser.GetMainFrame()); this.OnCreated(); }