diff --git a/libcef/web_drop_target_win.cc b/libcef/web_drop_target_win.cc index 2c7de5030..cc02d135d 100644 --- a/libcef/web_drop_target_win.cc +++ b/libcef/web_drop_target_win.cc @@ -59,6 +59,7 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object, POINT cursor_position, DWORD effects) { current_wvh_ = _Context->current_webviewhost(); + DCHECK(current_wvh_); // TODO(tc): PopulateWebDropData can be slow depending on what is in the // IDataObject. Maybe we can do this in a background thread. diff --git a/libcef/webview_host.h b/libcef/webview_host.h index d52976f2d..37b10fe2a 100644 --- a/libcef/webview_host.h +++ b/libcef/webview_host.h @@ -56,9 +56,7 @@ class WebViewHost : public WebWidgetHost { WebViewHost(); #if defined(OS_WIN) - virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam) { - return false; - } + virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam); virtual void MouseEvent(UINT message, WPARAM wparam, LPARAM lparam); #endif diff --git a/libcef/webview_host_win.cc b/libcef/webview_host_win.cc index babce7ae5..8bede67d9 100644 --- a/libcef/webview_host_win.cc +++ b/libcef/webview_host_win.cc @@ -64,6 +64,17 @@ WebView* WebViewHost::webview() const { return static_cast(webwidget_); } +bool WebViewHost::WndProc(UINT message, WPARAM wparam, LPARAM lparam) { + switch (message) { + case WM_SETFOCUS: + // Set the current WebViewHost in case a drag action is started before mouse + // events are detected for the window. + _Context->set_current_webviewhost(this); + break; + } + return false; +} + void WebViewHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) { _Context->set_current_webviewhost(this); WebWidgetHost::MouseEvent(message, wparam, lparam);