Fix fling boosting
[chromium-blink-merge.git] / ash / drag_drop / drag_drop_tracker.h
blob670422b7dd2d208835394483539cd1387f466780
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
3 // found in the LICENSE file.
5 #ifndef ASH_DRAG_DROP_DRAG_DROP_TRACKER_H_
6 #define ASH_DRAG_DROP_DRAG_DROP_TRACKER_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/events/event.h"
13 namespace aura {
14 class Window;
15 class WindowDelegate;
18 namespace ash {
20 // Provides functions for handling drag events inside and outside the root
21 // window where drag is started. This internally sets up a capture window for
22 // tracking drag events outside the root window where drag is initiated.
23 // ash/wm/coordinate_conversion.h is used internally and only X11 environment
24 // is supported for now.
25 class ASH_EXPORT DragDropTracker {
26 public:
27 DragDropTracker(aura::Window* context_root,
28 aura::WindowDelegate* delegate);
29 ~DragDropTracker();
31 aura::Window* capture_window() { return capture_window_.get(); }
33 // Tells our |capture_window_| to take capture. This is not done right at
34 // creation to give the caller a chance to perform any operations needed
35 // before the capture is transfered.
36 void TakeCapture();
38 // Gets the target located at |event| in the coordinates of the active root
39 // window.
40 aura::Window* GetTarget(const ui::LocatedEvent& event);
42 // Converts the locations of |event| in the coordinates of the active root
43 // window to the ones in |target|'s coordinates.
44 // Caller takes ownership of the returned object.
45 ui::LocatedEvent* ConvertEvent(aura::Window* target,
46 const ui::LocatedEvent& event);
48 private:
49 // A window for capturing drag events while dragging.
50 scoped_ptr<aura::Window> capture_window_;
52 DISALLOW_COPY_AND_ASSIGN(DragDropTracker);
55 } // namespace ash
57 #endif // ASH_DRAG_DROP_DRAG_DROP_TRACKER_H_