OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_X11_WHOLE_SCREEN_MOVE_LOOP_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/message_loop/message_pump_dispatcher.h" | 11 #include "ui/events/platform/platform_event_dispatcher.h" |
12 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image_skia.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 #include "ui/gfx/vector2d_f.h" | 14 #include "ui/gfx/vector2d_f.h" |
15 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h" | 15 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h" |
16 | 16 |
17 typedef struct _XDisplay XDisplay; | 17 typedef struct _XDisplay XDisplay; |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 class Window; | 20 class Window; |
21 } | 21 } |
22 | 22 |
23 namespace views { | 23 namespace views { |
24 | 24 |
25 class Widget; | 25 class Widget; |
26 | 26 |
27 // Runs a nested message loop and grabs the mouse. This is used to implement | 27 // Runs a nested message loop and grabs the mouse. This is used to implement |
28 // dragging. | 28 // dragging. |
29 class X11WholeScreenMoveLoop : public base::MessagePumpDispatcher { | 29 class X11WholeScreenMoveLoop : public ui::PlatformEventDispatcher { |
30 public: | 30 public: |
31 explicit X11WholeScreenMoveLoop(X11WholeScreenMoveLoopDelegate* delegate); | 31 explicit X11WholeScreenMoveLoop(X11WholeScreenMoveLoopDelegate* delegate); |
32 virtual ~X11WholeScreenMoveLoop(); | 32 virtual ~X11WholeScreenMoveLoop(); |
33 | 33 |
34 // Overridden from base::MessagePumpDispatcher: | 34 // ui:::PlatformEventDispatcher: |
35 virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE; | 35 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
| 36 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
36 | 37 |
37 // Runs the nested message loop. While the mouse is grabbed, use |cursor| as | 38 // Runs the nested message loop. While the mouse is grabbed, use |cursor| as |
38 // the mouse cursor. Returns true if there we were able to grab the pointer | 39 // the mouse cursor. Returns true if there we were able to grab the pointer |
39 // and run the move loop. | 40 // and run the move loop. |
40 bool RunMoveLoop(aura::Window* window, gfx::NativeCursor cursor); | 41 bool RunMoveLoop(aura::Window* window, gfx::NativeCursor cursor); |
41 | 42 |
42 // Updates the cursor while the move loop is running. | 43 // Updates the cursor while the move loop is running. |
43 void UpdateCursor(gfx::NativeCursor cursor); | 44 void UpdateCursor(gfx::NativeCursor cursor); |
44 | 45 |
45 // Ends the RunMoveLoop() that's currently in progress. | 46 // Ends the RunMoveLoop() that's currently in progress. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 gfx::Vector2dF drag_offset_; | 88 gfx::Vector2dF drag_offset_; |
88 XMotionEvent last_xmotion_; | 89 XMotionEvent last_xmotion_; |
89 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_; | 90 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_; |
90 | 91 |
91 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); | 92 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); |
92 }; | 93 }; |
93 | 94 |
94 } // namespace views | 95 } // namespace views |
95 | 96 |
96 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ | 97 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ |
OLD | NEW |