示例#1
0
 protected override bool DoClose(CefBrowser browser)
 {
     Debug.WriteLine(DBGPREFIX + "DoClose");
     // Returning false will send a top level browser close event? guess that is why the labview window closed?
     // Sure does, need to return true and figure out more about the workflow
     return true;
 }
示例#2
0
        protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            if (DumpProcessMessages)
            {
                Console.WriteLine("Client::OnProcessMessageReceived: SourceProcess={0}", sourceProcess);
                Console.WriteLine("Message Name={0} IsValid={1} IsReadOnly={2}", message.Name, message.IsValid, message.IsReadOnly);
                var arguments = message.Arguments;
                for (var i = 0; i < arguments.Count; i++)
                {
                    var type = arguments.GetValueType(i);
                    object value;
                    switch (type)
                    {
                        case CefValueType.Null: value = null; break;
                        case CefValueType.String: value = arguments.GetString(i); break;
                        case CefValueType.Int: value = arguments.GetInt(i); break;
                        case CefValueType.Double: value = arguments.GetDouble(i); break;
                        case CefValueType.Bool: value = arguments.GetBool(i); break;
                        default: value = null; break;
                    }

                    Console.WriteLine("  [{0}] ({1}) = {2}", i, type, value);
                }
            }

            var handled = DemoApp.BrowserMessageRouter.OnProcessMessageReceived(browser, sourceProcess, message);
            if (handled) return true;

            if (message.Name == "myMessage2" || message.Name == "myMessage3") return true;

            return false;
        }
        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 bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            if (!this.loggingService.IsDebugEnabled)
            {
                return false;
            }

            this.loggingService.Debug("Client::OnProcessMessageReceived: SourceProcess={0}", sourceProcess);
            this.loggingService.Debug("Message Name={0} IsValid={1} IsReadOnly={2}", message.Name, message.IsValid, message.IsReadOnly);
            var arguments = message.Arguments;
            for (var i = 0; i < arguments.Count; i++)
            {
                var type = arguments.GetValueType(i);
                object value;
                switch (type)
                {
                    case CefValueType.Null: value = null; break;
                    case CefValueType.String: value = arguments.GetString(i); break;
                    case CefValueType.Int: value = arguments.GetInt(i); break;
                    case CefValueType.Double: value = arguments.GetDouble(i); break;
                    case CefValueType.Bool: value = arguments.GetBool(i); break;
                    default: value = null; break;
                }

                this.loggingService.Debug("  [{0}] ({1}) = {2}", i, type, value);
            }

            return false;
        }
 public ConsoleMessageEventArgs(CefBrowser browser, string message, string source, int line)
 {
     this.CefBrowser = browser;
     this.Message = message;
     this.Source = source;
     this.Line = line;
 }
示例#6
0
 protected override void OnAddressChange( CefBrowser browser, CefFrame frame, string url )
 {
     if( frame.IsMain )
     {
         owner.OnAddressChanged( url );
     }
 }
		protected override void OnBeforeClose(CefBrowser browser)
		{
			if (_core.InvokeRequireOnUi())
                _core.MainUiDispatcher.BeginInvoke((Action)_core.OnBeforeClose);
			else
				_core.OnBeforeClose();
		}
        protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            Console.WriteLine("Render::OnProcessMessageReceived: SourceProcess={0}", sourceProcess);
            Console.WriteLine("Message Name={0} IsValid={1} IsReadOnly={2}", message.Name, message.IsValid, message.IsReadOnly);
            var arguments = message.Arguments;
            for (var i = 0; i < arguments.Count; i++)
            {
                var type = arguments.GetValueType(i);
                object value;
                switch (type)
                {
                    case CefValueType.Null: value = null; break;
                    case CefValueType.String: value = arguments.GetString(i); break;
                    case CefValueType.Int: value = arguments.GetInt(i); break;
                    case CefValueType.Double: value = arguments.GetDouble(i); break;
                    case CefValueType.Bool: value = arguments.GetBool(i); break;
                    default: value = null; break;
                }

                Console.WriteLine("  [{0}] ({1}) = {2}", i, type, value);
            }

            if (message.Name == "myMessage2") return true;

            var message2 = CefProcessMessage.Create("myMessage2");
            var success = browser.SendProcessMessage(CefProcessId.Renderer, message2);
            Console.WriteLine("Sending myMessage2 to renderer process = {0}", success);

            var message3 = CefProcessMessage.Create("myMessage3");
            var success2 = browser.SendProcessMessage(CefProcessId.Browser, message3);
            Console.WriteLine("Sending myMessage3 to browser process = {0}", success);

            return false;
        }
 protected override void OnLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode)
 {
     if (OnLoadEndEvent != null)
     {
         OnLoadEndEvent(browser, frame, httpStatusCode);
     }
 }
