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

Side by Side Diff: ash/drag_drop/drag_drop_controller.cc

Issue 1907323003: Drag and drop cleans up touch sequences from the source window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update GR state without actually dispatching press events. Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/drag_drop/drag_drop_controller.h" 5 #include "ash/drag_drop/drag_drop_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/drag_drop/drag_drop_tracker.h" 9 #include "ash/drag_drop/drag_drop_tracker.h"
10 #include "ash/drag_drop/drag_image_view.h" 10 #include "ash/drag_drop/drag_image_view.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 UMA_HISTOGRAM_ENUMERATION("Event.DragDrop.Start", source, 166 UMA_HISTOGRAM_ENUMERATION("Event.DragDrop.Start", source,
167 ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT); 167 ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
168 168
169 current_drag_event_source_ = source; 169 current_drag_event_source_ = source;
170 DragDropTracker* tracker = 170 DragDropTracker* tracker =
171 new DragDropTracker(root_window, drag_drop_window_delegate_.get()); 171 new DragDropTracker(root_window, drag_drop_window_delegate_.get());
172 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { 172 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) {
173 // We need to transfer the current gesture sequence and the GR's touch event 173 // We need to transfer the current gesture sequence and the GR's touch event
174 // queue to the |drag_drop_tracker_|'s capture window so that when it takes 174 // queue to the |drag_drop_tracker_|'s capture window so that when it takes
175 // capture, it still gets a valid gesture state. 175 // capture, it still gets a valid gesture state.
176 ui::GestureRecognizer::Get()->TransferEventsTo(source_window, 176 ui::GestureRecognizer::Get()->BeginDragAndDrop(source_window,
177 tracker->capture_window()); 177 tracker->capture_window());
178 // We also send a gesture end to the source window so it can clear state. 178 // We also send a gesture end to the source window so it can clear state.
179 // TODO(varunjain): Remove this whole block when gesture sequence 179 // TODO(varunjain): Remove this whole block when gesture sequence
180 // transferring is properly done in the GR (http://crbug.com/160558) 180 // transferring is properly done in the GR (http://crbug.com/160558)
181 DispatchGestureEndToWindow(source_window); 181 DispatchGestureEndToWindow(source_window);
182 } 182 }
183 tracker->TakeCapture(); 183 tracker->TakeCapture();
184 drag_drop_tracker_.reset(tracker); 184 drag_drop_tracker_.reset(tracker);
185 drag_source_window_ = source_window; 185 drag_source_window_ = source_window;
186 if (drag_source_window_) 186 if (drag_source_window_)
187 drag_source_window_->AddObserver(this); 187 drag_source_window_->AddObserver(this);
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 if (drag_window_) 564 if (drag_window_)
565 drag_window_->RemoveObserver(this); 565 drag_window_->RemoveObserver(this);
566 drag_window_ = NULL; 566 drag_window_ = NULL;
567 drag_data_ = NULL; 567 drag_data_ = NULL;
568 // Cleanup can be called again while deleting DragDropTracker, so delete 568 // Cleanup can be called again while deleting DragDropTracker, so delete
569 // the pointer with a local variable to avoid double free. 569 // the pointer with a local variable to avoid double free.
570 std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_); 570 std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_);
571 } 571 }
572 572
573 } // namespace ash 573 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/shelf_tooltip_manager_unittest.cc » ('j') | ui/aura/window_event_dispatcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698