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 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 class VIEWS_EXPORT DesktopDragDropClientAuraX11 | 52 class VIEWS_EXPORT DesktopDragDropClientAuraX11 |
53 : public aura::client::DragDropClient, | 53 : public aura::client::DragDropClient, |
54 public aura::WindowObserver, | 54 public aura::WindowObserver, |
55 public X11MoveLoopDelegate { | 55 public X11MoveLoopDelegate { |
56 public: | 56 public: |
57 DesktopDragDropClientAuraX11( | 57 DesktopDragDropClientAuraX11( |
58 aura::Window* root_window, | 58 aura::Window* root_window, |
59 views::DesktopNativeCursorManager* cursor_manager, | 59 views::DesktopNativeCursorManager* cursor_manager, |
60 Display* xdisplay, | 60 Display* xdisplay, |
61 ::Window xwindow); | 61 ::Window xwindow); |
62 virtual ~DesktopDragDropClientAuraX11(); | 62 ~DesktopDragDropClientAuraX11() override; |
63 | 63 |
64 // We maintain a mapping of live DesktopDragDropClientAuraX11 objects to | 64 // We maintain a mapping of live DesktopDragDropClientAuraX11 objects to |
65 // their ::Windows. We do this so that we're able to short circuit sending | 65 // their ::Windows. We do this so that we're able to short circuit sending |
66 // X11 messages to windows in our process. | 66 // X11 messages to windows in our process. |
67 static DesktopDragDropClientAuraX11* GetForWindow(::Window window); | 67 static DesktopDragDropClientAuraX11* GetForWindow(::Window window); |
68 | 68 |
69 void Init(); | 69 void Init(); |
70 | 70 |
71 // These methods handle the various X11 client messages from the platform. | 71 // These methods handle the various X11 client messages from the platform. |
72 void OnXdndEnter(const XClientMessageEvent& event); | 72 void OnXdndEnter(const XClientMessageEvent& event); |
73 void OnXdndLeave(const XClientMessageEvent& event); | 73 void OnXdndLeave(const XClientMessageEvent& event); |
74 void OnXdndPosition(const XClientMessageEvent& event); | 74 void OnXdndPosition(const XClientMessageEvent& event); |
75 void OnXdndStatus(const XClientMessageEvent& event); | 75 void OnXdndStatus(const XClientMessageEvent& event); |
76 void OnXdndFinished(const XClientMessageEvent& event); | 76 void OnXdndFinished(const XClientMessageEvent& event); |
77 void OnXdndDrop(const XClientMessageEvent& event); | 77 void OnXdndDrop(const XClientMessageEvent& event); |
78 | 78 |
79 // Called when XSelection data has been copied to our process. | 79 // Called when XSelection data has been copied to our process. |
80 void OnSelectionNotify(const XSelectionEvent& xselection); | 80 void OnSelectionNotify(const XSelectionEvent& xselection); |
81 | 81 |
82 // Overridden from aura::client::DragDropClient: | 82 // Overridden from aura::client::DragDropClient: |
83 virtual int StartDragAndDrop( | 83 int StartDragAndDrop(const ui::OSExchangeData& data, |
84 const ui::OSExchangeData& data, | 84 aura::Window* root_window, |
85 aura::Window* root_window, | 85 aura::Window* source_window, |
86 aura::Window* source_window, | 86 const gfx::Point& root_location, |
87 const gfx::Point& root_location, | 87 int operation, |
88 int operation, | 88 ui::DragDropTypes::DragEventSource source) override; |
89 ui::DragDropTypes::DragEventSource source) override; | 89 void DragUpdate(aura::Window* target, const ui::LocatedEvent& event) override; |
90 virtual void DragUpdate(aura::Window* target, | 90 void Drop(aura::Window* target, const ui::LocatedEvent& event) override; |
91 const ui::LocatedEvent& event) override; | 91 void DragCancel() override; |
92 virtual void Drop(aura::Window* target, | 92 bool IsDragDropInProgress() override; |
93 const ui::LocatedEvent& event) override; | |
94 virtual void DragCancel() override; | |
95 virtual bool IsDragDropInProgress() override; | |
96 | 93 |
97 // Overridden from aura::WindowObserver: | 94 // Overridden from aura::WindowObserver: |
98 virtual void OnWindowDestroyed(aura::Window* window) override; | 95 void OnWindowDestroyed(aura::Window* window) override; |
99 | 96 |
100 // Overridden from X11WholeScreenMoveLoopDelegate: | 97 // Overridden from X11WholeScreenMoveLoopDelegate: |
101 virtual void OnMouseMovement(XMotionEvent* event) override; | 98 void OnMouseMovement(XMotionEvent* event) override; |
102 virtual void OnMouseReleased() override; | 99 void OnMouseReleased() override; |
103 virtual void OnMoveLoopEnded() override; | 100 void OnMoveLoopEnded() override; |
104 | 101 |
105 protected: | 102 protected: |
106 // The following methods are virtual for the sake of testing. | 103 // The following methods are virtual for the sake of testing. |
107 | 104 |
108 // Creates a move loop. | 105 // Creates a move loop. |
109 virtual scoped_ptr<X11MoveLoop> CreateMoveLoop( | 106 virtual scoped_ptr<X11MoveLoop> CreateMoveLoop( |
110 X11MoveLoopDelegate* delegate); | 107 X11MoveLoopDelegate* delegate); |
111 | 108 |
112 // Finds the topmost X11 window at |screen_point| and returns it if it is | 109 // Finds the topmost X11 window at |screen_point| and returns it if it is |
113 // Xdnd aware. Returns NULL otherwise. | 110 // Xdnd aware. Returns NULL otherwise. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 gfx::NativeCursor move_grab_cursor_; | 272 gfx::NativeCursor move_grab_cursor_; |
276 | 273 |
277 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_; | 274 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_; |
278 | 275 |
279 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); | 276 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); |
280 }; | 277 }; |
281 | 278 |
282 } // namespace views | 279 } // namespace views |
283 | 280 |
284 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ | 281 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ |
OLD | NEW |