示例#10
0
 public OnGetResourceHandlerEventArgs(string _id, CefBrowser _browser, CefFrame _frame, CefRequest _request)
 {
     id = _id;
     browser = _browser;
     frame = _frame;
     request = _request;
     DelegateRequest = false; //Default do not delegate, allow CEF to handle using network
 }
示例#11
0
 protected override void OnCursorChange( CefBrowser browser, IntPtr cursorHandle )
 {
     //_uiHelper.PerformInUiThread(() =>
     //{
     //    Cursor cursor = CursorInteropHelper.Create(new SafeFileHandle(cursorHandle, false));
     //    _owner.Cursor = cursor;
     //});
 }
        public BrowserWrapper()
        {
            Status = BrowserStatus.Initial;

            hasPendingClose = false;
            browserClient = null;
            browser = null;
        }
示例#13
0
        protected override void OnLoadStart(CefBrowser browser, CefFrame frame)
        {
            base.OnLoadStart(browser, frame);

            var message = CefProcessMessage.Create("SetOverlayAPI");
            message.Arguments.SetString(0, frame.Name);
            browser.SendProcessMessage(CefProcessId.Renderer, message);
        }
        protected override bool GetRootScreenRect(CefBrowser browser, ref CefRectangle rect)
        {
            rect.X = 0;
            rect.Y = 0;
            rect.Width = this.screenWidth;
            rect.Height = this.screenHeight;

            return true;
        }
        protected override bool GetScreenInfo(CefBrowser browser, CefScreenInfo screenInfo)
        {
            var rect = screenInfo.Rectangle;
            this.GetRootScreenRect(browser, ref rect);
            screenInfo.Depth = 32;
            screenInfo.IsMonochrome = false;

            return true;
        }
 protected override void OnStatusMessage(CefBrowser browser, string value)
 {
     if (browser == null)
     {
         API.Instance.Log("Browser null: invalid OnStatusMessage.");
         return;
     }
     API.Instance.Log("Browser {0}: Status message: {1}", browser.Identifier, value);
 }
 protected override bool OnConsoleMessage(CefBrowser browser, string message, string source, int line)
 {
     if (browser == null)
     {
         API.Instance.Log("Browser null: invalid OnConsoleMessage.");
         return false;
     }
     API.Instance.Log("Browser {0}: {1} @{2}{3}", browser.Identifier, message, source, line);
     return false;
 }
        protected override void OnPaint(CefBrowser browser, CefPaintElementType type, CefRectangle[] dirtyRects, IntPtr buffer, int width, int height)
        {
            if (type != CefPaintElementType.View)
            {
                // Only want to paint the view
                return;
            }

            this.core.OnPaint(buffer);
        }
 protected override bool OnConsoleMessage(CefBrowser browser, string message, string source, int line)
 {
     var consoleArgs = new ConsoleMessageArgs(message, source, line);
     if (ConsoleMessage==null)
     {
         Trace.WriteLine(consoleArgs);
     }
     ConsoleMessage?.Invoke(this, consoleArgs);
     return false;
 }
        protected override bool OnBeforeNavigation(CefBrowser browser, CefFrame frame, CefRequest request, CefNavigationType navigationType, bool isRedirect)
        {
            Console.WriteLine("OnBeforeNavigation: Request.Url={0} NavigationType={1} IsRedirect={2}",
                request.Url,
                navigationType,
                isRedirect
                );

            return false;
        }
