Esempio n. 1
0
	void IBrowserHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) 
	{
		REQUIRE_UI_THREAD();
		
		if(m_browserId == browser->GetIdentifier())
		{
			// Free the browser pointer so that the browser can be destroyed
			m_browser = NULL;
			m_browserId = 0;
			m_bIsClosing = false;
		}
		// Remove from the list of existing browsers.
		BrowserList::iterator bit = browser_list_.begin();
		for (; bit != browser_list_.end(); ++bit) 
		{
			if ((*bit)->IsSame(browser)) 
			{
				browser_list_.erase(bit);
				break;
			}
		}

		if (browser_list_.empty()) 
		{
			// All browser windows have closed. Quit the application message loop.
			this->m_bIsClosing = true;
			CefQuitMessageLoop();
		}
	}
Esempio n. 2
0
void AppQuitMessageLoop() {
  CefRefPtr<CefCommandLine> command_line = AppGetCommandLine();
  if (command_line->HasSwitch(cefclient::kMultiThreadedMessageLoop)) {
    // Running in multi-threaded message loop mode. Need to execute
    // PostQuitMessage on the main application thread.
    ASSERT(hMessageWnd);
    PostMessage(hMessageWnd, WM_COMMAND, ID_QUIT, 0);
  } else {
    CefQuitMessageLoop();
  }
}
Esempio n. 3
0
void WindowClient::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
    for (BrowserList::iterator i = browsers_.begin(); i != browsers_.end(); ++i) {
        if ((*i)->IsSame(browser)) {
            browsers_.erase(i);
            break;
        }
    }

    if (browsers_.empty()) {
        CefQuitMessageLoop();
    }
}
Esempio n. 4
0
void PhantomJSHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser)
{
  CEF_REQUIRE_UI_THREAD();

  qCDebug(handler) << browser->GetIdentifier();

  m_messageRouter->OnBeforeClose(browser);

  m_browsers.remove(browser->GetIdentifier());

  if (m_browsers.empty()) {
    // All browser windows have closed. Quit the application message loop.
    CefQuitMessageLoop();
  }
}
bool ApkAnalyzerHandler::_UninitializeOnBeforeClose(
  const CefRefPtr<CefBrowser>& browser) {

  REQUIRE_UI_THREAD();

  for (MessageHandlerSet::iterator iter = message_handler_set_.begin();
    iter != message_handler_set_.end(); ++iter) {
    message_router_->RemoveHandler((*iter));
    delete (*iter);
  }
  message_handler_set_.clear();
  message_router_ = nullptr;

  CefQuitMessageLoop();
  return true;
}
Esempio n. 6
0
void WindowClient::CloseAllBrowsers() {
    if (!CefCurrentlyOn(TID_UI)) {
        // Execute on the UI thread.
        CefPostTask(TID_UI,
            base::Bind(&WindowClient::CloseAllBrowsers, this));
        return;
    }

    if (browsers_.empty()) {
        CefQuitMessageLoop();
    }

    for (BrowserList::const_iterator i = browsers_.begin(); i != browsers_.end(); ++i) {
        (*i)->GetHost()->CloseBrowser(true);
    }
}
Esempio n. 7
0
// TODO: this is not yet called to shutdown Brackets
gboolean HandleQuit() {
  
  if (!isReallyClosing && g_handler.get()) {
    g_handler->DispatchCloseToNextBrowser();
  }
  else 
  {
    if(!g_handler.get() || !g_handler->HasWindows()) {
      CefQuitMessageLoop();
      return FALSE;
    }
  }
  
  return TRUE;
    
}
Esempio n. 8
0
void SimpleHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
  REQUIRE_UI_THREAD();

  // Remove from the list of existing browsers.
  BrowserList::iterator bit = browser_list_.begin();
  for (; bit != browser_list_.end(); ++bit) {
    if ((*bit)->IsSame(browser)) {
      browser_list_.erase(bit);
      break;
    }
  }

  if (browser_list_.empty()) {
    // All browser windows have closed. Quit the application message loop.
    CefQuitMessageLoop();
  }
}
Esempio n. 9
0
void QuitMessageLoop()
{
	if (!g_isMessageLoopRunning)
		return;

	if (g_isMultithreadedMessageLoop)
	{
		// running in multi-threaded message loop mode
		// need to execute PostQuitMessage on the main application thread
		DCHECK(g_hMessageWnd);
		PostMessage(g_hMessageWnd, WM_COMMAND, ID_QUIT, 0);
	}
	else
		CefQuitMessageLoop();

	CloseHandle(g_hndLogFile);
}
Esempio n. 10
0
void Client::OnBeforeClose( CefRefPtr<CefBrowser> browser )
{
  CEF_REQUIRE_UI_THREAD();
  if (_browserId == browser->GetIdentifier())
  {
    // Free the browser pointer so that the browser can be destroyed
    _browser = NULL;
    /*
    if (_OSRHandler.get())
    {
      _OSRHandler->OnBeforeClose(browser);
      _OSRHandler = NULL;
    }
    */
  }
  else if (browser->IsPopup())
  {
    // Remove the record for DevTools popup windows.
    std::set<std::string>::iterator it =
      _openDevToolsURLs.find(browser->GetMainFrame()->GetURL());
    if (it != _openDevToolsURLs.end())
      _openDevToolsURLs.erase(it);

    // Remove from the browser popup list.
    BrowserList::iterator bit = _popupBrowsers.begin();
    for (; bit != _popupBrowsers.end(); ++bit)
    {
      if ((*bit)->IsSame(browser))
      {
        _popupBrowsers.erase(bit);
        break;
      }
    }
  }
  

  if (--_browserCount == 0) 
  {
    // All browser windows have closed. Quit the application message loop.
    CefQuitMessageLoop();
  }
}
void BrowserManager::Impl::Shutdown() 
{
	os_event_t *shutdown_event;
	os_event_init(&shutdown_event, OS_EVENT_TYPE_AUTO);

	// post the task
	CefPostTask(TID_UI, BrowserTask::newTask([] {
		CefQuitMessageLoop();
	}));

	// this event will then get processed and shut down the dispatcher loop
	PushEvent([this, shutdown_event] {
		threadAlive = false;
		os_event_signal(shutdown_event);
	});

	os_event_wait(shutdown_event);
	os_event_destroy(shutdown_event);
	return;
}
Esempio n. 12
0
    void LootHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
        assert(CefCurrentlyOn(TID_UI));

