private void CreateWindowInternal(ShowPopupEventArgs e, Predicate <CreateWindowRequest> requestPredicate)
        {
            var pendingCreationRequest = _pendingWindowCreations.Find(requestPredicate);

            if (pendingCreationRequest == null)
            {
                return;
            }

            CreatingWindow.Raise(this, EventArgs.Empty);

            lock (_pendingWindowCreations)
            {
                _pendingWindowCreations.Remove(pendingCreationRequest);
            }

            var window = CreateWindow(e.PopupBrowser, pendingCreationRequest.StartUrl, pendingCreationRequest.Options);

            if (pendingCreationRequest.Options == null || !pendingCreationRequest.Options.Hidden)
            {
                window.ShowWindow();
            }

            if (CreatedWindow != null)
            {
                CreatedWindow(window, AllWindows.Length == 1);
            }

            pendingCreationRequest.WindowCreated(window);
            e.Shown = true;
        }
 private ShowPopupEventArgs RaiseShowPopup(CefWebBrowser browser)
 {
     if (ShowPopup != null)
     {
         var ea = new ShowPopupEventArgs(browser);
         ShowPopup(this, ea);
         return(ea);
     }
     return(null);
 }
 private void OnRootBrowserShowPopup(object sender, ShowPopupEventArgs eventArgs)
 {
     CreateWindowInternal(eventArgs, request => request.RequestId == eventArgs.PopupBrowser.BrowserName);
 }
 public void ShowApplicationWindowPopup(IApplicationWindowEx applicationWindow, ShowPopupEventArgs eventArgs)
 {
     CreateWindowInternal(eventArgs, request => request.RequestId == eventArgs.PopupBrowser.BrowserName);
     Logger.Debug("Application window with ID {0} shown.", applicationWindow.GetId());
 }