Exemplo n.º 1
0
        public void Stop()
        {
            CefRuntime.PostTask(CefThreadId.UI, BrowserTask.Create(() =>
            {
                if (!isMultiThreadedMessageLoop)
                {
                    CefRuntime.QuitMessageLoop();
                }
            }));

            dispatcher.PostTask(() =>
            {
                CefRuntime.Shutdown();
            });

            dispatcher.Shutdown();

            int browserMapCount = browserMap.Count;

            if (browserMapCount != 0)
            {
                throw new CefRuntimeException(String.Format(
                                                  "After shutting down {0} browser instances were undisposed",
                                                  browserMapCount));
            }

            dispatcher = null;
        }
Exemplo n.º 2
0
 /// <summary>
 /// The platform quit message loop.
 /// </summary>
 protected override void PlatformQuitMessageLoop()
 {
     if (CefRuntime.Platform == CefRuntimePlatform.Windows)
     {
         Application.Quit();
     }
     else
     {
         CefRuntime.QuitMessageLoop();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// The platform quit message loop.
 /// </summary>
 protected override void QuitMessageLoop()
 {
     if (CefRuntime.Platform == CefRuntimePlatform.Windows)
     {
         NativeMethods.Quit();
     }
     else
     {
         CefRuntime.QuitMessageLoop();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// The platform quit message loop.
 /// </summary>
 protected override void QuitMessageLoop()
 {
     if (CefRuntime.Platform == CefRuntimePlatform.Windows)
     {
         _mainWindow?.Exit();
     }
     else
     {
         CefRuntime.QuitMessageLoop();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// The platform quit message loop.
 /// </summary>
 protected override void QuitMessageLoop()
 {
     if (CefRuntime.Platform == CefRuntimePlatform.Windows)
     {
         NativeWindow.Quit(HostConfig.Platform);
     }
     else
     {
         CefRuntime.QuitMessageLoop();
     }
 }
Exemplo n.º 6
0
 public virtual void Exit()
 {
     try
     {
         CefRuntime.QuitMessageLoop();
         gtk_main_quit();
     }
     catch (Exception exception)
     {
         Logger.Instance.Log.LogError("Error in LinuxGtk3Host::Quit");
         Logger.Instance.Log.LogError(exception);
     }
 }
Exemplo n.º 7
0
 protected virtual void QuitCallback()
 {
     try
     {
         CefRuntime.QuitMessageLoop();
         HostClose?.Invoke(this, new CloseEventArgs());
         Environment.Exit(0);
     }
     catch (Exception exception)
     {
         Logger.Instance.Log.LogError("Error in ChromelyMacHost::QuitCallback");
         Logger.Instance.Log.LogError(exception);
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Shutdowns cef.
        /// </summary>
        private void ShutdownInternal()
        {
            Logger.Info("CEF shutdown.");

            InvokeOnCef(() =>
            {
                if (IsMultiThreadedMessageLoop)
                {
                    CefRuntime.Shutdown();
                }
                else
                {
                    CefRuntime.QuitMessageLoop();
                }
            });

            if (!IsMultiThreadedMessageLoop)
            {
                SingleThreadedMessageLoopStoped.WaitOne();
            }
        }
Exemplo n.º 9
0
 public void QuitMessageLoop()
 {
     CefRuntime.QuitMessageLoop();
 }
Exemplo n.º 10
0
        protected virtual IntPtr WndProc(IntPtr hWnd, uint message, IntPtr wParam, IntPtr lParam)
        {
            WM wmMsg = (WM)message;

            switch (wmMsg)
            {
            case WM.NCCREATE:
            {
                NativeInstance = this;
                _handle        = hWnd;
                PreCreated(hWnd);
                break;
            }

            case WM.CREATE:
            {
                OnCreated(hWnd);
                var createdEvent = new CreatedEventArgs(_handle, _handle);
                HostCreated?.Invoke(this, createdEvent);
                _isInitialized = true;
                break;
            }

            case WM.ERASEBKGND:
                return(new IntPtr(1));

            case WM.NCHITTEST:
                if (_options.WindowFrameless)
                {
                    return((IntPtr)HT.CAPTION);
                }
                break;

            case WM.MOVING:
            case WM.MOVE:
            {
                HostMoving?.Invoke(this, new MovingEventArgs());
                return(IntPtr.Zero);
            }

            case WM.SIZING:
            case WM.SIZE:
            {
                var size = GetClientSize();
                OnSizeChanged(size.Width, size.Height);
                break;
            }

            case WM.GETMINMAXINFO:
            {
                if (HandleMinMaxSizes(lParam))
                {
                    return(IntPtr.Zero);
                }
                break;
            }

            case WM.CLOSE:
            {
                if (_handle != IntPtr.Zero && _isInitialized)
                {
                    HostClose?.Invoke(this, new CloseEventArgs());
                }

                DetachHooks();
                DestroyWindow(_handle);
                break;
            }

            case WM.DESTROY:
            {
                if (_options.UseOnlyCefMessageLoop)
                {
                    CefRuntime.QuitMessageLoop();
                }
                PostQuitMessage(0);
                break;
            }

            default:
                break;
            }

            return(DefWindowProcW(hWnd, wmMsg, wParam, lParam));
        }
Exemplo n.º 11
0
 protected virtual void ShutdownCallback()
 {
     CefRuntime.QuitMessageLoop();
 }
Exemplo n.º 12
0
        protected virtual IntPtr WndProc(IntPtr hWnd, uint message, IntPtr wParam, IntPtr lParam)
        {
            WM wmMsg = (WM)message;

            switch (wmMsg)
            {
            case WM.NCCREATE:
            {
                NativeInstance = this;
                _handle        = hWnd;
                PreCreated(hWnd);
                break;
            }

            case WM.CREATE:
            {
                OnCreated(hWnd);
                var createdEvent = new CreatedEventArgs(_handle, _handle);
                HostCreated?.Invoke(this, createdEvent);
                _isInitialized = true;
                break;
            }

            case WM.ERASEBKGND:
                return(new IntPtr(1));

            case WM.NCHITTEST:
                if (_options.WindowFrameless)
                {
                    return((IntPtr)HT.CAPTION);
                }
                break;

            case WM.MOVING:
            {
                HostMoving?.Invoke(this, new MovingEventArgs());
                return(IntPtr.Zero);
            }

            case WM.MOVE:
            {
                var position    = new RECT((int)(short)Interop.PARAM.LOWORD(lParam), (int)(short)Interop.PARAM.HIWORD(lParam), 0, 0);
                var windowStyle = GetWindowStylePlacement(_options.WindowState);
                Interop.User32.AdjustWindowRectEx(ref position, (int)windowStyle.Styles, BOOL.FALSE, (int)windowStyle.ExStyles);
                HostMoved?.Invoke(this, new MovedEventArgs(position.X, position.Y));
                return(IntPtr.Zero);
            }

            case WM.SIZE:
            {
                var innerSize   = GetClientSize();
                var outerSize   = new RECT(0, 0, (int)(short)Interop.PARAM.LOWORD(lParam), (int)(short)Interop.PARAM.HIWORD(lParam));
                var windowStyle = GetWindowStylePlacement(_options.WindowState);
                Interop.User32.AdjustWindowRectEx(ref outerSize, (int)windowStyle.Styles, BOOL.FALSE, (int)windowStyle.ExStyles);
                HandleSizeChanged(innerSize.Width, innerSize.Height, outerSize.Width, outerSize.Height);
                break;
            }

            case WM.GETMINMAXINFO:
            {
                if (HandleMinMaxSizes(lParam))
                {
                    return(IntPtr.Zero);
                }
                break;
            }

            case WM.CLOSE:
            {
                if (_handle != IntPtr.Zero && _isInitialized)
                {
                    HostClose?.Invoke(this, new CloseEventArgs());
                }

                DetachHooks();
                DestroyWindow(_handle);
                break;
            }

            case WM.DESTROY:
            {
                if (_options.UseOnlyCefMessageLoop)
                {
                    CefRuntime.QuitMessageLoop();
                }
                PostQuitMessage(0);
                break;
            }

            default:
                break;
            }

            return(DefWindowProcW(hWnd, wmMsg, wParam, lParam));
        }
 /// <summary>
 /// The platform quit message loop.
 /// </summary>
 protected override void PlatformQuitMessageLoop()
 {
     CefRuntime.QuitMessageLoop();
 }