- Windows: Delay destroying the browser window until pending drag operations have completed (issue #610).
- Revert: Windows: Reset the window procedure in the WebWidgetHost destructor to avoid crashes if messages are delivered after the window is destroyed. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@655 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
584bd26331
commit
5c2e5eab8d
|
@ -127,7 +127,9 @@ void BrowserDragDelegate::StartDragging(const WebDropData& drop_data,
|
|||
// If it is not drag-out, do the drag-and-drop in the current UI thread.
|
||||
if (drop_data.download_metadata.empty()) {
|
||||
DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset);
|
||||
EndDragging(false);
|
||||
CefThread::PostTask(
|
||||
CefThread::UI, FROM_HERE,
|
||||
base::Bind(&BrowserDragDelegate::EndDragging, this, false));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,8 +88,15 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
|
|||
// Clear the user data pointer.
|
||||
ui::SetWindowUserData(hwnd, NULL);
|
||||
|
||||
// Destroy the browser.
|
||||
browser->UIT_DestroyBrowser();
|
||||
BrowserWebViewDelegate* delegate = browser->UIT_GetWebViewDelegate();
|
||||
if (delegate && delegate->drag_delegate()) {
|
||||
// Don't destroy the browser while a drag operation is pending. Instead,
|
||||
// destroy the browser once the drag operation completes.
|
||||
delegate->set_destroy_on_drag_end(true);
|
||||
} else {
|
||||
// Destroy the browser.
|
||||
browser->UIT_DestroyBrowser();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -1035,6 +1035,9 @@ BrowserWebViewDelegate::BrowserWebViewDelegate(CefBrowserImpl* browser)
|
|||
browser_(browser),
|
||||
page_id_(-1),
|
||||
last_page_id_updated_(-1),
|
||||
#if defined(OS_WIN)
|
||||
destroy_on_drag_end_(false),
|
||||
#endif
|
||||
smart_insert_delete_enabled_(true),
|
||||
#if defined(OS_WIN)
|
||||
select_trailing_whitespace_enabled_(true),
|
||||
|
|
|
@ -254,7 +254,9 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
|
||||
BrowserDragDelegate* drag_delegate() { return drag_delegate_.get(); }
|
||||
WebDropTarget* drop_target() { return drop_target_.get(); }
|
||||
#endif
|
||||
|
||||
void set_destroy_on_drag_end(bool val) { destroy_on_drag_end_ = val; }
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
void set_pending_extra_data(BrowserExtraData* extra_data) {
|
||||
pending_extra_data_.reset(extra_data);
|
||||
|
@ -358,6 +360,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
#if defined(OS_WIN)
|
||||
// Classes needed by drag and drop.
|
||||
scoped_refptr<BrowserDragDelegate> drag_delegate_;
|
||||
bool destroy_on_drag_end_;
|
||||
#endif
|
||||
#if defined(OS_WIN) || defined(OS_LINUX)
|
||||
scoped_refptr<WebDropTarget> drop_target_;
|
||||
|
|
|
@ -534,6 +534,9 @@ void BrowserWebViewDelegate::EndDragging() {
|
|||
if (browser_->UIT_GetWebView())
|
||||
browser_->UIT_GetWebView()->dragSourceSystemDragEnded();
|
||||
drag_delegate_ = NULL;
|
||||
|
||||
if (destroy_on_drag_end_)
|
||||
browser_->UIT_DestroyBrowser();
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::ShowJavaScriptAlert(WebFrame* webframe,
|
||||
|
|
|
@ -358,7 +358,6 @@ WebWidgetHost::~WebWidgetHost() {
|
|||
|
||||
if (view_) {
|
||||
ui::SetWindowUserData(view_, 0);
|
||||
ui::SetWindowProc(view_, DefWindowProc);
|
||||
view_ = NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue