Exemplo n.º 1
0
bool ClientHandler::DispatchQuitToAllBrowsers()
{
  while( !m_OpenBrowserWindowMap.empty() )
  {
    BrowserWindowMap::iterator i = m_OpenBrowserWindowMap.begin();
    //close the "main" window last as that will shut everything else down
    if( m_BrowserHwnd == i->first && m_OpenBrowserWindowMap.size() > 1 ) {
      i++;
    }
    CefWindowHandle nativeWindow = i->first;
    CefRefPtr<CefBrowser> browser = i->second;
    
    //Give each window a chance to quit
    if( !BracketsShellAPI::DispatchQuitToBracketsJS(browser) ) {
      return false;
    }
    
    //get the iterator again incase the disptach invalidated it
    i = m_OpenBrowserWindowMap.find(nativeWindow);
    if( i != m_OpenBrowserWindowMap.end() )
    {
      browser = i->second;
      m_OpenBrowserWindowMap.erase(i);
      browser->CloseBrowser();
	}
  }
       
  return true;
}
Exemplo n.º 2
0
void CMainFrame::OnClose()
{
  // TODO: Add your message handler code here and/or call default
  
  CCEFView *pView = CCEFView::GetView();
  CefRefPtr<CefBrowser> browser = pView->m_clientHandler->GetBrowser();
  browser->CloseBrowser(); 
  pView->m_clientHandler->m_Browser = 0;
  CFrameWndEx::OnClose();
}
Exemplo n.º 3
0
void CWebCore::DestroyWebView ( CWebViewInterface* pWebViewInterface )
{
    CefRefPtr<CWebView> pWebView = dynamic_cast<CWebView*> ( pWebViewInterface );
    if ( pWebView )
    {
        // Ensure that no attached events are in the queue
        RemoveWebViewEvents ( pWebView );

        m_WebViews.remove ( pWebView );
        //pWebView->Release(); // Do not release since other references get corrupted then
        pWebView->CloseBrowser ();
    }
}
void FCEFWebBrowserWindow::CloseBrowser(bool bForce)
{
	if (IsValid())
	{
		// In case this is called from inside a CEF event handler, use CEF's task mechanism to
		// postpone the actual closing of the window until it is safe.
		CefRefPtr<CefBrowserHost> Host = InternalCefBrowser->GetHost();
		CefPostTask(TID_UI, new FCEFBrowserClosureTask(nullptr, [=]()
		{
			Host->CloseBrowser(bForce);
		}));
	}
}
Exemplo n.º 5
0
bool ClientPopupHandler::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
                                        CefRefPtr<CefFrame> frame,
                                        CefRefPtr<CefRequest> request,
                                        NavType navType,
                                        bool isRedirect)
{
  REQUIRE_UI_THREAD();
    
  // Load the request in the parent browser window.
  m_ParentBrowser->GetMainFrame()->LoadRequest(request);
  browser->CloseBrowser();
  m_ParentBrowser = NULL;

  return true;
}
Exemplo n.º 6
0
bool ClientHandler::GetDownloadHandler(CefRefPtr<CefBrowser> browser,
                                       const CefString& mimeType,
                                       const CefString& fileName,
                                       int64 contentLength,
                                       CefRefPtr<CefDownloadHandler>& handler) {
  REQUIRE_UI_THREAD();

  // Create the handler for the file download.
  handler = CreateDownloadHandler(this, fileName);

  // Close the browser window if it is a popup with no other document contents.
  if (browser->IsPopup() && !browser->HasDocument())
    browser->CloseBrowser();

  return true;
}