Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Unified Diff: content/browser/web_contents/web_contents_view_win.cc

Issue 10966023: Fix the crash that could occur when the window is closed while web contents drag is in progress. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_view_win.cc
diff --git a/content/browser/web_contents/web_contents_view_win.cc b/content/browser/web_contents/web_contents_view_win.cc
index 44286b28e56fddfd04664f6638a0cec5192d7795..66769af13ac91436139b7c8b95bdee31f960266b 100644
--- a/content/browser/web_contents/web_contents_view_win.cc
+++ b/content/browser/web_contents/web_contents_view_win.cc
@@ -99,7 +99,6 @@ WebContentsViewWin::WebContentsViewWin(WebContentsImpl* web_contents,
: web_contents_(web_contents),
view_(NULL),
delegate_(delegate),
- close_tab_after_drag_ends_(false),
hwnd_message_filter_(new PositionChangedMessageFilter) {
}
@@ -233,19 +232,6 @@ void WebContentsViewWin::RestoreFocus() {
delegate_->RestoreFocus();
}
-bool WebContentsViewWin::IsDoingDrag() const {
- return drag_handler_.get() != NULL;
-}
-
-void WebContentsViewWin::CancelDragAndCloseTab() {
- DCHECK(IsDoingDrag());
- // We can't close the tab while we're in the drag and
- // |drag_handler_->CancelDrag()| is async. Instead, set a flag to cancel
- // the drag and when the drag nested message loop ends, close the tab.
- drag_handler_->CancelDrag();
- close_tab_after_drag_ends_ = true;
-}
-
WebDropData* WebContentsViewWin::GetDropData() const {
return drag_dest_->current_drop_data();
}
@@ -312,10 +298,6 @@ void WebContentsViewWin::TakeFocus(bool reverse) {
void WebContentsViewWin::EndDragging() {
drag_handler_ = NULL;
- if (close_tab_after_drag_ends_) {
- close_tab_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(0),
- this, &WebContentsViewWin::CloseTab);
- }
web_contents_->SystemDragEnded();
}
@@ -337,6 +319,10 @@ LRESULT WebContentsViewWin::OnDestroy(
RevokeDragDrop(GetNativeView());
drag_dest_ = NULL;
}
+ if (drag_handler_.get()) {
+ drag_handler_->CancelDrag();
+ drag_handler_ = NULL;
+ }
return 0;
}

Powered by Google App Engine
This is Rietveld 408576698