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

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

Issue 10388105: aura: Fix a couple of bug (really the same bug at two different places) for drag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/drag_drop/drag_drop_controller_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 "ash/drag_drop/drag_image_view.h" 7 #include "ash/drag_drop/drag_image_view.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "ui/aura/client/drag_drop_delegate.h" 10 #include "ui/aura/client/drag_drop_delegate.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 drag_image_->SetScreenPosition( 124 drag_image_->SetScreenPosition(
125 event.root_location().Subtract(drag_image_offset_)); 125 event.root_location().Subtract(drag_image_offset_));
126 } 126 }
127 } 127 }
128 128
129 void DragDropController::Drop(aura::Window* target, 129 void DragDropController::Drop(aura::Window* target,
130 const aura::LocatedEvent& event) { 130 const aura::LocatedEvent& event) {
131 Shell::GetRootWindow()->SetCursor(ui::kCursorPointer); 131 Shell::GetRootWindow()->SetCursor(ui::kCursorPointer);
132 aura::client::DragDropDelegate* delegate = NULL; 132 aura::client::DragDropDelegate* delegate = NULL;
133 133
134 // |drag_window_| can be NULL if we have just started the drag and have not 134 // We must guarantee that a target gets a OnDragEntered before Drop. WebKit
135 // received any DragUpdates, or, if the |drag_window_| gets destroyed during 135 // depends on not getting a Drop without DragEnter. This behavior is
136 // a drag/drop. Otherwise, target should be equal to the |drag_window_|. 136 // consistent with drag/drop on other platforms.
137 DCHECK(target == drag_window_ || !drag_window_); 137 if (target != drag_window_)
138 DragUpdate(target, event);
139 DCHECK(target == drag_window_);
140
138 if ((delegate = aura::client::GetDragDropDelegate(target))) { 141 if ((delegate = aura::client::GetDragDropDelegate(target))) {
139 aura::DropTargetEvent e( 142 aura::DropTargetEvent e(
140 *drag_data_, event.location(), event.root_location(), drag_operation_); 143 *drag_data_, event.location(), event.root_location(), drag_operation_);
141 drag_operation_ = delegate->OnPerformDrop(e); 144 drag_operation_ = delegate->OnPerformDrop(e);
142 if (drag_operation_ == 0) 145 if (drag_operation_ == 0)
143 StartCanceledAnimation(); 146 StartCanceledAnimation();
144 else 147 else
145 drag_image_.reset(); 148 drag_image_.reset();
146 } else { 149 } else {
147 drag_image_.reset(); 150 drag_image_.reset();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 void DragDropController::Cleanup() { 267 void DragDropController::Cleanup() {
265 if (drag_window_) 268 if (drag_window_)
266 drag_window_->RemoveObserver(this); 269 drag_window_->RemoveObserver(this);
267 drag_window_ = NULL; 270 drag_window_ = NULL;
268 drag_data_ = NULL; 271 drag_data_ = NULL;
269 drag_drop_in_progress_ = false; 272 drag_drop_in_progress_ = false;
270 } 273 }
271 274
272 } // namespace internal 275 } // namespace internal
273 } // namespace ash 276 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/drag_drop/drag_drop_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698