#ifdef _WIN32
        RECT rc;
        GetWindowRect(browser->GetHost()->GetWindowHandle(), &rc);

        LootSettings::WindowPosition position;
        position.top = rc.top;
        position.bottom = rc.bottom;
        position.left = rc.left;
        position.right = rc.right;
        _lootState.storeWindowPosition(position);
#endif

        try {
            _lootState.save(g_path_settings);
        }
        catch (std::exception &e) {
            BOOST_LOG_TRIVIAL(error) << "Failed to save LOOT's settings. Error: " << e.what();
        }

        // Cancel any javascript callbacks.
        browser_side_router_->OnBeforeClose(browser);

        // Remove from the list of existing browsers.
        for (BrowserList::iterator bit = browser_list_.begin(); bit != browser_list_.end(); ++bit) {
            if ((*bit)->IsSame(browser)) {
                browser_list_.erase(bit);
                break;
            }
        }

        if (browser_list_.empty()) {
            // All browser windows have closed. Quit the application message loop.
            CefQuitMessageLoop();
        }
    }
Esempio n. 13
0
void destroy(void) {
  CefQuitMessageLoop();
}
Esempio n. 14
0
void TerminationSignalHandler(int signal) {
    CefQuitMessageLoop();
    printf("quit loop\n");
}
Esempio n. 15
0
void destroy(void) {
  if (isReallyClosing) {
    CefQuitMessageLoop();
  }
}
Esempio n. 16
0
void AppQuitMessageLoop() {
  CefQuitMessageLoop();
}