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

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

Issue 13041002: Cancel drag upon screen lock (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/drag_drop/drag_drop_tracker.h ('k') | ash/drag_drop/drag_drop_tracker_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_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/root_window.h" 10 #include "ui/aura/root_window.h"
11 #include "ui/base/events/event.h" 11 #include "ui/base/events/event.h"
12 #include "ui/gfx/screen.h" 12 #include "ui/gfx/screen.h"
13 13
14 namespace ash {
15 namespace internal {
16
14 namespace { 17 namespace {
15 18
16 // Creates a window for capturing drag events. 19 // Creates a window for capturing drag events.
17 aura::Window* CreateCaptureWindow(aura::RootWindow* context_root) { 20 aura::Window* CreateCaptureWindow(aura::RootWindow* context_root,
18 aura::Window* window = new aura::Window(NULL); 21 aura::WindowDelegate* delegate) {
22 aura::Window* window = new aura::Window(delegate);
19 window->SetType(aura::client::WINDOW_TYPE_NORMAL); 23 window->SetType(aura::client::WINDOW_TYPE_NORMAL);
20 window->Init(ui::LAYER_NOT_DRAWN); 24 window->Init(ui::LAYER_NOT_DRAWN);
21 window->SetDefaultParentByRootWindow(context_root, gfx::Rect()); 25 window->SetDefaultParentByRootWindow(context_root, gfx::Rect());
22 window->Show(); 26 window->Show();
27 DCHECK(window->bounds().size().IsEmpty());
23 return window; 28 return window;
24 } 29 }
25 30
26 } // namespace 31 } // namespace
27 32
28 namespace ash { 33 DragDropTracker::DragDropTracker(aura::RootWindow* context_root,
29 namespace internal { 34 aura::WindowDelegate* delegate)
30 35 : capture_window_(CreateCaptureWindow(context_root, delegate)) {
31 DragDropTracker::DragDropTracker(aura::RootWindow* context_root)
32 : capture_window_(CreateCaptureWindow(context_root)) {
33 } 36 }
34 37
35 DragDropTracker::~DragDropTracker() { 38 DragDropTracker::~DragDropTracker() {
36 capture_window_->ReleaseCapture(); 39 capture_window_->ReleaseCapture();
37 } 40 }
38 41
39 void DragDropTracker::TakeCapture() { 42 void DragDropTracker::TakeCapture() {
40 capture_window_->SetCapture(); 43 capture_window_->SetCapture();
41 } 44 }
42 45
(...skipping 24 matching lines...) Expand all
67 ash::wm::GetRootWindowAt(location_in_screen), 70 ash::wm::GetRootWindowAt(location_in_screen),
68 &target_root_location); 71 &target_root_location);
69 return new ui::MouseEvent(event.type(), 72 return new ui::MouseEvent(event.type(),
70 target_location, 73 target_location,
71 target_root_location, 74 target_root_location,
72 event.flags()); 75 event.flags());
73 } 76 }
74 77
75 } // namespace internal 78 } // namespace internal
76 } // namespace ash 79 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_tracker.h ('k') | ash/drag_drop/drag_drop_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698