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

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

Issue 10692170: Aura desktop: Show resize cursors again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 8 years, 5 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 | « ash/display/mouse_cursor_event_filter.cc ('k') | ash/shell.h » ('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 "ash/wm/cursor_manager.h"
9 #include "base/message_loop.h" 10 #include "base/message_loop.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
11 #include "ui/aura/client/capture_client.h" 12 #include "ui/aura/client/capture_client.h"
12 #include "ui/aura/client/drag_drop_delegate.h" 13 #include "ui/aura/client/drag_drop_delegate.h"
13 #include "ui/aura/cursor_manager.h"
14 #include "ui/aura/env.h" 14 #include "ui/aura/env.h"
15 #include "ui/aura/root_window.h" 15 #include "ui/aura/root_window.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/base/dragdrop/drag_drop_types.h" 17 #include "ui/base/dragdrop/drag_drop_types.h"
18 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" 18 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h"
19 #include "ui/compositor/layer.h" 19 #include "ui/compositor/layer.h"
20 #include "ui/compositor/layer_animator.h" 20 #include "ui/compositor/layer_animator.h"
21 #include "ui/compositor/scoped_layer_animation_settings.h" 21 #include "ui/compositor/scoped_layer_animation_settings.h"
22 #include "ui/gfx/point.h" 22 #include "ui/gfx/point.h"
23 #include "ui/gfx/rect.h" 23 #include "ui/gfx/rect.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 drag_operation_); 121 drag_operation_);
122 e.set_flags(event.flags()); 122 e.set_flags(event.flags());
123 int op = delegate->OnDragUpdated(e); 123 int op = delegate->OnDragUpdated(e);
124 gfx::NativeCursor cursor = ui::kCursorNoDrop; 124 gfx::NativeCursor cursor = ui::kCursorNoDrop;
125 if (op & ui::DragDropTypes::DRAG_COPY) 125 if (op & ui::DragDropTypes::DRAG_COPY)
126 cursor = ui::kCursorCopy; 126 cursor = ui::kCursorCopy;
127 else if (op & ui::DragDropTypes::DRAG_LINK) 127 else if (op & ui::DragDropTypes::DRAG_LINK)
128 cursor = ui::kCursorAlias; 128 cursor = ui::kCursorAlias;
129 else if (op & ui::DragDropTypes::DRAG_MOVE) 129 else if (op & ui::DragDropTypes::DRAG_MOVE)
130 cursor = ui::kCursorMove; 130 cursor = ui::kCursorMove;
131 aura::Env::GetInstance()->cursor_manager()->SetCursor(cursor); 131 ash::Shell::GetInstance()->cursor_manager()->SetCursor(cursor);
132 } 132 }
133 } 133 }
134 134
135 DCHECK(drag_image_.get()); 135 DCHECK(drag_image_.get());
136 if (drag_image_->visible()) { 136 if (drag_image_->visible()) {
137 drag_image_->SetScreenPosition( 137 drag_image_->SetScreenPosition(
138 event.root_location().Subtract(drag_image_offset_)); 138 event.root_location().Subtract(drag_image_offset_));
139 } 139 }
140 } 140 }
141 141
142 void DragDropController::Drop(aura::Window* target, 142 void DragDropController::Drop(aura::Window* target,
143 const aura::LocatedEvent& event) { 143 const aura::LocatedEvent& event) {
144 aura::Env::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer); 144 ash::Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer);
145 aura::client::DragDropDelegate* delegate = NULL; 145 aura::client::DragDropDelegate* delegate = NULL;
146 146
147 // We must guarantee that a target gets a OnDragEntered before Drop. WebKit 147 // We must guarantee that a target gets a OnDragEntered before Drop. WebKit
148 // depends on not getting a Drop without DragEnter. This behavior is 148 // depends on not getting a Drop without DragEnter. This behavior is
149 // consistent with drag/drop on other platforms. 149 // consistent with drag/drop on other platforms.
150 if (target != drag_window_) 150 if (target != drag_window_)
151 DragUpdate(target, event); 151 DragUpdate(target, event);
152 DCHECK(target == drag_window_); 152 DCHECK(target == drag_window_);
153 153
154 if ((delegate = aura::client::GetDragDropDelegate(target))) { 154 if ((delegate = aura::client::GetDragDropDelegate(target))) {
155 aura::DropTargetEvent e( 155 aura::DropTargetEvent e(
156 *drag_data_, event.location(), event.root_location(), drag_operation_); 156 *drag_data_, event.location(), event.root_location(), drag_operation_);
157 e.set_flags(event.flags()); 157 e.set_flags(event.flags());
158 drag_operation_ = delegate->OnPerformDrop(e); 158 drag_operation_ = delegate->OnPerformDrop(e);
159 if (drag_operation_ == 0) 159 if (drag_operation_ == 0)
160 StartCanceledAnimation(); 160 StartCanceledAnimation();
161 else 161 else
162 drag_image_.reset(); 162 drag_image_.reset();
163 } else { 163 } else {
164 drag_image_.reset(); 164 drag_image_.reset();
165 } 165 }
166 166
167 Cleanup(); 167 Cleanup();
168 if (should_block_during_drag_drop_) 168 if (should_block_during_drag_drop_)
169 quit_closure_.Run(); 169 quit_closure_.Run();
170 } 170 }
171 171
172 void DragDropController::DragCancel() { 172 void DragDropController::DragCancel() {
173 aura::Env::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer); 173 ash::Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer);
174 174
175 // |drag_window_| can be NULL if we have just started the drag and have not 175 // |drag_window_| can be NULL if we have just started the drag and have not
176 // received any DragUpdates, or, if the |drag_window_| gets destroyed during 176 // received any DragUpdates, or, if the |drag_window_| gets destroyed during
177 // a drag/drop. 177 // a drag/drop.
178 aura::client::DragDropDelegate* delegate = drag_window_? 178 aura::client::DragDropDelegate* delegate = drag_window_?
179 aura::client::GetDragDropDelegate(drag_window_) : NULL; 179 aura::client::GetDragDropDelegate(drag_window_) : NULL;
180 if (delegate) 180 if (delegate)
181 delegate->OnDragExited(); 181 delegate->OnDragExited();
182 182
183 Cleanup(); 183 Cleanup();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 void DragDropController::Cleanup() { 289 void DragDropController::Cleanup() {
290 if (drag_window_) 290 if (drag_window_)
291 drag_window_->RemoveObserver(this); 291 drag_window_->RemoveObserver(this);
292 drag_window_ = NULL; 292 drag_window_ = NULL;
293 drag_data_ = NULL; 293 drag_data_ = NULL;
294 drag_drop_in_progress_ = false; 294 drag_drop_in_progress_ = false;
295 } 295 }
296 296
297 } // namespace internal 297 } // namespace internal
298 } // namespace ash 298 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/mouse_cursor_event_filter.cc ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698