示例#21
0
 internal OnQueryEventArgs(CefBrowser _browser, CefFrame _frame, long _queryId, string _request, bool _persistent, CefMessageRouterBrowserSide.Callback _callback)
 {
     browser = _browser;
     frame = _frame;
     queryId = _queryId;
     request = _request;
     persistent = _persistent;
     callback = _callback;
     Handled = false; //default return value
 }
            protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
            {
                if (message.Name == "renderProcessIdRequest")
                {
                    CefProcessMessage response = CefProcessMessage.Create("renderProcessIdResponse");
                    response.Arguments.SetInt(0, Process.GetCurrentProcess().Id);
                    browser.SendProcessMessage(CefProcessId.Browser, response);
                }

                return false;
            }
 internal void Associate(CefBrowser browser, CefFrame frame, CefV8Context context)
 {
     var webView = new CefV8_WebView(context,context.GetTaskRunner());
     var taskCompletionSource =  _TaskCompletionSources.GetOrDefault(frame.Identifier);  
     if (taskCompletionSource!=null)
     {
         _TaskCompletionSources.Remove(frame.Identifier);
         taskCompletionSource.TrySetResult(webView);
     }
     _Associated.Add(frame.Identifier, webView);  
 }
示例#24
0
文件: Form1.cs 项目: qipa/ILBC
 private void Browser_ProcessMessageReceived(Xilium.CefGlue.CefBrowser browser, Xilium.CefGlue.CefProcessId sourceProcess, Xilium.CefGlue.CefProcessMessage message)
 {
     if (message.Name == "OpenSaveFileDialog")
     {
         BeginInvoke(new Action(() => { saveFileDialog1.ShowDialog(); }));
     }
     else
     {
         this.BeginInvoke(new Action(() =>
                                     { MessageBox.Show("未知的消息 from Render Process ,消息名字“" + message.Name + "”。"); }));
     }
 }
示例#25
0
        protected override bool OnBeforePopup( CefBrowser browser, CefFrame frame, string targetUrl, string targetFrameName, CefPopupFeatures popupFeatures, CefWindowInfo windowInfo, ref CefClient client, CefBrowserSettings settings, ref bool noJavascriptAccess )
        {
            var e = new BeforePopupEventArgs( frame, targetUrl, targetFrameName, popupFeatures, windowInfo, client, settings,
                     noJavascriptAccess );

            this.owner.OnBeforePopup( e );

            client = e.Client;
            noJavascriptAccess = e.NoJavascriptAccess;

            return e.Handled;
        }
示例#26
0
        public override bool OnQuery(CefBrowser browser, CefFrame frame, long queryId, string request, bool persistent, CefMessageRouterBrowserSide.Callback callback)
        {
            Debug.WriteLine(DBGPREFIX + "OnQuery called, [" + queryId + " " + (persistent ? "" : "not" + " persistent]: ") + request);
	        var handler = OnQueryEvent;
	        if (handler != null)
	        {
                Debug.WriteLine(DBGPREFIX + "OnQuery Delegate");
		        var e = new OnQueryEventArgs(browser, frame, queryId, request, persistent, callback);
		        handler(this, e);
                return e.Handled;
	        }
            return false;
        }
        private CefFrame GetFrameByName(CefBrowser browser, string frameName)
        {
            CefFrame frame = null;
            if (frameName == null)
            {
                frame = browser.GetMainFrame();
            }
            else
            {
                frame = browser.GetFrame(frameName);
            }

            return frame;
        }
        protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            if (message.Name == "renderProcessIdResponse")
            {
                int renderProcessId = message.Arguments.GetInt(0);
                BrowserWrapper browserWrapper;
                if (BrowserManager.Instance.TryGetBrowser(
                    browser.Identifier, out browserWrapper))
                {
                    browserWrapper.UpdateRenderProcessId(renderProcessId);
                }
            }

            return false;
        }
