| 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 <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 18 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 19 #include "ui/base/cursor/cursor.h" | 19 #include "ui/base/cursor/cursor.h" |
| 20 #include "ui/base/dragdrop/drag_drop_types.h" | 20 #include "ui/base/dragdrop/drag_drop_types.h" |
| 21 #include "ui/gfx/geometry/point.h" | 21 #include "ui/gfx/geometry/point.h" |
| 22 #include "ui/gfx/geometry/size.h" |
| 22 #include "ui/gfx/x/x11_atom_cache.h" | 23 #include "ui/gfx/x/x11_atom_cache.h" |
| 23 #include "ui/views/views_export.h" | 24 #include "ui/views/views_export.h" |
| 24 #include "ui/views/widget/desktop_aura/x11_move_loop_delegate.h" | 25 #include "ui/views/widget/desktop_aura/x11_move_loop_delegate.h" |
| 25 #include "ui/wm/public/drag_drop_client.h" | 26 #include "ui/wm/public/drag_drop_client.h" |
| 26 | 27 |
| 27 namespace aura { | 28 namespace aura { |
| 28 namespace client { | 29 namespace client { |
| 29 class DragDropDelegate; | 30 class DragDropDelegate; |
| 30 } | 31 } |
| 31 } | 32 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 X11MoveLoopDelegate* delegate); | 112 X11MoveLoopDelegate* delegate); |
| 112 | 113 |
| 113 // Finds the topmost X11 window at |screen_point| and returns it if it is | 114 // Finds the topmost X11 window at |screen_point| and returns it if it is |
| 114 // Xdnd aware. Returns NULL otherwise. | 115 // Xdnd aware. Returns NULL otherwise. |
| 115 virtual ::Window FindWindowFor(const gfx::Point& screen_point); | 116 virtual ::Window FindWindowFor(const gfx::Point& screen_point); |
| 116 | 117 |
| 117 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X | 118 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X |
| 118 // server. | 119 // server. |
| 119 virtual void SendXClientEvent(::Window xid, XEvent* xev); | 120 virtual void SendXClientEvent(::Window xid, XEvent* xev); |
| 120 | 121 |
| 122 protected: |
| 123 Widget* drag_widget() { return drag_widget_.get(); } |
| 124 |
| 121 private: | 125 private: |
| 122 enum SourceState { | 126 enum SourceState { |
| 123 // |source_current_window_| will receive a drop once we receive an | 127 // |source_current_window_| will receive a drop once we receive an |
| 124 // XdndStatus from it. | 128 // XdndStatus from it. |
| 125 SOURCE_STATE_PENDING_DROP, | 129 SOURCE_STATE_PENDING_DROP, |
| 126 | 130 |
| 127 // The move looped will be ended once we receive XdndFinished from | 131 // The move looped will be ended once we receive XdndFinished from |
| 128 // |source_current_window_|. We should not send XdndPosition to | 132 // |source_current_window_|. We should not send XdndPosition to |
| 129 // |source_current_window_| while in this state. | 133 // |source_current_window_| while in this state. |
| 130 SOURCE_STATE_DROPPED, | 134 SOURCE_STATE_DROPPED, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // no action that we can agree on. | 275 // no action that we can agree on. |
| 272 ui::DragDropTypes::DragOperation negotiated_operation_; | 276 ui::DragDropTypes::DragOperation negotiated_operation_; |
| 273 | 277 |
| 274 // Ends the move loop if the target is too slow to respond after the mouse is | 278 // Ends the move loop if the target is too slow to respond after the mouse is |
| 275 // released. | 279 // released. |
| 276 base::OneShotTimer end_move_loop_timer_; | 280 base::OneShotTimer end_move_loop_timer_; |
| 277 | 281 |
| 278 // Widget that the user drags around. May be NULL. | 282 // Widget that the user drags around. May be NULL. |
| 279 std::unique_ptr<Widget> drag_widget_; | 283 std::unique_ptr<Widget> drag_widget_; |
| 280 | 284 |
| 285 // The size of drag image. |
| 286 gfx::Size drag_image_size_; |
| 287 |
| 281 // The offset of |drag_widget_| relative to the mouse position. | 288 // The offset of |drag_widget_| relative to the mouse position. |
| 282 gfx::Vector2d drag_widget_offset_; | 289 gfx::Vector2d drag_widget_offset_; |
| 283 | 290 |
| 284 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_; | 291 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_; |
| 285 | 292 |
| 286 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); | 293 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); |
| 287 }; | 294 }; |
| 288 | 295 |
| 289 } // namespace views | 296 } // namespace views |
| 290 | 297 |
| 291 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ | 298 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ |
| OLD | NEW |