- Change the way that application shutdown works in order to support JavaScript 'onbeforeunload' handling (issue #853). See comments in cef_life_span_handler.h for a detailed description of the new shutdown process.

- Fix a crash on Linux during window destruction (issue #681).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1149 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-03-19 22:59:33 +00:00
parent e3b297416f
commit 7ded60a218
33 changed files with 871 additions and 138 deletions

View File

@ -456,30 +456,24 @@ LPCTSTR CefBrowserHostImpl::GetWndClass() {
// static
LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam) {
WPARAM wParam, LPARAM lParam) {
CefBrowserHostImpl* browser =
static_cast<CefBrowserHostImpl*>(ui::GetWindowUserData(hwnd));
switch (message) {
case WM_CLOSE:
if (browser) {
bool handled(false);
if (browser->client_.get()) {
CefRefPtr<CefLifeSpanHandler> handler =
browser->client_->GetLifeSpanHandler();
if (handler.get()) {
// Give the client a chance to handle this one.
handled = handler->DoClose(browser);
}
// Protect against multiple requests to close while the close is pending.
if (browser && browser->destruction_state() <= DESTRUCTION_STATE_PENDING) {
if (browser->destruction_state() == DESTRUCTION_STATE_NONE) {
// Request that the browser close.
browser->CloseBrowser(false);
}
if (handled)
return 0;
// We are our own parent in this case.
browser->ParentWindowWillClose();
// Cancel the close.
return 0;
}
// Allow the close.
break;
case WM_DESTROY:
@ -487,11 +481,9 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message,
// Clear the user data pointer.
ui::SetWindowUserData(hwnd, NULL);
// Destroy the browser.
browser->DestroyBrowser();
// Release the reference added in PlatformCreateWindow().
browser->Release();
// Force the browser to be destroyed and release the reference added in
// PlatformCreateWindow().
browser->WindowDestroyed();
}
return 0;
@ -574,8 +566,10 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
}
void CefBrowserHostImpl::PlatformCloseWindow() {
if (window_info_.window != NULL)
PostMessage(window_info_.window, WM_CLOSE, 0, 0);
if (window_info_.window != NULL) {
HWND frameWnd = GetAncestor(window_info_.window, GA_ROOT);
PostMessage(frameWnd, WM_CLOSE, 0, 0);
}
}
void CefBrowserHostImpl::PlatformSizeTo(int width, int height) {