示例#29
0
        protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            Debug.WriteLine(DBGPREFIX + "OnProcessMessageReceived: " + message.ToString());
            var isHandled = _messageRouter.OnProcessMessageReceived(browser, sourceProcess, message);
            if (isHandled)
                return true;

	        var handler = OnProcessMessageReceivedEvent;
            if (handler != null)
            {
                Debug.WriteLine(DBGPREFIX + "OnProcessMessageReceived Delegate");
                var e = new OnProcessMessageReceivedEventArgs(browser, sourceProcess, message);
                handler(this, e);
                return e.Handled;
            }
            return false;
        }
        protected override void OnPaint(CefBrowser browser, CefPaintElementType type, CefRectangle[] dirtyRects, IntPtr buffer, int width, int height)
        {
            _logger.Debug("Type: {0} Buffer: {1:X8} Width: {2} Height: {3}", type, buffer, width, height);
            foreach (var rect in dirtyRects)
            {
                _logger.Debug("   DirtyRect: X={0} Y={1} W={2} H={3}", rect.X, rect.Y, rect.Width, rect.Height);
            }

            if (type == CefPaintElementType.View)
            {
                _owner.HandleViewPaint(browser, type, dirtyRects, buffer, width, height);
            }
            else if (type == CefPaintElementType.Popup)
            {
                _owner.HandlePopupPaint(width, height, dirtyRects, buffer);
            }
        }
示例#31
0
        protected override void OnAfterCreated(CefBrowser browser)
        {
            Debug.WriteLine(DBGPREFIX + "OnAfterCreated");
            //Need to be called on ui thread?
            //yes
            _lvCefControl.InvokeIfRequired(() =>
            {
                _lvCefControl.Browser = browser;
            });

	        var handler = OnAfterCreatedEvent;
	        if (handler != null)
	        {
                Debug.WriteLine(DBGPREFIX + "OnAfterCreated Delegate");
		        var e = new OnAfterCreatedEventArgs(browser);
		        handler(this, e);
	        }
        }
示例#32
0
 /// <summary>
 /// Called on the UI thread before OnBeforeBrowse in certain limited cases
 /// where navigating a new or different browser might be desirable. This
 /// includes user-initiated navigation that might open in a special way (e.g.
 /// links clicked via middle-click or ctrl + left-click) and certain types of
 /// cross-origin navigation initiated from the renderer process (e.g.
 /// navigating the top-level frame to/from a file URL). The |browser| and
 /// |frame| values represent the source of the navigation. The
 /// |target_disposition| value indicates where the user intended to navigate
 /// the browser based on standard Chromium behaviors (e.g. current tab,
 /// new tab, etc). The |user_gesture| value will be true if the browser
 /// navigated via explicit user gesture (e.g. clicking a link) or false if it
 /// navigated automatically (e.g. via the DomContentLoaded event). Return true
 /// to cancel the navigation or false to allow the navigation to proceed in the
 /// source browser's top-level frame.
 /// </summary>
 protected virtual bool OnOpenUrlFromTab(CefBrowser browser, CefFrame frame, string targetUrl, CefWindowOpenDisposition targetDisposition, bool userGesture)
 {
     return(false);
 }
示例#33
0
 /// <summary>
 /// Returns the hosted browser object.
 /// </summary>
 public CefBrowser GetBrowser()
 {
     return(CefBrowser.FromNative(cef_browser_host_t.get_browser(_self)));
 }
示例#34
0
 /// <summary>
 /// Called on the IO thread when receiving a network request with a
 /// "Set-Cookie" response header value represented by |cookie|. Return true to
 /// allow the cookie to be stored or false to block the cookie. The |request|
 /// object should not be modified in this callback.
 /// </summary>
 protected virtual bool CanSetCookie(CefBrowser browser, CefFrame frame, CefRequest request, CefCookie cookie)
 {
     return(true);
 }
示例#35
0
 /// <summary>
 /// Called to retrieve the translation from view coordinates to actual screen
 /// coordinates. Return true if the screen coordinates were provided.
 /// </summary>
 protected virtual bool GetScreenPoint(CefBrowser browser, int viewX, int viewY, ref int screenX, ref int screenY)
 {
     return(false);
 }
示例#36
0
 /// <summary>
 /// Called when the browser wants to move or resize the popup widget. |rect|
 /// contains the new location and size.
 /// </summary>
 protected abstract void OnPopupSize(CefBrowser browser, CefRectangle rect);
