OLD | NEW |
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_tracker.h" | 5 #include "ash/drag_drop/drag_drop_tracker.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/wm/coordinate_conversion.h" | 9 #include "ash/wm/coordinate_conversion.h" |
10 #include "ui/aura/client/window_tree_client.h" | 10 #include "ui/aura/client/window_tree_client.h" |
11 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
| 12 #include "ui/aura/window.h" |
12 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
13 #include "ui/gfx/screen.h" | 14 #include "ui/gfx/screen.h" |
14 | 15 |
15 namespace ash { | 16 namespace ash { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // Creates a window for capturing drag events. | 21 // Creates a window for capturing drag events. |
21 aura::Window* CreateCaptureWindow(aura::RootWindow* context_root, | 22 aura::Window* CreateCaptureWindow(aura::Window* context_root, |
22 aura::WindowDelegate* delegate) { | 23 aura::WindowDelegate* delegate) { |
23 aura::Window* window = new aura::Window(delegate); | 24 aura::Window* window = new aura::Window(delegate); |
24 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | 25 window->SetType(aura::client::WINDOW_TYPE_NORMAL); |
25 window->Init(ui::LAYER_NOT_DRAWN); | 26 window->Init(ui::LAYER_NOT_DRAWN); |
26 aura::client::ParentWindowWithContext(window, context_root, gfx::Rect()); | 27 aura::client::ParentWindowWithContext(window, context_root, gfx::Rect()); |
27 window->Show(); | 28 window->Show(); |
28 DCHECK(window->bounds().size().IsEmpty()); | 29 DCHECK(window->bounds().size().IsEmpty()); |
29 return window; | 30 return window; |
30 } | 31 } |
31 | 32 |
32 } // namespace | 33 } // namespace |
33 | 34 |
34 DragDropTracker::DragDropTracker(aura::RootWindow* context_root, | 35 DragDropTracker::DragDropTracker(aura::Window* context_root, |
35 aura::WindowDelegate* delegate) | 36 aura::WindowDelegate* delegate) |
36 : capture_window_(CreateCaptureWindow(context_root, delegate)) { | 37 : capture_window_(CreateCaptureWindow(context_root, delegate)) { |
37 } | 38 } |
38 | 39 |
39 DragDropTracker::~DragDropTracker() { | 40 DragDropTracker::~DragDropTracker() { |
40 capture_window_->ReleaseCapture(); | 41 capture_window_->ReleaseCapture(); |
41 } | 42 } |
42 | 43 |
43 void DragDropTracker::TakeCapture() { | 44 void DragDropTracker::TakeCapture() { |
44 capture_window_->SetCapture(); | 45 capture_window_->SetCapture(); |
(...skipping 26 matching lines...) Expand all Loading... |
71 ash::wm::GetRootWindowAt(location_in_screen), | 72 ash::wm::GetRootWindowAt(location_in_screen), |
72 &target_root_location); | 73 &target_root_location); |
73 return new ui::MouseEvent(event.type(), | 74 return new ui::MouseEvent(event.type(), |
74 target_location, | 75 target_location, |
75 target_root_location, | 76 target_root_location, |
76 event.flags()); | 77 event.flags()); |
77 } | 78 } |
78 | 79 |
79 } // namespace internal | 80 } // namespace internal |
80 } // namespace ash | 81 } // namespace ash |
OLD | NEW |