Merge revision 655 changes:

- 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/branches/1025@656 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-05-30 18:06:58 +00:00
parent 46021aafbd
commit 99ebb866b6
6 changed files with 22 additions and 5 deletions

View File

@ -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 it is not drag-out, do the drag-and-drop in the current UI thread.
if (drop_data.download_metadata.empty()) { if (drop_data.download_metadata.empty()) {
DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset); 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; return;
} }

View File

@ -88,9 +88,16 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
// Clear the user data pointer. // Clear the user data pointer.
ui::SetWindowUserData(hwnd, NULL); ui::SetWindowUserData(hwnd, NULL);
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. // Destroy the browser.
browser->UIT_DestroyBrowser(); browser->UIT_DestroyBrowser();
} }
}
return 0; return 0;
case WM_SIZE: case WM_SIZE:

View File

@ -1003,6 +1003,9 @@ BrowserWebViewDelegate::BrowserWebViewDelegate(CefBrowserImpl* browser)
browser_(browser), browser_(browser),
page_id_(-1), page_id_(-1),
last_page_id_updated_(-1), last_page_id_updated_(-1),
#if defined(OS_WIN)
destroy_on_drag_end_(false),
#endif
smart_insert_delete_enabled_(true), smart_insert_delete_enabled_(true),
#if defined(OS_WIN) #if defined(OS_WIN)
select_trailing_whitespace_enabled_(true), select_trailing_whitespace_enabled_(true),

View File

@ -248,7 +248,9 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
BrowserDragDelegate* drag_delegate() { return drag_delegate_.get(); } BrowserDragDelegate* drag_delegate() { return drag_delegate_.get(); }
WebDropTarget* drop_target() { return drop_target_.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) { void set_pending_extra_data(BrowserExtraData* extra_data) {
pending_extra_data_.reset(extra_data); pending_extra_data_.reset(extra_data);
@ -352,6 +354,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
#if defined(OS_WIN) #if defined(OS_WIN)
// Classes needed by drag and drop. // Classes needed by drag and drop.
scoped_refptr<BrowserDragDelegate> drag_delegate_; scoped_refptr<BrowserDragDelegate> drag_delegate_;
bool destroy_on_drag_end_;
#endif #endif
#if defined(OS_WIN) || defined(OS_LINUX) #if defined(OS_WIN) || defined(OS_LINUX)
scoped_refptr<WebDropTarget> drop_target_; scoped_refptr<WebDropTarget> drop_target_;

View File

@ -533,6 +533,9 @@ void BrowserWebViewDelegate::EndDragging() {
if (browser_->UIT_GetWebView()) if (browser_->UIT_GetWebView())
browser_->UIT_GetWebView()->dragSourceSystemDragEnded(); browser_->UIT_GetWebView()->dragSourceSystemDragEnded();
drag_delegate_ = NULL; drag_delegate_ = NULL;
if (destroy_on_drag_end_)
browser_->UIT_DestroyBrowser();
} }
void BrowserWebViewDelegate::ShowJavaScriptAlert(WebFrame* webframe, void BrowserWebViewDelegate::ShowJavaScriptAlert(WebFrame* webframe,

View File

@ -358,7 +358,6 @@ WebWidgetHost::~WebWidgetHost() {
if (view_) { if (view_) {
ui::SetWindowUserData(view_, 0); ui::SetWindowUserData(view_, 0);
ui::SetWindowProc(view_, DefWindowProc);
view_ = NULL; view_ = NULL;
} }
} }