示例#37
0
 /// <summary>
 /// Called when the browser wants to show or hide the popup widget. The popup
 /// should be shown if |show| is true and hidden if |show| is false.
 /// </summary>
 protected virtual void OnPopupShow(CefBrowser browser, bool show)
 {
 }
示例#38
0
 /// <summary>
 /// Called when a browser has recieved a request to close. This may result
 /// directly from a call to CefBrowserHost::*CloseBrowser() or indirectly if
 /// the browser is parented to a top-level window created by CEF and the user
 /// attempts to close that window (by clicking the 'X', for example). The
 /// DoClose() method will be called after the JavaScript 'onunload' event has
 /// been fired.
 /// An application should handle top-level owner window close notifications by
 /// calling CefBrowserHost::TryCloseBrowser() or
 /// CefBrowserHost::CloseBrowser(false) instead of allowing the window to close
 /// immediately (see the examples below). This gives CEF an opportunity to
 /// process the 'onbeforeunload' event and optionally cancel the close before
 /// DoClose() is called.
 /// When windowed rendering is enabled CEF will internally create a window or
 /// view to host the browser. In that case returning false from DoClose() will
 /// send the standard close notification to the browser's top-level owner
 /// window (e.g. WM_CLOSE on Windows, performClose: on OS X, "delete_event" on
 /// Linux or CefWindowDelegate::CanClose() callback from Views). If the
 /// browser's host window/view has already been destroyed (via view hierarchy
 /// tear-down, for example) then DoClose() will not be called for that browser
 /// since is no longer possible to cancel the close.
 /// When windowed rendering is disabled returning false from DoClose() will
 /// cause the browser object to be destroyed immediately.
 /// If the browser's top-level owner window requires a non-standard close
 /// notification then send that notification from DoClose() and return true.
 /// The CefLifeSpanHandler::OnBeforeClose() method will be called after
 /// DoClose() (if DoClose() is called) and immediately before the browser
 /// object is destroyed. The application should only exit after OnBeforeClose()
 /// has been called for all existing browsers.
 /// The below examples describe what should happen during window close when the
 /// browser is parented to an application-provided top-level window.
 /// Example 1: Using CefBrowserHost::TryCloseBrowser(). This is recommended for
 /// clients using standard close handling and windows created on the browser
 /// process UI thread.
 /// 1.  User clicks the window close button which sends a close notification to
 /// the application's top-level window.
 /// 2.  Application's top-level window receives the close notification and
 /// calls TryCloseBrowser() (which internally calls CloseBrowser(false)).
 /// TryCloseBrowser() returns false so the client cancels the window close.
 /// 3.  JavaScript 'onbeforeunload' handler executes and shows the close
 /// confirmation dialog (which can be overridden via
 /// CefJSDialogHandler::OnBeforeUnloadDialog()).
 /// 4.  User approves the close.
 /// 5.  JavaScript 'onunload' handler executes.
 /// 6.  CEF sends a close notification to the application's top-level window
 /// (because DoClose() returned false by default).
 /// 7.  Application's top-level window receives the close notification and
 /// calls TryCloseBrowser(). TryCloseBrowser() returns true so the client
 /// allows the window close.
 /// 8.  Application's top-level window is destroyed.
 /// 9.  Application's OnBeforeClose() handler is called and the browser object
 /// is destroyed.
 /// 10. Application exits by calling CefQuitMessageLoop() if no other browsers
 /// exist.
 /// Example 2: Using CefBrowserHost::CloseBrowser(false) and implementing the
 /// DoClose() callback. This is recommended for clients using non-standard
 /// close handling or windows that were not created on the browser process UI
 /// thread.
 /// 1.  User clicks the window close button which sends a close notification to
 /// the application's top-level window.
 /// 2.  Application's top-level window receives the close notification and:
 /// A. Calls CefBrowserHost::CloseBrowser(false).
 /// B. Cancels the window close.
 /// 3.  JavaScript 'onbeforeunload' handler executes and shows the close
 /// confirmation dialog (which can be overridden via
 /// CefJSDialogHandler::OnBeforeUnloadDialog()).
 /// 4.  User approves the close.
 /// 5.  JavaScript 'onunload' handler executes.
 /// 6.  Application's DoClose() handler is called. Application will:
 /// A. Set a flag to indicate that the next close attempt will be allowed.
 /// B. Return false.
 /// 7.  CEF sends an close notification to the application's top-level window.
 /// 8.  Application's top-level window receives the close notification and
 /// allows the window to close based on the flag from #6B.
 /// 9.  Application's top-level window is destroyed.
 /// 10. Application's OnBeforeClose() handler is called and the browser object
 /// is destroyed.
 /// 11. Application exits by calling CefQuitMessageLoop() if no other browsers
 /// exist.
 /// </summary>
 protected virtual bool DoClose(CefBrowser browser)
 {
     return(false);
 }
