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

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

Issue 10827392: Fix the issue of the dragged item always shown on the primary display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | no next file » | 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/coordinate_conversion.h"
9 #include "ash/wm/cursor_manager.h" 10 #include "ash/wm/cursor_manager.h"
10 #include "base/message_loop.h" 11 #include "base/message_loop.h"
11 #include "base/run_loop.h" 12 #include "base/run_loop.h"
12 #include "ui/aura/client/capture_client.h" 13 #include "ui/aura/client/capture_client.h"
13 #include "ui/aura/client/drag_drop_delegate.h" 14 #include "ui/aura/client/drag_drop_delegate.h"
14 #include "ui/aura/env.h" 15 #include "ui/aura/env.h"
15 #include "ui/aura/root_window.h" 16 #include "ui/aura/root_window.h"
16 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
17 #include "ui/base/event.h" 18 #include "ui/base/event.h"
18 #include "ui/base/dragdrop/drag_drop_types.h" 19 #include "ui/base/dragdrop/drag_drop_types.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 cursor = ui::kCursorAlias; 131 cursor = ui::kCursorAlias;
131 else if (op & ui::DragDropTypes::DRAG_MOVE) 132 else if (op & ui::DragDropTypes::DRAG_MOVE)
132 cursor = ui::kCursorMove; 133 cursor = ui::kCursorMove;
133 drag_cursor_ = cursor; 134 drag_cursor_ = cursor;
134 ash::Shell::GetInstance()->cursor_manager()->SetCursor(cursor); 135 ash::Shell::GetInstance()->cursor_manager()->SetCursor(cursor);
135 } 136 }
136 } 137 }
137 138
138 DCHECK(drag_image_.get()); 139 DCHECK(drag_image_.get());
139 if (drag_image_->visible()) { 140 if (drag_image_->visible()) {
141 gfx::Point root_location_in_screen = event.root_location();
142 ash::wm::ConvertPointToScreen(target->GetRootWindow(),
143 &root_location_in_screen);
140 drag_image_->SetScreenPosition( 144 drag_image_->SetScreenPosition(
141 event.root_location().Subtract(drag_image_offset_)); 145 root_location_in_screen.Subtract(drag_image_offset_));
142 } 146 }
143 } 147 }
144 148
145 void DragDropController::Drop(aura::Window* target, 149 void DragDropController::Drop(aura::Window* target,
146 const ui::LocatedEvent& event) { 150 const ui::LocatedEvent& event) {
147 drag_cursor_ = ui::kCursorPointer; 151 drag_cursor_ = ui::kCursorPointer;
148 ash::Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer); 152 ash::Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer);
149 aura::client::DragDropDelegate* delegate = NULL; 153 aura::client::DragDropDelegate* delegate = NULL;
150 154
151 // We must guarantee that a target gets a OnDragEntered before Drop. WebKit 155 // We must guarantee that a target gets a OnDragEntered before Drop. WebKit
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 void DragDropController::Cleanup() { 299 void DragDropController::Cleanup() {
296 if (drag_window_) 300 if (drag_window_)
297 drag_window_->RemoveObserver(this); 301 drag_window_->RemoveObserver(this);
298 drag_window_ = NULL; 302 drag_window_ = NULL;
299 drag_data_ = NULL; 303 drag_data_ = NULL;
300 drag_drop_in_progress_ = false; 304 drag_drop_in_progress_ = false;
301 } 305 }
302 306
303 } // namespace internal 307 } // namespace internal
304 } // namespace ash 308 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698