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

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: Fix Mac. 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
« no previous file with comments | « no previous file | ash/shelf/shelf_tooltip_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()->TransferEventsTo(
177 tracker->capture_window()); 177 source_window, tracker->capture_window(),
178 ui::GestureRecognizer::ShouldCancelTouches::Cancel);
178 // We also send a gesture end to the source window so it can clear state. 179 // 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 180 // TODO(varunjain): Remove this whole block when gesture sequence
180 // transferring is properly done in the GR (http://crbug.com/160558) 181 // transferring is properly done in the GR (http://crbug.com/160558)
181 DispatchGestureEndToWindow(source_window); 182 DispatchGestureEndToWindow(source_window);
182 } 183 }
183 tracker->TakeCapture(); 184 tracker->TakeCapture();
184 drag_drop_tracker_.reset(tracker); 185 drag_drop_tracker_.reset(tracker);
185 drag_source_window_ = source_window; 186 drag_source_window_ = source_window;
186 if (drag_source_window_) 187 if (drag_source_window_)
187 drag_source_window_->AddObserver(this); 188 drag_source_window_->AddObserver(this);
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 if (drag_window_) 565 if (drag_window_)
565 drag_window_->RemoveObserver(this); 566 drag_window_->RemoveObserver(this);
566 drag_window_ = NULL; 567 drag_window_ = NULL;
567 drag_data_ = NULL; 568 drag_data_ = NULL;
568 // Cleanup can be called again while deleting DragDropTracker, so delete 569 // Cleanup can be called again while deleting DragDropTracker, so delete
569 // the pointer with a local variable to avoid double free. 570 // the pointer with a local variable to avoid double free.
570 std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_); 571 std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_);
571 } 572 }
572 573
573 } // namespace ash 574 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/shelf_tooltip_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698