示例#39
0
 /// <summary>
 /// Called when the browser window's cursor has changed.
 /// </summary>
 protected abstract void OnCursorChange(CefBrowser browser, IntPtr cursorHandle);
示例#40
0
 /// <summary>
 /// Called on the UI thread before a new popup browser is created. The
 /// |browser| and |frame| values represent the source of the popup request. The
 /// |target_url| and |target_frame_name| values indicate where the popup
 /// browser should navigate and may be empty if not specified with the request.
 /// The |target_disposition| value indicates where the user intended to open
 /// the popup (e.g. current tab, new tab, etc). The |user_gesture| value will
 /// be true if the popup was opened via explicit user gesture (e.g. clicking a
 /// link) or false if the popup opened automatically (e.g. via the
 /// DomContentLoaded event). The |popupFeatures| structure contains additional
 /// information about the requested popup window. To allow creation of the
 /// popup browser optionally modify |windowInfo|, |client|, |settings| and
 /// |no_javascript_access| and return false. To cancel creation of the popup
 /// browser return true. The |client| and |settings| values will default to the
 /// source browser's values. If the |no_javascript_access| value is set to
 /// false the new browser will not be scriptable and may not be hosted in the
 /// same renderer process as the source browser. Any modifications to
 /// |windowInfo| will be ignored if the parent browser is wrapped in a
 /// CefBrowserView. Popup browser creation will be canceled if the parent
 /// browser is destroyed before the popup browser creation completes (indicated
 /// by a call to OnAfterCreated for the popup browser). The |extra_info|
 /// parameter provides an opportunity to specify extra information specific
 /// to the created popup browser that will be passed to
 /// CefRenderProcessHandler::OnBrowserCreated() in the render process.
 /// </summary>
 protected virtual bool OnBeforePopup(CefBrowser browser, CefFrame frame, string targetUrl, string targetFrameName, CefWindowOpenDisposition targetDisposition, bool userGesture, CefPopupFeatures popupFeatures, CefWindowInfo windowInfo, ref CefClient client, CefBrowserSettings settings, ref CefDictionaryValue extraInfo, ref bool noJavascriptAccess)
 {
     return(false);
 }
示例#41
0
 /// <summary>
 /// Called just before a browser is destroyed. Release all references to the
 /// browser object and do not attempt to execute any methods on the browser
 /// object (other than GetIdentifier or IsSame) after this callback returns.
 /// This callback will be the last notification that references |browser| on
 /// the UI thread. Any in-progress network requests associated with |browser|
 /// will be aborted when the browser is destroyed, and
 /// CefResourceRequestHandler callbacks related to those requests may still
 /// arrive on the IO thread after this method is called. See DoClose()
 /// documentation for additional usage information.
 /// </summary>
 protected virtual void OnBeforeClose(CefBrowser browser)
 {
 }
示例#42
0
 /// <summary>
 /// Called on the browser process UI thread when the render process
 /// terminates unexpectedly. |status| indicates how the process
 /// terminated.
 /// </summary>
 protected virtual void OnRenderProcessTerminated(CefBrowser browser, CefTerminationStatus status)
 {
 }
