void ClientHandler::AbortQuit() { m_quitting = false; // Notify all browsers that quit was aborted BrowserWindowMap::const_iterator i, last = browser_window_map_.end(); for (i = browser_window_map_.begin(); i != last; i++) { CefRefPtr<CefBrowser> browser = i->second; SendJSCommand(browser, APP_ABORT_QUIT); } }
void ClientHandler::DispatchCloseToNextBrowser() { // Close the first (main) window last. On Windows, closing the main window exits the application, // so make sure all other windows get a crack at saving changes first. bool skipFirstOne = (browser_window_map_.size() > 1); for (BrowserWindowMap::const_iterator i = browser_window_map_.begin(); i != browser_window_map_.end(); i++) { if (skipFirstOne) { skipFirstOne = false; continue; } CefRefPtr<CefBrowser> browser = i->second; // Bring the window to the front before sending the command BringBrowserWindowToFront(browser); // This call initiates a quit sequence. We will continue to close browser windows // unless AbortQuit() is called. m_quitting = true; CefRefPtr<CommandCallback> callback = new CloseWindowCommandCallback(browser); SendJSCommand(browser, FILE_CLOSE_WINDOW, callback); return; } }
void ClientHandler::DispatchCloseToNextBrowser() { // If the inner loop iterates thru all browsers and there's still at least one // left (i.e. the first browser that was skipped), then re-start loop while (browser_window_map_.size() > 0) { // Close the main window last. On Windows, closing the main window exits the // application, so make sure all other windows get a crack at saving changes first. bool skipMainWindow = (browser_window_map_.size() > 1); BrowserWindowMap::const_iterator i; for (i = browser_window_map_.begin(); i != browser_window_map_.end(); i++) { CefRefPtr<CefBrowser> browser = i->second; if (skipMainWindow && browser && browser->GetIdentifier() == m_BrowserId) { continue; } // Bring the window to the front before sending the command BringBrowserWindowToFront(browser); // This call initiates a quit sequence. We will continue to close browser windows // unless AbortQuit() is called. m_quitting = true; CefRefPtr<CommandCallback> callback = new CloseWindowCommandCallback(browser); if (SendJSCommand(browser, FILE_CLOSE_WINDOW, callback)) { // JS Command successfully sent, so we're done return; } // Sending JS command to browser failed, so remove it from queue, continue to next browser browser_window_map_.erase(i->first); } } }