示例#43
0
 /// <summary>
 /// Called on the UI thread when a client certificate is being requested for
 /// authentication. Return false to use the default behavior and automatically
 /// select the first certificate available. Return true and call
 /// CefSelectClientCertificateCallback::Select either in this method or at a
 /// later time to select a certificate. Do not call Select or call it with NULL
 /// to continue without using any certificate. |isProxy| indicates whether the
 /// host is an HTTPS proxy or the origin server. |host| and |port| contains the
 /// hostname and port of the SSL server. |certificates| is the list of
 /// certificates to choose from; this list has already been pruned by Chromium
 /// so that it only contains certificates from issuers that the server trusts.
 /// </summary>
 protected virtual bool OnSelectClientCertificate(CefBrowser browser, bool isProxy, string host, int port, CefX509Certificate[] certificates, CefSelectClientCertificateCallback callback)
 {
     return(false);
 }
示例#44
0
 /// <summary>
 /// Called after a new browser is created. This callback will be the first
 /// notification that references |browser|.
 /// </summary>
 protected virtual void OnAfterCreated(CefBrowser browser)
 {
 }
示例#45
0
 /// <summary>
 /// Called when the user starts dragging content in the web view. Contextual
 /// information about the dragged content is supplied by |drag_data|.
 /// OS APIs that run a system message loop may be used within the
 /// StartDragging call.
 /// Return false to abort the drag operation. Don't call any of
 /// CefBrowserHost::DragSource*Ended* methods after returning false.
 /// Return true to handle the drag operation. Call
 /// CefBrowserHost::DragSourceEndedAt and DragSourceSystemDragEnded either
 /// synchronously or asynchronously to inform the web view that the drag
 /// operation has ended.
 /// </summary>
 protected virtual bool StartDragging(CefBrowser browser, CefDragData dragData, CefDragOperationsMask allowedOps, int x, int y)
 {
     return(false);
 }
示例#46
0
 /// <summary>
 /// Called on the browser process UI thread when a plugin has crashed.
 /// |plugin_path| is the path of the plugin that crashed.
 /// </summary>
 protected virtual void OnPluginCrashed(CefBrowser browser, string pluginPath)
 {
 }
示例#47
0
 /// <summary>
 /// Called on the UI thread to handle requests for URLs with an unknown
 /// protocol component. Set |allow_os_execution| to true to attempt execution
 /// via the registered OS protocol handler, if any.
 /// SECURITY WARNING: YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED
 /// ON SCHEME, HOST OR OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
 /// </summary>
 protected virtual void OnProtocolExecution(CefBrowser browser, string url, out bool allowOSExecution)
 {
     allowOSExecution = true;
 }
示例#48
0
 /// <summary>
 /// Called to retrieve the view rectangle which is relative to screen
 /// coordinates. Return true if the rectangle was provided.
 /// </summary>
 protected virtual bool GetViewRect(CefBrowser browser, ref CefRectangle rect)
 {
     // TODO: return CefRectangle? (Nullable<CefRectangle>) instead of returning bool?
     return(false);
 }
示例#49
0
 /// <summary>
 /// Called when an element should be painted. |type| indicates whether the
 /// element is the view or the popup widget. |buffer| contains the pixel data
 /// for the whole image. |dirtyRects| contains the set of rectangles that need
 /// to be repainted. On Windows |buffer| will be |width|*|height|*4 bytes
 /// in size and represents a BGRA image with an upper-left origin.
 /// </summary>
 protected abstract void OnPaint(CefBrowser browser, CefPaintElementType type, CefRectangle[] dirtyRects, IntPtr buffer, int width, int height);
示例#50
0
 /// <summary>
 /// Called when the scroll offset has changed.
 /// </summary>
 protected abstract void OnScrollOffsetChanged(CefBrowser browser);
示例#51
0
 /// <summary>
 /// Called on the IO thread when JavaScript requests a specific storage quota
 /// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
 /// origin of the page making the request. |new_size| is the requested quota
 /// size in bytes. Return true to continue the request and call
 /// CefRequestCallback::Continue() either in this method or at a later time to
 /// grant or deny the request. Return false to cancel the request immediately.
 /// </summary>
 protected virtual bool OnQuotaRequest(CefBrowser browser, string originUrl, long newSize, CefRequestCallback callback)
 {
     callback.Continue(true);
     return(true);
 }
示例#52
0
 /// <summary>
 /// Called when the web view wants to update the mouse cursor during a
 /// drag & drop operation. |operation| describes the allowed operation
 /// (none, move, copy, link).
 /// </summary>
 protected virtual void UpdateDragCursor(CefBrowser browser, CefDragOperationsMask operation)
 {
 }
示例#53
0
 /// <summary>
 /// Called to allow the client to fill in the CefScreenInfo object with
 /// appropriate values. Return true if the |screen_info| structure has been
 /// modified.
 /// If the screen info rectangle is left empty the rectangle from GetViewRect
 /// will be used. If the rectangle is still empty or invalid popups may not be
 /// drawn correctly.
 /// </summary>
 protected abstract bool GetScreenInfo(CefBrowser browser, CefScreenInfo screenInfo);
示例#54
0
 /// <summary>
 /// Called on the UI thread to handle requests for URLs with an invalid
 /// SSL certificate. Return true and call CefRequestCallback::Continue() either
 /// in this method or at a later time to continue or cancel the request. Return
 /// false to cancel the request immediately. If
 /// CefSettings.ignore_certificate_errors is set all invalid certificates will
 /// be accepted without calling this method.
 /// </summary>
 protected virtual bool OnCertificateError(CefBrowser browser, CefErrorCode certError, string requestUrl, CefSslInfo sslInfo, CefRequestCallback callback)
 {
     return(false);
 }
示例#55
0
 /// <summary>
 /// Called on the IO thread before sending a network request with a "Cookie"
 /// request header. Return true to allow cookies to be included in the network
 /// request or false to block cookies. The |request| object should not be
 /// modified in this callback.
 /// </summary>
 protected virtual bool CanGetCookies(CefBrowser browser, CefFrame frame, CefRequest request)
 {
     return(true);
 }
示例#56
0
 /// <summary>
 /// Called on the UI thread before browser navigation. Return true to cancel
 /// the navigation or false to allow the navigation to proceed. The |request|
 /// object cannot be modified in this callback.
 /// CefLoadHandler::OnLoadingStateChange will be called twice in all cases.
 /// If the navigation is allowed CefLoadHandler::OnLoadStart and
 /// CefLoadHandler::OnLoadEnd will be called. If the navigation is canceled
 /// CefLoadHandler::OnLoadError will be called with an |errorCode| value of
 /// ERR_ABORTED.
 /// </summary>
 protected virtual bool OnBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, bool isRedirect)
 {
     return(false);
 }
示例#57
0
 /// <summary>
 /// Called on the IO thread when the browser needs credentials from the user.
 /// |isProxy| indicates whether the host is a proxy server. |host| contains the
 /// hostname and |port| contains the port number. |realm| is the realm of the
 /// challenge and may be empty. |scheme| is the authentication scheme used,
 /// such as "basic" or "digest", and will be empty if the source of the request
 /// is an FTP server. Return true to continue the request and call
 /// CefAuthCallback::Continue() either in this method or at a later time when
 /// the authentication information is available. Return false to cancel the
 /// request immediately.
 /// </summary>
 protected virtual bool GetAuthCredentials(CefBrowser browser, CefFrame frame, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
 {
     return(false);
 }
示例#58
0
 protected override void OnAfterCreated(Xilium.CefGlue.CefBrowser browser)
 {
     base.OnAfterCreated(browser);
     bClient.Created(browser);
 }
示例#59
0
 /// <summary>
 /// Called on the browser process UI thread when the render view associated
 /// with |browser| is ready to receive/handle IPC messages in the render
 /// process.
 /// </summary>
 protected virtual void OnRenderViewReady(CefBrowser browser)
 {
 }
示例#60
0
 /// <summary>
 /// Called on the IO thread when a resource load has completed. |request| and
 /// |response| represent the request and response respectively and cannot be
 /// modified in this callback. |status| indicates the load completion status.
 /// |received_content_length| is the number of response bytes actually read.
 /// </summary>
 protected virtual void OnResourceLoadComplete(CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response, CefUrlRequestStatus status, long receivedContentLength)
 {
 }